mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
Use nullptr where possible
This commit is contained in:
@@ -12,7 +12,7 @@ class AboutDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(QWidget *parent = 0);
|
||||
explicit AboutDialog(QWidget *parent = nullptr);
|
||||
~AboutDialog();
|
||||
|
||||
private:
|
||||
|
||||
@@ -56,8 +56,8 @@ void CipherDialog::checkInputFields()
|
||||
{
|
||||
if(keyFormat() == KeyFormats::Passphrase)
|
||||
{
|
||||
ui->editPassword->setValidator(0);
|
||||
ui->editPassword2->setValidator(0);
|
||||
ui->editPassword->setValidator(nullptr);
|
||||
ui->editPassword2->setValidator(nullptr);
|
||||
ui->editPassword->setPlaceholderText("");
|
||||
} else if(keyFormat() == KeyFormats::RawKey) {
|
||||
ui->editPassword->setValidator(rawKeyValidator);
|
||||
|
||||
@@ -12,7 +12,7 @@ class ColumnDisplayFormatDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ColumnDisplayFormatDialog(const QString& colname, QString current_format, QWidget* parent = 0);
|
||||
explicit ColumnDisplayFormatDialog(const QString& colname, QString current_format, QWidget* parent = nullptr);
|
||||
~ColumnDisplayFormatDialog();
|
||||
|
||||
QString selectedDisplayFormat() const;
|
||||
|
||||
@@ -249,7 +249,7 @@ bool DbStructureModel::dropMimeData(const QMimeData* data, Qt::DropAction action
|
||||
reloadData();
|
||||
return true;
|
||||
} else {
|
||||
QMessageBox::warning(0, QApplication::applicationName(), m_db.lastError());
|
||||
QMessageBox::warning(nullptr, QApplication::applicationName(), m_db.lastError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class DbStructureModel : public QAbstractItemModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DbStructureModel(DBBrowserDB& db, QObject* parent = 0);
|
||||
explicit DbStructureModel(DBBrowserDB& db, QObject* parent = nullptr);
|
||||
~DbStructureModel();
|
||||
|
||||
void reloadData();
|
||||
|
||||
@@ -15,7 +15,7 @@ class EditDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EditDialog(QWidget* parent = 0);
|
||||
explicit EditDialog(QWidget* parent = nullptr);
|
||||
~EditDialog();
|
||||
|
||||
void setCurrentIndex(const QModelIndex& idx);
|
||||
|
||||
@@ -17,7 +17,7 @@ class EditIndexDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EditIndexDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& indexName, bool createIndex, QWidget* parent = 0);
|
||||
explicit EditIndexDialog(DBBrowserDB& db, const sqlb::ObjectIdentifier& indexName, bool createIndex, QWidget* parent = nullptr);
|
||||
~EditIndexDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -604,7 +604,7 @@ void EditTableDialog::removeField()
|
||||
{
|
||||
if(!pdb.renameColumn(curTable, m_table, ui->treeWidget->currentItem()->text(0), sqlb::FieldPtr()))
|
||||
{
|
||||
QMessageBox::warning(0, QApplication::applicationName(), pdb.lastError());
|
||||
QMessageBox::warning(nullptr, QApplication::applicationName(), pdb.lastError());
|
||||
} else {
|
||||
//relayout
|
||||
m_table = *(pdb.getObjectByName(curTable).dynamicCast<sqlb::Table>());
|
||||
@@ -688,7 +688,7 @@ void EditTableDialog::moveCurrentField(bool down)
|
||||
(down ? 1 : -1)
|
||||
))
|
||||
{
|
||||
QMessageBox::warning(0, QApplication::applicationName(), pdb.lastError());
|
||||
QMessageBox::warning(nullptr, QApplication::applicationName(), pdb.lastError());
|
||||
} else {
|
||||
// Reload table SQL
|
||||
m_table = *(pdb.getObjectByName(curTable).dynamicCast<sqlb::Table>());
|
||||
|
||||
@@ -18,7 +18,7 @@ class EditTableDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EditTableDialog(DBBrowserDB& pdb, const sqlb::ObjectIdentifier& tableName, bool createTable, QWidget* parent = 0);
|
||||
explicit EditTableDialog(DBBrowserDB& pdb, const sqlb::ObjectIdentifier& tableName, bool createTable, QWidget* parent = nullptr);
|
||||
~EditTableDialog();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
ExportFormatJson,
|
||||
};
|
||||
|
||||
explicit ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidget* parent = 0,
|
||||
explicit ExportDataDialog(DBBrowserDB& db, ExportFormats format, QWidget* parent = nullptr,
|
||||
const QString& query = "", const sqlb::ObjectIdentifier& selection = sqlb::ObjectIdentifier());
|
||||
~ExportDataDialog();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class ExportSqlDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExportSqlDialog(DBBrowserDB* db, QWidget* parent = 0, const QString& selection = "");
|
||||
explicit ExportSqlDialog(DBBrowserDB* db, QWidget* parent = nullptr, const QString& selection = "");
|
||||
~ExportSqlDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -15,7 +15,7 @@ class ExtendedTableWidget : public QTableView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExtendedTableWidget(QWidget* parent = 0);
|
||||
explicit ExtendedTableWidget(QWidget* parent = nullptr);
|
||||
|
||||
FilterTableHeader* filterHeader() { return m_tableHeader; }
|
||||
|
||||
|
||||
@@ -8,16 +8,16 @@ class FileDialog : public QFileDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QString getOpenFileName(QWidget* parent = 0, const QString& caption = QString(),
|
||||
const QString& filter = QString(), QString* selectedFilter = 0,
|
||||
static QString getOpenFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& filter = QString(), QString* selectedFilter = nullptr,
|
||||
Options options = 0);
|
||||
static QStringList getOpenFileNames(QWidget* parent = 0, const QString& caption = QString(),
|
||||
const QString& filter = QString(), QString* selectedFilter = 0,
|
||||
static QStringList getOpenFileNames(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& filter = QString(), QString* selectedFilter = nullptr,
|
||||
Options options = 0);
|
||||
static QString getSaveFileName(QWidget* parent = 0, const QString& caption = QString(),
|
||||
const QString& filter = QString(), const QString& defaultFileName = QString(), QString* selectedFilter = 0,
|
||||
static QString getSaveFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
const QString& filter = QString(), const QString& defaultFileName = QString(), QString* selectedFilter = nullptr,
|
||||
Options options = 0);
|
||||
static QString getExistingDirectory(QWidget* parent = 0, const QString& caption = QString(),
|
||||
static QString getExistingDirectory(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||
Options options = 0);
|
||||
|
||||
static QString getSqlDatabaseFileFilter()
|
||||
|
||||
@@ -13,7 +13,7 @@ class FilterTableHeader : public QHeaderView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilterTableHeader(QTableView* parent = 0);
|
||||
explicit FilterTableHeader(QTableView* parent = nullptr);
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -20,7 +20,7 @@ class ImportCsvDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImportCsvDialog(const QStringList& filenames, DBBrowserDB* db, QWidget* parent = 0);
|
||||
explicit ImportCsvDialog(const QStringList& filenames, DBBrowserDB* db, QWidget* parent = nullptr);
|
||||
~ImportCsvDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -430,7 +430,7 @@ void MainWindow::clearTableBrowser()
|
||||
if (!ui->dataTable->model())
|
||||
return;
|
||||
|
||||
ui->dataTable->setModel(0);
|
||||
ui->dataTable->setModel(nullptr);
|
||||
if(qobject_cast<FilterTableHeader*>(ui->dataTable->horizontalHeader()))
|
||||
qobject_cast<FilterTableHeader*>(ui->dataTable->horizontalHeader())->generateFilters(0);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ void MainWindow::populateTable()
|
||||
|
||||
// Set model
|
||||
bool reconnectSelectionSignals = false;
|
||||
if(ui->dataTable->model() == 0)
|
||||
if(ui->dataTable->model() == nullptr)
|
||||
reconnectSelectionSignals = true;
|
||||
ui->dataTable->setModel(m_browseTableModel);
|
||||
if(reconnectSelectionSignals)
|
||||
@@ -594,7 +594,7 @@ bool MainWindow::fileClose()
|
||||
setRecordsetLabel();
|
||||
|
||||
// Reset the plot dock model
|
||||
plotDock->updatePlot(0);
|
||||
plotDock->updatePlot(nullptr);
|
||||
|
||||
activateFields(false);
|
||||
|
||||
@@ -2240,7 +2240,7 @@ void MainWindow::editEncryption()
|
||||
// Show progress dialog even though we can't provide any detailed progress information but this
|
||||
// process might take some time.
|
||||
QProgressDialog progress(this);
|
||||
progress.setCancelButton(0);
|
||||
progress.setCancelButton(nullptr);
|
||||
progress.setWindowModality(Qt::ApplicationModal);
|
||||
progress.show();
|
||||
qApp->processEvents();
|
||||
|
||||
@@ -94,7 +94,7 @@ class MainWindow : public QMainWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent = 0);
|
||||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
DBBrowserDB& getDb() { return db; }
|
||||
|
||||
@@ -151,14 +151,14 @@ void PlotDock::updatePlot(SqliteTableModel* model, BrowseDataTableSettings* sett
|
||||
}
|
||||
|
||||
// search for the x axis select
|
||||
QTreeWidgetItem* xitem = 0;
|
||||
QTreeWidgetItem* xitem = nullptr;
|
||||
for(int i = 0; i < ui->treePlotColumns->topLevelItemCount(); ++i)
|
||||
{
|
||||
xitem = ui->treePlotColumns->topLevelItem(i);
|
||||
if(xitem->checkState(PlotColumnX) == Qt::Checked)
|
||||
break;
|
||||
|
||||
xitem = 0;
|
||||
xitem = nullptr;
|
||||
}
|
||||
|
||||
QStringList yAxisLabels;
|
||||
|
||||
@@ -17,7 +17,7 @@ class PlotDock : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlotDock(QWidget* parent = 0);
|
||||
explicit PlotDock(QWidget* parent = nullptr);
|
||||
~PlotDock();
|
||||
|
||||
struct PlotSettings
|
||||
|
||||
@@ -19,7 +19,7 @@ class PreferencesDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PreferencesDialog(QWidget* parent = 0);
|
||||
explicit PreferencesDialog(QWidget* parent = nullptr);
|
||||
~PreferencesDialog();
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -103,7 +103,7 @@ void RemoteDatabase::gotReply(QNetworkReply* reply)
|
||||
// Check if request was successful
|
||||
if(reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(),
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(),
|
||||
tr("Error when connecting to %1.\n%2").arg(reply->url().toString()).arg(reply->errorString()));
|
||||
reply->deleteLater();
|
||||
return;
|
||||
@@ -258,7 +258,7 @@ void RemoteDatabase::gotError(QNetworkReply* reply, const QList<QSslError>& erro
|
||||
|
||||
// Build an error message and short it to the user
|
||||
QString message = tr("Error opening remote file at %1.\n%2").arg(reply->url().toString()).arg(errors.at(0).errorString());
|
||||
QMessageBox::warning(0, qApp->applicationName(), message);
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), message);
|
||||
|
||||
// Delete reply later, i.e. after returning from this slot function
|
||||
if(m_progress)
|
||||
@@ -330,7 +330,7 @@ bool RemoteDatabase::prepareSsl(QNetworkRequest* request, const QString& clientC
|
||||
const QSslCertificate& cert = m_clientCertFiles[clientCert];
|
||||
if(cert.isNull())
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), tr("Error: Invalid client certificate specified."));
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), tr("Error: Invalid client certificate specified."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ bool RemoteDatabase::prepareSsl(QNetworkRequest* request, const QString& clientC
|
||||
{
|
||||
// If the private key couldn't be read, we assume it's password protected. So ask the user for the correct password and try reading it
|
||||
// again. If the user cancels the password dialog, abort the whole process.
|
||||
QString password = QInputDialog::getText(0, qApp->applicationName(), tr("Please enter the passphrase for this client certificate in order to authenticate."));
|
||||
QString password = QInputDialog::getText(nullptr, qApp->applicationName(), tr("Please enter the passphrase for this client certificate in order to authenticate."));
|
||||
if(password.isEmpty())
|
||||
return false;
|
||||
clientKey = QSslKey(&fileClientCert, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, password.toUtf8());
|
||||
@@ -389,7 +389,7 @@ void RemoteDatabase::fetch(const QString& url, RequestType type, const QString&
|
||||
// Check if network is accessible. If not, abort right here
|
||||
if(m_manager->networkAccessible() == QNetworkAccessManager::NotAccessible)
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), tr("Error: The network is not accessible."));
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), tr("Error: The network is not accessible."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt
|
||||
// Check if network is accessible. If not, abort right here
|
||||
if(m_manager->networkAccessible() == QNetworkAccessManager::NotAccessible)
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), tr("Error: The network is not accessible."));
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), tr("Error: The network is not accessible."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt
|
||||
if(!file->open(QFile::ReadOnly))
|
||||
{
|
||||
delete file;
|
||||
QMessageBox::warning(0, qApp->applicationName(), tr("Error: Cannot open the file for sending."));
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), tr("Error: Cannot open the file for sending."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ QString RemoteDatabase::localAdd(QString filename, QString identity, const QUrl&
|
||||
// Insert database into local database list
|
||||
QString sql = QString("INSERT INTO local(identity, name, url, commit_id, file) VALUES(?, ?, ?, ?, ?)");
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, 0) != SQLITE_OK)
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK)
|
||||
return QString();
|
||||
|
||||
if(sqlite3_bind_text(stmt, 1, identity.toUtf8(), identity.toUtf8().length(), SQLITE_TRANSIENT))
|
||||
@@ -644,7 +644,7 @@ QString RemoteDatabase::localAdd(QString filename, QString identity, const QUrl&
|
||||
|
||||
QString sql = QString("UPDATE local SET commit_id=? WHERE identity=? AND url=?");
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, 0) != SQLITE_OK)
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK)
|
||||
return QString();
|
||||
|
||||
if(sqlite3_bind_text(stmt, 1, new_commit_id.toUtf8(), new_commit_id.toUtf8().length(), SQLITE_TRANSIENT))
|
||||
@@ -694,7 +694,7 @@ QString RemoteDatabase::localExists(const QUrl& url, QString identity)
|
||||
// Query commit id and filename for the given combination of url and identity
|
||||
QString sql = QString("SELECT id, commit_id, file FROM local WHERE url=? AND identity=?");
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, 0) != SQLITE_OK)
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK)
|
||||
return QString();
|
||||
|
||||
if(sqlite3_bind_text(stmt, 1, url.toString(QUrl::PrettyDecoded | QUrl::RemoveQuery).toUtf8(), url.toString(QUrl::PrettyDecoded | QUrl::RemoveQuery).toUtf8().length(), SQLITE_TRANSIENT))
|
||||
@@ -757,7 +757,7 @@ QString RemoteDatabase::localExists(const QUrl& url, QString identity)
|
||||
// files are all in the same directory and their names need to be unique because of this.
|
||||
QString sql = QString("DELETE FROM local WHERE file=?");
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, 0) != SQLITE_OK)
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK)
|
||||
return QString();
|
||||
if(sqlite3_bind_text(stmt, 1, local_file.toUtf8(), local_file.toUtf8().length(), SQLITE_TRANSIENT))
|
||||
{
|
||||
@@ -795,7 +795,7 @@ QString RemoteDatabase::localCheckFile(const QString& local_file)
|
||||
// be unique for the entire table because the files are all in the same directory and their names need to be unique because of this.
|
||||
QString sql = QString("DELETE FROM local WHERE file=?");
|
||||
sqlite3_stmt* stmt;
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, 0) != SQLITE_OK)
|
||||
if(sqlite3_prepare_v2(m_dbLocal, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK)
|
||||
return QString();
|
||||
if(sqlite3_bind_text(stmt, 1, local_file.toUtf8(), local_file.toUtf8().length(), SQLITE_TRANSIENT))
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ class SqlUiLexer : public QsciLexerSQL
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SqlUiLexer(QObject *parent = 0);
|
||||
explicit SqlUiLexer(QObject *parent = nullptr);
|
||||
|
||||
enum ApiCompleterIconId
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ class VacuumDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VacuumDialog(DBBrowserDB* _db, QWidget* parent = 0);
|
||||
explicit VacuumDialog(DBBrowserDB* _db, QWidget* parent = nullptr);
|
||||
~VacuumDialog();
|
||||
|
||||
private:
|
||||
|
||||
@@ -6,7 +6,7 @@ CSVParser::CSVParser(bool trimfields, char fieldseparator, char quotechar)
|
||||
: m_bTrimFields(trimfields)
|
||||
, m_cFieldSeparator(fieldseparator)
|
||||
, m_cQuoteChar(quotechar)
|
||||
, m_pCSVProgress(0)
|
||||
, m_pCSVProgress(nullptr)
|
||||
, m_nBufferSize(4096)
|
||||
{
|
||||
}
|
||||
@@ -120,7 +120,7 @@ CSVParser::ParserResult CSVParser::parse(csvRowFunction insertFunction, QTextStr
|
||||
m_pCSVProgress->start();
|
||||
|
||||
// Initialise row buffer and get pointer to the first field
|
||||
record = { 0, 0, 0 };
|
||||
record = { nullptr, 0, 0 };
|
||||
increaseRowSize(record);
|
||||
field = record.fields;
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ static void regexp(sqlite3_context* ctx, int /*argc*/, sqlite3_value* argv[])
|
||||
|
||||
bool DBBrowserDB::isOpen ( ) const
|
||||
{
|
||||
return _db!=0;
|
||||
return _db != nullptr;
|
||||
}
|
||||
|
||||
bool DBBrowserDB::getDirty() const
|
||||
@@ -103,7 +103,7 @@ bool DBBrowserDB::open(const QString& db, bool readOnly)
|
||||
dontCheckForStructureUpdates = false;
|
||||
|
||||
// Get encryption settings for database file
|
||||
CipherDialog* cipher = 0;
|
||||
CipherDialog* cipher = nullptr;
|
||||
if(tryEncryptionSettings(db, &isEncrypted, cipher) == false)
|
||||
return false;
|
||||
|
||||
@@ -128,9 +128,9 @@ bool DBBrowserDB::open(const QString& db, bool readOnly)
|
||||
if (_db)
|
||||
{
|
||||
// add UTF16 collation (comparison is performed by QString functions)
|
||||
sqlite3_create_collation(_db, "UTF16", SQLITE_UTF16, 0, sqlite_compare_utf16);
|
||||
sqlite3_create_collation(_db, "UTF16", SQLITE_UTF16, nullptr, sqlite_compare_utf16);
|
||||
// add UTF16CI (case insensitive) collation (comparison is performed by QString functions)
|
||||
sqlite3_create_collation(_db, "UTF16CI", SQLITE_UTF16, 0, sqlite_compare_utf16ci);
|
||||
sqlite3_create_collation(_db, "UTF16CI", SQLITE_UTF16, nullptr, sqlite_compare_utf16ci);
|
||||
|
||||
// register collation callback
|
||||
Callback<void(void*, sqlite3*, int, const char*)>::func = std::bind(&DBBrowserDB::collationNeeded, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
|
||||
@@ -187,7 +187,7 @@ bool DBBrowserDB::attach(const QString& filename, QString attach_as)
|
||||
if(fi == path)
|
||||
{
|
||||
QString schema = QString::fromUtf8((const char*)sqlite3_column_text(db_vm, 1));
|
||||
QMessageBox::information(0, qApp->applicationName(), tr("This database has already been attached. Its schema name is '%1'.").arg(schema));
|
||||
QMessageBox::information(nullptr, qApp->applicationName(), tr("This database has already been attached. Its schema name is '%1'.").arg(schema));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ bool DBBrowserDB::attach(const QString& filename, QString attach_as)
|
||||
|
||||
// Ask for name to be given to the attached database if none was provided
|
||||
if(attach_as.isEmpty())
|
||||
attach_as = QInputDialog::getText(0,
|
||||
attach_as = QInputDialog::getText(nullptr,
|
||||
qApp->applicationName(),
|
||||
tr("Please specify the database name under which you want to access the attached database"),
|
||||
QLineEdit::Normal,
|
||||
@@ -206,7 +206,7 @@ bool DBBrowserDB::attach(const QString& filename, QString attach_as)
|
||||
|
||||
#ifdef ENABLE_SQLCIPHER
|
||||
// Try encryption settings
|
||||
CipherDialog* cipher = 0;
|
||||
CipherDialog* cipher = nullptr;
|
||||
bool is_encrypted;
|
||||
if(tryEncryptionSettings(filename, &is_encrypted, cipher) == false)
|
||||
return false;
|
||||
@@ -217,14 +217,14 @@ bool DBBrowserDB::attach(const QString& filename, QString attach_as)
|
||||
key = "KEY " + cipher->password();
|
||||
if(!executeSQL(QString("ATTACH '%1' AS %2 %3").arg(filename).arg(sqlb::escapeIdentifier(attach_as)).arg(key), false))
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), lastErrorMessage);
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage);
|
||||
return false;
|
||||
}
|
||||
if(cipher && cipher->pageSize() != 1024)
|
||||
{
|
||||
if(!executeSQL(QString("PRAGMA %1.cipher_page_size = %2").arg(sqlb::escapeIdentifier(attach_as)).arg(cipher->pageSize()), false))
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), lastErrorMessage);
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ bool DBBrowserDB::attach(const QString& filename, QString attach_as)
|
||||
// Attach database
|
||||
if(!executeSQL(QString("ATTACH '%1' AS %2").arg(filename).arg(sqlb::escapeIdentifier(attach_as)), false))
|
||||
{
|
||||
QMessageBox::warning(0, qApp->applicationName(), lastErrorMessage);
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), lastErrorMessage);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -254,7 +254,7 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filename, bool* encrypted
|
||||
|
||||
// Try reading from database
|
||||
*encrypted = false;
|
||||
cipherSettings = 0;
|
||||
cipherSettings = nullptr;
|
||||
while(true)
|
||||
{
|
||||
QString statement = "SELECT COUNT(*) FROM sqlite_master;";
|
||||
@@ -274,7 +274,7 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filename, bool* encrypted
|
||||
sqlite3_finalize(vm);
|
||||
#ifdef ENABLE_SQLCIPHER
|
||||
delete cipherSettings;
|
||||
cipherSettings = new CipherDialog(0, false);
|
||||
cipherSettings = new CipherDialog(nullptr, false);
|
||||
if(cipherSettings->exec())
|
||||
{
|
||||
// Close and reopen database first to be in a clean state after the failed read attempt from above
|
||||
@@ -282,7 +282,7 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filename, bool* encrypted
|
||||
if(sqlite3_open_v2(filename.toUtf8(), &dbHandle, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK)
|
||||
{
|
||||
delete cipherSettings;
|
||||
cipherSettings = 0;
|
||||
cipherSettings = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ bool DBBrowserDB::tryEncryptionSettings(const QString& filename, bool* encrypted
|
||||
sqlite3_close(dbHandle);
|
||||
*encrypted = false;
|
||||
delete cipherSettings;
|
||||
cipherSettings = 0;
|
||||
cipherSettings = nullptr;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
@@ -411,7 +411,7 @@ bool DBBrowserDB::create ( const QString & db)
|
||||
if( openresult != SQLITE_OK ){
|
||||
lastErrorMessage = QString::fromUtf8((const char*)sqlite3_errmsg(_db));
|
||||
sqlite3_close(_db);
|
||||
_db = 0;
|
||||
_db = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ bool DBBrowserDB::close()
|
||||
{
|
||||
if (getDirty())
|
||||
{
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(0,
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(nullptr,
|
||||
QApplication::applicationName(),
|
||||
tr("Do you want to save the changes "
|
||||
"made to the database file %1?").arg(curDBFilename),
|
||||
@@ -477,7 +477,7 @@ bool DBBrowserDB::close()
|
||||
}
|
||||
sqlite3_close(_db);
|
||||
}
|
||||
_db = 0;
|
||||
_db = nullptr;
|
||||
schemata.clear();
|
||||
savepointList.clear();
|
||||
emit dbChanged(getDirty());
|
||||
@@ -1031,7 +1031,7 @@ bool DBBrowserDB::updateRecord(const sqlb::ObjectIdentifier& table, const QStrin
|
||||
|
||||
sqlite3_stmt* stmt;
|
||||
int success = 1;
|
||||
if(sqlite3_prepare_v2(_db, sql.toUtf8(), -1, &stmt, 0) != SQLITE_OK)
|
||||
if(sqlite3_prepare_v2(_db, sql.toUtf8(), -1, &stmt, nullptr) != SQLITE_OK)
|
||||
success = 0;
|
||||
if(success == 1) {
|
||||
if(itsBlob)
|
||||
@@ -1274,9 +1274,9 @@ bool DBBrowserDB::renameColumn(const sqlb::ObjectIdentifier& tablename, const sq
|
||||
}
|
||||
if(!errored_sqls.isEmpty())
|
||||
{
|
||||
QMessageBox::information(0, qApp->applicationName(), tr("Restoring some of the objects associated with this table failed. "
|
||||
"This is most likely because some column names changed. "
|
||||
"Here's the SQL statement which you might want to fix and execute manually:\n\n")
|
||||
QMessageBox::information(nullptr, qApp->applicationName(), tr("Restoring some of the objects associated with this table failed. "
|
||||
"This is most likely because some column names changed. "
|
||||
"Here's the SQL statement which you might want to fix and execute manually:\n\n")
|
||||
+ errored_sqls);
|
||||
}
|
||||
|
||||
@@ -1553,7 +1553,7 @@ bool DBBrowserDB::loadExtension(const QString& filename)
|
||||
|
||||
// Try to load extension
|
||||
char* error;
|
||||
if(sqlite3_load_extension(_db, filename.toUtf8(), 0, &error) == SQLITE_OK)
|
||||
if(sqlite3_load_extension(_db, filename.toUtf8(), nullptr, &error) == SQLITE_OK)
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,7 @@ class DBBrowserDB : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DBBrowserDB () : _db(0), isEncrypted(false), isReadOnly(false), dontCheckForStructureUpdates(false) {}
|
||||
explicit DBBrowserDB () : _db(nullptr), isEncrypted(false), isReadOnly(false), dontCheckForStructureUpdates(false) {}
|
||||
virtual ~DBBrowserDB (){}
|
||||
bool open(const QString& db, bool readOnly = false);
|
||||
bool attach(const QString& filename, QString attach_as = "");
|
||||
|
||||
@@ -368,7 +368,7 @@ bool SqliteTableModel::setTypedData(const QModelIndex& index, bool isBlob, const
|
||||
return true;
|
||||
} else {
|
||||
lock.unlock();
|
||||
QMessageBox::warning(0, qApp->applicationName(), tr("Error changing data:\n%1").arg(m_db.lastError()));
|
||||
QMessageBox::warning(nullptr, qApp->applicationName(), tr("Error changing data:\n%1").arg(m_db.lastError()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class SqliteTableModel : public QAbstractTableModel
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit SqliteTableModel(DBBrowserDB& db, QObject *parent = 0, size_t chunkSize = 50000, const QString& encoding = QString());
|
||||
explicit SqliteTableModel(DBBrowserDB& db, QObject *parent = nullptr, size_t chunkSize = 50000, const QString& encoding = QString());
|
||||
void reset();
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include <QMimeData>
|
||||
#include <cmath>
|
||||
|
||||
SqlUiLexer* SqlTextEdit::sqlLexer = 0;
|
||||
SqlUiLexer* SqlTextEdit::sqlLexer = nullptr;
|
||||
|
||||
SqlTextEdit::SqlTextEdit(QWidget* parent) :
|
||||
QsciScintilla(parent)
|
||||
{
|
||||
// Create lexer object if not done yet
|
||||
if(sqlLexer == 0)
|
||||
if(sqlLexer == nullptr)
|
||||
sqlLexer = new SqlUiLexer(this);
|
||||
|
||||
// Set the lexer
|
||||
|
||||
@@ -14,7 +14,7 @@ class SqlTextEdit : public QsciScintilla
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SqlTextEdit(QWidget *parent = 0);
|
||||
explicit SqlTextEdit(QWidget *parent = nullptr);
|
||||
virtual ~SqlTextEdit();
|
||||
|
||||
static SqlUiLexer* sqlLexer;
|
||||
|
||||
Reference in New Issue
Block a user