10#include <QSqlDatabase>
11#include "ui_backendselector.h"
12#include "../xmlsettingsdialog/basesettingsmanager.h"
28 Ui_->MySQLSettings_->setEnabled (
false);
29 Ui_->StorageType_->removeItem (2);
33 Ui_->PostgreSQLSettings_->setEnabled (
false);
34 Ui_->StorageType_->removeItem (1);
40 void BackendSelector::FillUI ()
42 int index = Ui_->StorageType_->findText (Manager_->Property (
"StorageType",
"SQLite").toString ());
43 Ui_->StorageType_->setCurrentIndex (index);
44 Ui_->Settings_->setCurrentIndex (index);
47 Ui_->PostgresHostname_->setText (Manager_->Property (
"PostgresHostname",
"localhost").toString ());
48 Ui_->PostgresPort_->setValue (Manager_->Property (
"PostgresPort",
defaultPgPort).toInt ());
49 Ui_->PostgresDBName_->setText (Manager_->Property (
"PostgresDBName",
"").toString ());
50 Ui_->PostgresUsername_->setText (Manager_->Property (
"PostgresUsername",
"").toString ());
51 Ui_->PostgresPassword_->setText (Manager_->Property (
"PostgresPassword",
"").toString ());
54 Ui_->MysqlHostname_->setText (Manager_->Property (
"MysqlHostname",
"localhost").toString ());
55 Ui_->MysqlPort_->setValue (Manager_->Property (
"MysqlPort",
defaultMysqlPort).toInt ());
56 Ui_->MysqlDBName_->setText (Manager_->Property (
"MysqlDBName",
"").toString ());
57 Ui_->MysqlUsername_->setText (Manager_->Property (
"MysqlUsername",
"").toString ());
58 Ui_->MysqlPassword_->setText (Manager_->Property (
"MysqlPassword",
"").toString ());
63 Manager_->setProperty (
"StorageType", Ui_->StorageType_->currentText ());
65 Manager_->setProperty (
"PostgresHostname", Ui_->PostgresHostname_->text ());
66 Manager_->setProperty (
"PostgresPort", Ui_->PostgresPort_->value ());
67 Manager_->setProperty (
"PostgresDBName", Ui_->PostgresDBName_->text ());
68 Manager_->setProperty (
"PostgresUsername", Ui_->PostgresUsername_->text ());
69 Manager_->setProperty (
"PostgresPassword", Ui_->PostgresPassword_->text ());
71 Manager_->setProperty (
"MysqlHostname", Ui_->MysqlHostname_->text ());
72 Manager_->setProperty (
"MysqlPort", Ui_->MysqlPort_->value ());
73 Manager_->setProperty (
"MysqlDBName", Ui_->MysqlDBName_->text ());
74 Manager_->setProperty (
"MysqlUsername", Ui_->MysqlUsername_->text ());
75 Manager_->setProperty (
"MysqlPassword", Ui_->MysqlPassword_->text ());
A common dialog to select storage backend.
~BackendSelector() override
void accept()
Updates the settings manager.
BackendSelector(BaseSettingsManager *manager, QWidget *parent=nullptr)
Constructs the BackendSelector.
void reject()
Restores the settings in UI.
Container< T > Filter(const Container< T > &c, F f)