From 24c3eca2e5ba5c1a86e87a43ff0326fb05b6a159 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Tue, 8 Jan 2013 21:19:01 +0100 Subject: [PATCH] Rename dialog files and classes Rename the files and classes for the dialogs to share all the same naming pattern. This should make navigation in the code a bit easier. Do not include dialogs not rewritten yet; they'll be edited as they are redesigned. --- src/AboutDialog.h | 22 ++++++++++++ src/{DialogAbout.ui => AboutDialog.ui} | 8 ++--- src/DialogAbout.cpp | 10 +++--- src/DialogAbout.h | 22 ------------ ...{EditFieldForm.cpp => EditFieldDialog.cpp} | 16 ++++----- src/{EditFieldForm.h => EditFieldDialog.h} | 16 ++++----- src/{EditFieldForm.ui => EditFieldDialog.ui} | 14 ++++---- ...{EditTableForm.cpp => EditTableDialog.cpp} | 34 +++++++++---------- src/{EditTableForm.h => EditTableDialog.h} | 16 ++++----- src/{EditTableForm.ui => EditTableDialog.ui} | 20 +++++------ src/MainWindow.cpp | 22 ++++++------ ...ferencesForm.cpp => PreferencesDialog.cpp} | 22 ++++++------ ...{PreferencesForm.h => PreferencesDialog.h} | 16 ++++----- ...referencesForm.ui => PreferencesDialog.ui} | 16 ++++----- src/src.pro | 28 +++++++-------- 15 files changed, 141 insertions(+), 141 deletions(-) create mode 100644 src/AboutDialog.h rename src/{DialogAbout.ui => AboutDialog.ui} (96%) delete mode 100644 src/DialogAbout.h rename src/{EditFieldForm.cpp => EditFieldDialog.cpp} (87%) rename src/{EditFieldForm.h => EditFieldDialog.h} (65%) rename src/{EditFieldForm.ui => EditFieldDialog.ui} (95%) rename src/{EditTableForm.cpp => EditTableDialog.cpp} (89%) rename src/{EditTableForm.h => EditTableDialog.h} (71%) rename src/{EditTableForm.ui => EditTableDialog.ui} (94%) rename src/{PreferencesForm.cpp => PreferencesDialog.cpp} (84%) rename src/{PreferencesForm.h => PreferencesDialog.h} (65%) rename src/{PreferencesForm.ui => PreferencesDialog.ui} (94%) diff --git a/src/AboutDialog.h b/src/AboutDialog.h new file mode 100644 index 00000000..5847175d --- /dev/null +++ b/src/AboutDialog.h @@ -0,0 +1,22 @@ +#ifndef __ABOUTDIALOG_H__ +#define __ABOUTDIALOG_H__ + +#include + +namespace Ui { +class AboutDialog; +} + +class AboutDialog : public QDialog +{ + Q_OBJECT + +public: + explicit AboutDialog(QWidget *parent = 0); + ~AboutDialog(); + +private: + Ui::AboutDialog *ui; +}; + +#endif diff --git a/src/DialogAbout.ui b/src/AboutDialog.ui similarity index 96% rename from src/DialogAbout.ui rename to src/AboutDialog.ui index e22990fd..30b475a0 100644 --- a/src/DialogAbout.ui +++ b/src/AboutDialog.ui @@ -1,7 +1,7 @@ - DialogAbout - + AboutDialog + 0 @@ -124,7 +124,7 @@ buttonBox accepted() - DialogAbout + AboutDialog accept() @@ -140,7 +140,7 @@ buttonBox rejected() - DialogAbout + AboutDialog reject() diff --git a/src/DialogAbout.cpp b/src/DialogAbout.cpp index 68b665b5..e02af24d 100644 --- a/src/DialogAbout.cpp +++ b/src/DialogAbout.cpp @@ -1,10 +1,10 @@ -#include "DialogAbout.h" -#include "ui_DialogAbout.h" +#include "AboutDialog.h" +#include "ui_AboutDialog.h" #include -DialogAbout::DialogAbout(QWidget *parent) : +AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::DialogAbout) + ui(new Ui::AboutDialog) { ui->setupUi(this); this->setFixedSize(669, 306); @@ -14,7 +14,7 @@ DialogAbout::DialogAbout(QWidget *parent) : ui->label_versionsqlite->setText(ui->label_versionsqlite->text() + " " + SQLITE_VERSION); } -DialogAbout::~DialogAbout() +AboutDialog::~AboutDialog() { delete ui; } diff --git a/src/DialogAbout.h b/src/DialogAbout.h deleted file mode 100644 index daa482e7..00000000 --- a/src/DialogAbout.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef DIALOGABOUT_H -#define DIALOGABOUT_H - -#include - -namespace Ui { -class DialogAbout; -} - -class DialogAbout : public QDialog -{ - Q_OBJECT - -public: - explicit DialogAbout(QWidget *parent = 0); - ~DialogAbout(); - -private: - Ui::DialogAbout *ui; -}; - -#endif // DIALOGABOUT_H diff --git a/src/EditFieldForm.cpp b/src/EditFieldDialog.cpp similarity index 87% rename from src/EditFieldForm.cpp rename to src/EditFieldDialog.cpp index d1583842..5563327f 100644 --- a/src/EditFieldForm.cpp +++ b/src/EditFieldDialog.cpp @@ -1,12 +1,12 @@ -#include "EditFieldForm.h" -#include "ui_EditFieldForm.h" +#include "EditFieldDialog.h" +#include "ui_EditFieldDialog.h" #include "sqlitedb.h" #include #include -editFieldForm::editFieldForm(QWidget* parent) +EditFieldDialog::EditFieldDialog(QWidget* parent) : QDialog(parent), - ui(new Ui::editFieldForm) + ui(new Ui::EditFieldDialog) { ui->setupUi(this); @@ -17,12 +17,12 @@ editFieldForm::editFieldForm(QWidget* parent) ui->radioCustom->setProperty("field_type", "__custom__"); } -editFieldForm::~editFieldForm() +EditFieldDialog::~EditFieldDialog() { delete ui; } -void editFieldForm::setInitialValues(DBBrowserDB *db, bool is_new, QString table, QString fld_name, QString fld_type) +void EditFieldDialog::setInitialValues(DBBrowserDB *db, bool is_new, QString table, QString fld_name, QString fld_type) { pdb = db; original_field_name = QString(fld_name); @@ -54,7 +54,7 @@ void editFieldForm::setInitialValues(DBBrowserDB *db, bool is_new, QString table checkInput(); } -void editFieldForm::accept() +void EditFieldDialog::accept() { field_name = ui->nameLineEdit->text(); field_type = ui->groupRadioTypes->checkedButton()->property("field_type").toString(); @@ -78,7 +78,7 @@ void editFieldForm::accept() QDialog::accept(); } -void editFieldForm::checkInput() +void EditFieldDialog::checkInput() { ui->nameLineEdit->setText(ui->nameLineEdit->text().trimmed()); bool valid = true; diff --git a/src/EditFieldForm.h b/src/EditFieldDialog.h similarity index 65% rename from src/EditFieldForm.h rename to src/EditFieldDialog.h index afe573dd..a6456826 100644 --- a/src/EditFieldForm.h +++ b/src/EditFieldDialog.h @@ -1,21 +1,21 @@ -#ifndef EDITFIELDFORM_H -#define EDITFIELDFORM_H +#ifndef __EDITFIELDDIALOG_H__ +#define __EDITFIELDDIALOG_H__ #include class DBBrowserDB; namespace Ui { -class editFieldForm; +class EditFieldDialog; } -class editFieldForm : public QDialog +class EditFieldDialog : public QDialog { Q_OBJECT public: - editFieldForm(QWidget* parent = 0); - ~editFieldForm(); + EditFieldDialog(QWidget* parent = 0); + ~EditFieldDialog(); QString table_name; QString field_name; @@ -30,7 +30,7 @@ public slots: private: DBBrowserDB *pdb; - Ui::editFieldForm *ui; + Ui::EditFieldDialog *ui; }; -#endif // EDITFIELDFORM_H +#endif diff --git a/src/EditFieldForm.ui b/src/EditFieldDialog.ui similarity index 95% rename from src/EditFieldForm.ui rename to src/EditFieldDialog.ui index e5720520..fd61b6ec 100644 --- a/src/EditFieldForm.ui +++ b/src/EditFieldDialog.ui @@ -1,7 +1,7 @@ - editFieldForm - + EditFieldDialog + 0 @@ -131,7 +131,7 @@ buttonBox accepted() - editFieldForm + EditFieldDialog accept() @@ -147,7 +147,7 @@ buttonBox rejected() - editFieldForm + EditFieldDialog reject() @@ -179,7 +179,7 @@ nameLineEdit textChanged(QString) - editFieldForm + EditFieldDialog checkInput() @@ -195,7 +195,7 @@ txtCustomType textChanged(QString) - editFieldForm + EditFieldDialog checkInput() @@ -211,7 +211,7 @@ groupRadioTypes buttonClicked(int) - editFieldForm + EditFieldDialog checkInput() diff --git a/src/EditTableForm.cpp b/src/EditTableDialog.cpp similarity index 89% rename from src/EditTableForm.cpp rename to src/EditTableDialog.cpp index d30ab16f..cfc99ca9 100644 --- a/src/EditTableForm.cpp +++ b/src/EditTableDialog.cpp @@ -1,25 +1,25 @@ -#include "EditTableForm.h" -#include "ui_EditTableForm.h" -#include "EditFieldForm.h" +#include "EditTableDialog.h" +#include "ui_EditTableDialog.h" +#include "EditFieldDialog.h" #include #include #include "sqlitedb.h" -editTableForm::editTableForm(QWidget* parent) +EditTableDialog::EditTableDialog(QWidget* parent) : QDialog(parent), modified(false), pdb(0), - ui(new Ui::editTableForm) + ui(new Ui::EditTableDialog) { ui->setupUi(this); } -editTableForm::~editTableForm() +EditTableDialog::~EditTableDialog() { delete ui; } -void editTableForm::setActiveTable(DBBrowserDB * thedb, QString tableName) +void EditTableDialog::setActiveTable(DBBrowserDB * thedb, QString tableName) { // Set variables pdb = thedb; @@ -40,7 +40,7 @@ void editTableForm::setActiveTable(DBBrowserDB * thedb, QString tableName) checkInput(); } -void editTableForm::populateFields() +void EditTableDialog::populateFields() { if (!pdb) return; @@ -60,7 +60,7 @@ void editTableForm::populateFields() } } -void editTableForm::accept() +void EditTableDialog::accept() { // Are we editing an already existing table or designing a new one? In the first case there is a table name set, // in the latter the current table name is empty @@ -105,7 +105,7 @@ void editTableForm::accept() QDialog::accept(); } -void editTableForm::reject() +void EditTableDialog::reject() { // Have we been in the process of editing an old table? if(curTable != "") @@ -117,7 +117,7 @@ void editTableForm::reject() QDialog::reject(); } -void editTableForm::checkInput() +void EditTableDialog::checkInput() { ui->editTableName->setText(ui->editTableName->text().trimmed()); bool valid = true; @@ -128,14 +128,14 @@ void editTableForm::checkInput() ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid); } -void editTableForm::editField() +void EditTableDialog::editField() { if(!ui->treeWidget->currentItem()) return; // Show the edit dialog QTreeWidgetItem *item = ui->treeWidget->currentItem(); - editFieldForm dialog(this); + EditFieldDialog dialog(this); dialog.setInitialValues(pdb, curTable == "", curTable, item->text(0), item->text(1)); if(dialog.exec()) { @@ -145,9 +145,9 @@ void editTableForm::editField() } } -void editTableForm::addField() +void EditTableDialog::addField() { - editFieldForm dialog(this); + EditFieldDialog dialog(this); dialog.setInitialValues(pdb, true, curTable, QString(""), QString("")); if(dialog.exec()) { @@ -160,7 +160,7 @@ void editTableForm::addField() } } -void editTableForm::removeField() +void EditTableDialog::removeField() { // Is there any item selected to delete? if(!ui->treeWidget->currentItem()) @@ -193,7 +193,7 @@ void editTableForm::removeField() checkInput(); } -void editTableForm::fieldSelectionChanged() +void EditTableDialog::fieldSelectionChanged() { ui->renameFieldButton->setEnabled(ui->treeWidget->selectionModel()->hasSelection()); ui->removeFieldButton->setEnabled(ui->treeWidget->selectionModel()->hasSelection()); diff --git a/src/EditTableForm.h b/src/EditTableDialog.h similarity index 71% rename from src/EditTableForm.h rename to src/EditTableDialog.h index 1a0b5dbd..b9cc1307 100644 --- a/src/EditTableForm.h +++ b/src/EditTableDialog.h @@ -1,20 +1,20 @@ -#ifndef EDITTABLEFORM_H -#define EDITTABLEFORM_H +#ifndef __EDITTABLEDIALOG_H__ +#define __EDITTABLEDIALOG_H__ #include class DBBrowserDB; namespace Ui { -class editTableForm; +class EditTableDialog; } -class editTableForm : public QDialog +class EditTableDialog : public QDialog { Q_OBJECT public: - editTableForm(QWidget* parent = 0); - ~editTableForm(); + EditTableDialog(QWidget* parent = 0); + ~EditTableDialog(); bool modified; QString curTable; @@ -36,7 +36,7 @@ protected: DBBrowserDB *pdb; private: - Ui::editTableForm *ui; + Ui::EditTableDialog *ui; }; -#endif // EDITTABLEFORM_H +#endif diff --git a/src/EditTableForm.ui b/src/EditTableDialog.ui similarity index 94% rename from src/EditTableForm.ui rename to src/EditTableDialog.ui index 3e0108d8..9166d1f4 100644 --- a/src/EditTableForm.ui +++ b/src/EditTableDialog.ui @@ -1,7 +1,7 @@ - editTableForm - + EditTableDialog + 0 @@ -161,7 +161,7 @@ buttonBox accepted() - editTableForm + EditTableDialog accept() @@ -177,7 +177,7 @@ buttonBox rejected() - editTableForm + EditTableDialog reject() @@ -193,7 +193,7 @@ treeWidget itemSelectionChanged() - editTableForm + EditTableDialog fieldSelectionChanged() @@ -209,7 +209,7 @@ addFieldButton clicked() - editTableForm + EditTableDialog addField() @@ -225,7 +225,7 @@ renameFieldButton clicked() - editTableForm + EditTableDialog editField() @@ -241,7 +241,7 @@ removeFieldButton clicked() - editTableForm + EditTableDialog removeField() @@ -257,7 +257,7 @@ editTableName textChanged(QString) - editTableForm + EditTableDialog checkInput() @@ -273,7 +273,7 @@ treeWidget itemChanged(QTreeWidgetItem*,int) - editTableForm + EditTableDialog checkInput() diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 149391fd..29772f79 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -12,12 +12,12 @@ #include #include #include "CreateIndexDialog.h" -#include "DialogAbout.h" -#include "EditTableForm.h" -#include "EditFieldForm.h" +#include "AboutDialog.h" +#include "EditTableDialog.h" +#include "EditFieldDialog.h" #include "ImportCSVForm.h" #include "ExportTableCSVForm.h" -#include "PreferencesForm.h" +#include "PreferencesDialog.h" #include "EditForm.h" #include "FindForm.h" #include "SQLLogDock.h" @@ -551,7 +551,7 @@ void MainWindow::createTable() return; } - editTableForm dialog(this); + EditTableDialog dialog(this); dialog.setActiveTable(&db, ""); if(dialog.exec()) { @@ -625,7 +625,7 @@ void MainWindow::editTable() } QString tableToEdit = ui->dbTreeWidget->currentItem()->text(0); - editTableForm dialog(this); + EditTableDialog dialog(this); dialog.setActiveTable(&db, tableToEdit); dialog.exec(); //check modified status @@ -674,7 +674,7 @@ void MainWindow::helpWhatsThis() void MainWindow::helpAbout() { - DialogAbout dialog(this); + AboutDialog dialog(this); dialog.exec(); } @@ -1003,7 +1003,7 @@ void MainWindow::importDatabaseFromSQL() void MainWindow::openPreferences() { - preferencesForm dialog(this); + PreferencesDialog dialog(this); if(dialog.exec()) { updatePreferences(); @@ -1013,7 +1013,7 @@ void MainWindow::openPreferences() void MainWindow::updatePreferences() { - preferencesForm prefs(this); + PreferencesDialog prefs(this); if(prefs.defaultencoding == "Latin1") db.setEncoding(kEncodingLatin1); @@ -1086,7 +1086,7 @@ void MainWindow::addField(){ // return; //} - editFieldForm dialog(this); + EditFieldDialog dialog(this); dialog.setInitialValues(&db, true, ui->dbTreeWidget->currentItem()->text(0), "", "TEXT"); if(dialog.exec()) populateStructure(); @@ -1097,7 +1097,7 @@ void MainWindow::editField(){ return; QTreeWidgetItem *item = ui->dbTreeWidget->currentItem(); - editFieldForm dialog(this); + EditFieldDialog dialog(this); dialog.setInitialValues(&db, false, item->parent()->text(0), item->text(0), item->text(2)); if(dialog.exec()) { diff --git a/src/PreferencesForm.cpp b/src/PreferencesDialog.cpp similarity index 84% rename from src/PreferencesForm.cpp rename to src/PreferencesDialog.cpp index 3ee84e3d..3d1e8a03 100644 --- a/src/PreferencesForm.cpp +++ b/src/PreferencesDialog.cpp @@ -1,13 +1,13 @@ -#include "PreferencesForm.h" -#include "ui_PreferencesForm.h" +#include "PreferencesDialog.h" +#include "ui_PreferencesDialog.h" #include #include #include #include "sqlitedb.h" -preferencesForm::preferencesForm(QWidget* parent) +PreferencesDialog::PreferencesDialog(QWidget* parent) : QDialog(parent), - ui(new Ui::preferencesForm) + ui(new Ui::PreferencesDialog) { ui->setupUi(this); @@ -17,12 +17,12 @@ preferencesForm::preferencesForm(QWidget* parent) /* * Destroys the object and frees any allocated resources */ -preferencesForm::~preferencesForm() +PreferencesDialog::~PreferencesDialog() { delete ui; } -void preferencesForm::defaultDataChanged( int which ) +void PreferencesDialog::defaultDataChanged( int which ) { if (which==2) { defaultnewdata = QString("\'\'"); @@ -33,7 +33,7 @@ void preferencesForm::defaultDataChanged( int which ) } } -void preferencesForm::defaultTextChanged( int which ) +void PreferencesDialog::defaultTextChanged( int which ) { if (which==1) { defaulttext = QString("Auto"); @@ -43,7 +43,7 @@ void preferencesForm::defaultTextChanged( int which ) } -void preferencesForm::encodingChanged( int which ) +void PreferencesDialog::encodingChanged( int which ) { if (which==1) { defaultencoding = QString("Latin1"); @@ -52,7 +52,7 @@ void preferencesForm::encodingChanged( int which ) } } -void preferencesForm::chooseLocation() +void PreferencesDialog::chooseLocation() { QString s = QFileDialog::getExistingDirectory( this, @@ -67,7 +67,7 @@ void preferencesForm::chooseLocation() } } -void preferencesForm::loadSettings() +void PreferencesDialog::loadSettings() { QSettings settings(QApplication::organizationName(), g_sApplicationNameShort); settings.sync(); @@ -107,7 +107,7 @@ void preferencesForm::loadSettings() ui->locationEdit->setText(defaultlocation); } -void preferencesForm::saveSettings() +void PreferencesDialog::saveSettings() { QSettings settings(QApplication::organizationName(), g_sApplicationNameShort); diff --git a/src/PreferencesForm.h b/src/PreferencesDialog.h similarity index 65% rename from src/PreferencesForm.h rename to src/PreferencesDialog.h index afc639d9..a4a3bbe7 100644 --- a/src/PreferencesForm.h +++ b/src/PreferencesDialog.h @@ -1,19 +1,19 @@ -#ifndef PREFERENCESFORM_H -#define PREFERENCESFORM_H +#ifndef __PREFERENCESDIALOG_H__ +#define __PREFERENCESDIALOG_H__ #include namespace Ui { -class preferencesForm; +class PreferencesDialog; } -class preferencesForm : public QDialog +class PreferencesDialog : public QDialog { Q_OBJECT public: - preferencesForm(QWidget* parent = 0); - ~preferencesForm(); + PreferencesDialog(QWidget* parent = 0); + ~PreferencesDialog(); QString defaulttext; QString defaultlocation; @@ -29,7 +29,7 @@ public slots: virtual void saveSettings(); private: - Ui::preferencesForm *ui; + Ui::PreferencesDialog *ui; }; -#endif // PREFERENCESFORM_H +#endif diff --git a/src/PreferencesForm.ui b/src/PreferencesDialog.ui similarity index 94% rename from src/PreferencesForm.ui rename to src/PreferencesDialog.ui index 98190fcc..8db6c8bd 100644 --- a/src/PreferencesForm.ui +++ b/src/PreferencesDialog.ui @@ -1,7 +1,7 @@ - preferencesForm - + PreferencesDialog + 0 @@ -154,7 +154,7 @@ buttonBox accepted() - preferencesForm + PreferencesDialog saveSettings() @@ -170,7 +170,7 @@ buttonBox rejected() - preferencesForm + PreferencesDialog reject() @@ -186,7 +186,7 @@ encodingComboBox activated(int) - preferencesForm + PreferencesDialog encodingChanged(int) @@ -202,7 +202,7 @@ defaultdataComboBox activated(int) - preferencesForm + PreferencesDialog defaultDataChanged(int) @@ -218,7 +218,7 @@ setLocationButton clicked() - preferencesForm + PreferencesDialog chooseLocation() @@ -234,7 +234,7 @@ defaultTextComboBox activated(int) - preferencesForm + PreferencesDialog defaultTextChanged(int) diff --git a/src/src.pro b/src/src.pro index 2e545dc8..fe0af630 100644 --- a/src/src.pro +++ b/src/src.pro @@ -14,17 +14,17 @@ HEADERS += \ sqlitedb.h \ sqlbrowser_util.h \ SQLLogDock.h \ - DialogAbout.h \ - EditFieldForm.h \ EditForm.h \ - EditTableForm.h \ ExportTableCSVForm.h \ FindForm.h \ ImportCSVForm.h \ MainWindow.h \ - PreferencesForm.h \ SQLiteSyntaxHighlighter.h \ - CreateIndexDialog.h + CreateIndexDialog.h \ + EditFieldDialog.h \ + AboutDialog.h \ + EditTableDialog.h \ + PreferencesDialog.h SOURCES += \ sqlitedb.cpp \ @@ -32,16 +32,16 @@ SOURCES += \ SQLLogDock.cpp \ main.cpp \ DialogAbout.cpp \ - EditFieldForm.cpp \ EditForm.cpp \ - EditTableForm.cpp \ ExportTableCSVForm.cpp \ FindForm.cpp \ ImportCSVForm.cpp \ MainWindow.cpp \ - PreferencesForm.cpp \ SQLiteSyntaxHighlighter.cpp \ - CreateIndexDialog.cpp + CreateIndexDialog.cpp \ + EditFieldDialog.cpp \ + EditTableDialog.cpp \ + PreferencesDialog.cpp QMAKE_CXXFLAGS += -DAPP_VERSION=\\\"`cd $$PWD;git log -n1 --format=%h_git`\\\" @@ -63,9 +63,9 @@ mac { RESOURCES += icons/icons.qrc FORMS += \ - DialogAbout.ui \ - EditFieldForm.ui \ - EditTableForm.ui \ MainWindow.ui \ - PreferencesForm.ui \ - CreateIndexDialog.ui + CreateIndexDialog.ui \ + AboutDialog.ui \ + EditFieldDialog.ui \ + EditTableDialog.ui \ + PreferencesDialog.ui