diff --git a/src/AboutDialog.h b/src/AboutDialog.h index 7eed5c72..3eb5aee9 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -12,7 +12,7 @@ class AboutDialog : public QDialog Q_OBJECT public: - explicit AboutDialog(QWidget *parent = 0); + explicit AboutDialog(QWidget *parent = nullptr); ~AboutDialog(); private: diff --git a/src/CipherDialog.cpp b/src/CipherDialog.cpp index 3ca4c0af..51285683 100644 --- a/src/CipherDialog.cpp +++ b/src/CipherDialog.cpp @@ -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); diff --git a/src/ColumnDisplayFormatDialog.h b/src/ColumnDisplayFormatDialog.h index 066e348a..d79c7e04 100644 --- a/src/ColumnDisplayFormatDialog.h +++ b/src/ColumnDisplayFormatDialog.h @@ -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; diff --git a/src/DbStructureModel.cpp b/src/DbStructureModel.cpp index af869b6c..9bb1d2f4 100644 --- a/src/DbStructureModel.cpp +++ b/src/DbStructureModel.cpp @@ -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; } } diff --git a/src/DbStructureModel.h b/src/DbStructureModel.h index 691d3a69..83d3446c 100644 --- a/src/DbStructureModel.h +++ b/src/DbStructureModel.h @@ -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(); diff --git a/src/EditDialog.h b/src/EditDialog.h index cd91d62e..399be289 100644 --- a/src/EditDialog.h +++ b/src/EditDialog.h @@ -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); diff --git a/src/EditIndexDialog.h b/src/EditIndexDialog.h index ad6d28b3..75d6c730 100644 --- a/src/EditIndexDialog.h +++ b/src/EditIndexDialog.h @@ -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: diff --git a/src/EditTableDialog.cpp b/src/EditTableDialog.cpp index 2f974291..ffff932c 100644 --- a/src/EditTableDialog.cpp +++ b/src/EditTableDialog.cpp @@ -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()); @@ -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()); diff --git a/src/EditTableDialog.h b/src/EditTableDialog.h index 53649773..79b738bc 100644 --- a/src/EditTableDialog.h +++ b/src/EditTableDialog.h @@ -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: diff --git a/src/ExportDataDialog.h b/src/ExportDataDialog.h index 4971a826..c2db1ced 100644 --- a/src/ExportDataDialog.h +++ b/src/ExportDataDialog.h @@ -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(); diff --git a/src/ExportSqlDialog.h b/src/ExportSqlDialog.h index 3f455e99..8e0b4670 100644 --- a/src/ExportSqlDialog.h +++ b/src/ExportSqlDialog.h @@ -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: diff --git a/src/ExtendedTableWidget.h b/src/ExtendedTableWidget.h index 9243aa3e..41ee2aba 100644 --- a/src/ExtendedTableWidget.h +++ b/src/ExtendedTableWidget.h @@ -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; } diff --git a/src/FileDialog.h b/src/FileDialog.h index b5ca2829..7b19bcaf 100644 --- a/src/FileDialog.h +++ b/src/FileDialog.h @@ -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() diff --git a/src/FilterTableHeader.h b/src/FilterTableHeader.h index 8e170ba3..d8b21292 100644 --- a/src/FilterTableHeader.h +++ b/src/FilterTableHeader.h @@ -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: diff --git a/src/ImportCsvDialog.h b/src/ImportCsvDialog.h index 62d5353f..6f48c5d1 100644 --- a/src/ImportCsvDialog.h +++ b/src/ImportCsvDialog.h @@ -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: diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index d726bc27..bdad34f4 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -430,7 +430,7 @@ void MainWindow::clearTableBrowser() if (!ui->dataTable->model()) return; - ui->dataTable->setModel(0); + ui->dataTable->setModel(nullptr); if(qobject_cast(ui->dataTable->horizontalHeader())) qobject_cast(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(); diff --git a/src/MainWindow.h b/src/MainWindow.h index 5333aa57..307e3863 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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; } diff --git a/src/PlotDock.cpp b/src/PlotDock.cpp index 2f588b8b..57b298c6 100644 --- a/src/PlotDock.cpp +++ b/src/PlotDock.cpp @@ -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; diff --git a/src/PlotDock.h b/src/PlotDock.h index 445c88be..b0f1d81b 100644 --- a/src/PlotDock.h +++ b/src/PlotDock.h @@ -17,7 +17,7 @@ class PlotDock : public QDialog Q_OBJECT public: - explicit PlotDock(QWidget* parent = 0); + explicit PlotDock(QWidget* parent = nullptr); ~PlotDock(); struct PlotSettings diff --git a/src/PreferencesDialog.h b/src/PreferencesDialog.h index 646878db..456f7c27 100644 --- a/src/PreferencesDialog.h +++ b/src/PreferencesDialog.h @@ -19,7 +19,7 @@ class PreferencesDialog : public QDialog Q_OBJECT public: - explicit PreferencesDialog(QWidget* parent = 0); + explicit PreferencesDialog(QWidget* parent = nullptr); ~PreferencesDialog(); private slots: diff --git a/src/RemoteDatabase.cpp b/src/RemoteDatabase.cpp index 1d375b86..6f4722ef 100644 --- a/src/RemoteDatabase.cpp +++ b/src/RemoteDatabase.cpp @@ -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& 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)) { diff --git a/src/SqlUiLexer.h b/src/SqlUiLexer.h index 2f21277c..b356ceaa 100644 --- a/src/SqlUiLexer.h +++ b/src/SqlUiLexer.h @@ -12,7 +12,7 @@ class SqlUiLexer : public QsciLexerSQL Q_OBJECT public: - explicit SqlUiLexer(QObject *parent = 0); + explicit SqlUiLexer(QObject *parent = nullptr); enum ApiCompleterIconId { diff --git a/src/VacuumDialog.h b/src/VacuumDialog.h index 7ba8cba7..f828d431 100644 --- a/src/VacuumDialog.h +++ b/src/VacuumDialog.h @@ -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: diff --git a/src/csvparser.cpp b/src/csvparser.cpp index e7841054..ff0be680 100644 --- a/src/csvparser.cpp +++ b/src/csvparser.cpp @@ -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; diff --git a/src/sqlitedb.cpp b/src/sqlitedb.cpp index 1d1a4b1c..a5a7ce28 100644 --- a/src/sqlitedb.cpp +++ b/src/sqlitedb.cpp @@ -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::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 { diff --git a/src/sqlitedb.h b/src/sqlitedb.h index 1b19f824..88dc0d0e 100644 --- a/src/sqlitedb.h +++ b/src/sqlitedb.h @@ -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 = ""); diff --git a/src/sqlitetablemodel.cpp b/src/sqlitetablemodel.cpp index ea01bb94..483cd37d 100644 --- a/src/sqlitetablemodel.cpp +++ b/src/sqlitetablemodel.cpp @@ -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; } } diff --git a/src/sqlitetablemodel.h b/src/sqlitetablemodel.h index 1734a214..7eb7cc6f 100644 --- a/src/sqlitetablemodel.h +++ b/src/sqlitetablemodel.h @@ -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; diff --git a/src/sqltextedit.cpp b/src/sqltextedit.cpp index b516f9f9..50f430b7 100644 --- a/src/sqltextedit.cpp +++ b/src/sqltextedit.cpp @@ -8,13 +8,13 @@ #include #include -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 diff --git a/src/sqltextedit.h b/src/sqltextedit.h index 4948b448..783a7728 100644 --- a/src/sqltextedit.h +++ b/src/sqltextedit.h @@ -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;