31 #include <QSqlDatabase> 32 #include "ui_backendselector.h" 33 #include "../xmlsettingsdialog/basesettingsmanager.h" 41 Ui_ =
new Ui::BackendSelector;
47 if (!QSqlDatabase::isDriverAvailable (
"QMYSQL"))
49 Ui_->MySQLSettings_->setEnabled (
false);
50 Ui_->StorageType_->removeItem (2);
52 if (!QSqlDatabase::isDriverAvailable (
"QPSQL"))
54 Ui_->PostgreSQLSettings_->setEnabled (
false);
55 Ui_->StorageType_->removeItem (1);
59 void BackendSelector::FillUI ()
61 int index = Ui_->StorageType_->findText (Manager_->Property (
"StorageType",
"SQLite").toString ());
62 Ui_->StorageType_->setCurrentIndex (index);
63 Ui_->Settings_->setCurrentIndex (index);
65 Ui_->PostgresHostname_->setText (Manager_->Property (
"PostgresHostname",
"localhost").toString ());
66 Ui_->PostgresPort_->setValue (Manager_->Property (
"PostgresPort", 5432).toInt ());
67 Ui_->PostgresDBName_->setText (Manager_->Property (
"PostgresDBName",
"").toString ());
68 Ui_->PostgresUsername_->setText (Manager_->Property (
"PostgresUsername",
"").toString ());
69 Ui_->PostgresPassword_->setText (Manager_->Property (
"PostgresPassword",
"").toString ());
71 Ui_->MysqlHostname_->setText (Manager_->Property (
"MysqlHostname",
"localhost").toString ());
72 Ui_->MysqlPort_->setValue (Manager_->Property (
"MysqlPort", 5432).toInt ());
73 Ui_->MysqlDBName_->setText (Manager_->Property (
"MysqlDBName",
"").toString ());
74 Ui_->MysqlUsername_->setText (Manager_->Property (
"MysqlUsername",
"").toString ());
75 Ui_->MysqlPassword_->setText (Manager_->Property (
"MysqlPassword",
"").toString ());
80 Manager_->setProperty (
"StorageType", Ui_->StorageType_->currentText ());
82 Manager_->setProperty (
"PostgresHostname", Ui_->PostgresHostname_->text ());
83 Manager_->setProperty (
"PostgresPort", Ui_->PostgresPort_->value ());
84 Manager_->setProperty (
"PostgresDBName", Ui_->PostgresDBName_->text ());
85 Manager_->setProperty (
"PostgresUsername", Ui_->PostgresUsername_->text ());
86 Manager_->setProperty (
"PostgresPassword", Ui_->PostgresPassword_->text ());
88 Manager_->setProperty (
"MysqlHostname", Ui_->MysqlHostname_->text ());
89 Manager_->setProperty (
"MysqlPort", Ui_->MysqlPort_->value ());
90 Manager_->setProperty (
"MysqlDBName", Ui_->MysqlDBName_->text ());
91 Manager_->setProperty (
"MysqlUsername", Ui_->MysqlUsername_->text ());
92 Manager_->setProperty (
"MysqlPassword", Ui_->MysqlPassword_->text ());
void accept()
Updates the settings manager.
void reject()
Restores the settings in UI.
BackendSelector(BaseSettingsManager *manager, QWidget *parent=0)
Constructs the BackendSelector.