Very initial preparations for MySQL support.
This commit is contained in:
parent
b806e440e1
commit
005e6c18a4
@ -30,6 +30,7 @@
|
|||||||
#define MAX_ZOOM_FACTOR 10.0
|
#define MAX_ZOOM_FACTOR 10.0
|
||||||
#define ICON_SIZE_SETTINGS 16
|
#define ICON_SIZE_SETTINGS 16
|
||||||
#define DATABASE_DRIVER "QSQLITE"
|
#define DATABASE_DRIVER "QSQLITE"
|
||||||
|
#define DATABASE_DRIVER_MYSQL "QMYSQL"
|
||||||
#define NO_PARENT_CATEGORY -1
|
#define NO_PARENT_CATEGORY -1
|
||||||
#define TRAY_ICON_BUBBLE_TIMEOUT 15000
|
#define TRAY_ICON_BUBBLE_TIMEOUT 15000
|
||||||
#define KEY_MESSAGES_VIEW "messages_view_column_"
|
#define KEY_MESSAGES_VIEW "messages_view_column_"
|
||||||
|
@ -62,7 +62,7 @@ QSettings::Status Settings::setupSettings() {
|
|||||||
QWebSettings::setIconDatabasePath(web_path);
|
QWebSettings::setIconDatabasePath(web_path);
|
||||||
|
|
||||||
qDebug("Initializing settings in '%s' (portable way).",
|
qDebug("Initializing settings in '%s' (portable way).",
|
||||||
qPrintable(QDir::toNativeSeparators(app_path)));
|
qPrintable(QDir::toNativeSeparators(app_path_file)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Portable settings are NOT available, store them in
|
// Portable settings are NOT available, store them in
|
||||||
|
@ -438,8 +438,23 @@ void FormSettings::loadGeneral() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load SQLITE.
|
||||||
|
m_ui->m_cmbDatabaseDriver->addItem("SQLite", DATABASE_DRIVER);
|
||||||
|
|
||||||
// Load in-memory database status.
|
// Load in-memory database status.
|
||||||
m_ui->m_cmbUseInMemoryDatabase->setChecked(Settings::instance()->value(APP_CFG_GEN, "use_in_memory_db", false).toBool());
|
m_ui->m_cmbSqliteUseInMemoryDatabase->setChecked(Settings::instance()->value(APP_CFG_GEN, "use_in_memory_db", false).toBool());
|
||||||
|
|
||||||
|
if (QSqlDatabase::isDriverAvailable(DATABASE_DRIVER_MYSQL)) {
|
||||||
|
// Load MySQL.
|
||||||
|
m_ui->m_cmbDatabaseDriver->addItem("MySQL", DATABASE_DRIVER_MYSQL);
|
||||||
|
|
||||||
|
// TODO: nacist username, password atp.
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: nacist podle nastaveni
|
||||||
|
m_ui->m_cmbDatabaseDriver->setCurrentIndex(m_ui->m_cmbDatabaseDriver->findData(Settings::instance()->value(APP_CFG_GEN,
|
||||||
|
"database_driver",
|
||||||
|
DATABASE_DRIVER).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormSettings::saveGeneral() {
|
void FormSettings::saveGeneral() {
|
||||||
@ -454,13 +469,29 @@ void FormSettings::saveGeneral() {
|
|||||||
|
|
||||||
// Setup in-memory database status.
|
// Setup in-memory database status.
|
||||||
bool original_inmemory = Settings::instance()->value(APP_CFG_GEN, "use_in_memory_db", false).toBool();
|
bool original_inmemory = Settings::instance()->value(APP_CFG_GEN, "use_in_memory_db", false).toBool();
|
||||||
bool new_inmemory = m_ui->m_cmbUseInMemoryDatabase->isChecked();
|
bool new_inmemory = m_ui->m_cmbSqliteUseInMemoryDatabase->isChecked();
|
||||||
|
|
||||||
if (original_inmemory != new_inmemory) {
|
if (original_inmemory != new_inmemory) {
|
||||||
m_changedDataTexts.append(tr("in-memory database switched"));
|
m_changedDataTexts.append(tr("in-memory database switched"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save data storage settings.
|
||||||
|
QString original_db_driver = Settings::instance()->value(APP_CFG_GEN, "database_driver", DATABASE_DRIVER).toString();
|
||||||
|
QString selected_db_driver = m_ui->m_cmbDatabaseDriver->itemData(m_ui->m_cmbDatabaseDriver->currentIndex()).toString();
|
||||||
|
|
||||||
|
// Save SQLite.
|
||||||
Settings::instance()->setValue(APP_CFG_GEN, "use_in_memory_db", new_inmemory);
|
Settings::instance()->setValue(APP_CFG_GEN, "use_in_memory_db", new_inmemory);
|
||||||
|
|
||||||
|
if (QSqlDatabase::isDriverAvailable(DATABASE_DRIVER_MYSQL)) {
|
||||||
|
// Save MySQL.
|
||||||
|
// TODO: ulozit username, password atp.
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings::instance()->setValue(APP_CFG_GEN, "database_driver", selected_db_driver);
|
||||||
|
|
||||||
|
if (original_db_driver != selected_db_driver) {
|
||||||
|
m_changedDataTexts.append(tr("data storage backend changed"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormSettings::loadInterface() {
|
void FormSettings::loadInterface() {
|
||||||
|
@ -14,13 +14,74 @@
|
|||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QListWidget" name="m_listSettings">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>220</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>220</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="showDropIndicator" stdset="0">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="movement">
|
||||||
|
<enum>QListView::Static</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionRectVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="currentRow">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>General</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Keyboard shortcuts</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>User interface</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Web browser & proxy</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Feeds & messages</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>5</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="m_pageGeneral">
|
<widget class="QWidget" name="m_pageGeneral">
|
||||||
<layout class="QFormLayout" name="formLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -33,24 +94,59 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QCheckBox" name="m_checkAutostart">
|
<widget class="QCheckBox" name="m_checkAutostart">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Launch RSS Guard on operating system startup</string>
|
<string>Launch RSS Guard on operating system startup</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QCheckBox" name="m_cmbUseInMemoryDatabase">
|
<widget class="QGroupBox" name="m_gbDataStorage">
|
||||||
<property name="text">
|
<property name="sizePolicy">
|
||||||
<string>Use in-memory database as the working database</string>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="title">
|
||||||
</item>
|
<string>Data storage</string>
|
||||||
<item row="2" column="0" colspan="2">
|
</property>
|
||||||
<widget class="QLabel" name="label_2">
|
<layout class="QFormLayout" name="formLayout_14">
|
||||||
<property name="text">
|
<property name="fieldGrowthPolicy">
|
||||||
<string>Usage of in-memory working database has several advantages and pitfalls. Make sure that you are familiar with these before you turn this feature on. Advantages:
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="m_lblDatabaseDriver">
|
||||||
|
<property name="text">
|
||||||
|
<string>Database driver</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="m_cmbDatabaseDriver"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QStackedWidget" name="m_stackedDatabaseDriver">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="m_pageSqlite">
|
||||||
|
<layout class="QFormLayout" name="formLayout_15">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="m_cmbSqliteUseInMemoryDatabase">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use in-memory database as the working database</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="m_lblSqliteInMemoryWarnings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Usage of in-memory working database has several advantages and pitfalls. Make sure that you are familiar with these before you turn this feature on. Advantages:
|
||||||
<ul>
|
<ul>
|
||||||
<li>higher speed for feed/message manipulations (especially with thousands of messages displayed),</li>
|
<li>higher speed for feed/message manipulations (especially with thousands of messages displayed),</li>
|
||||||
<li>whole database stored in RAM, thus your hard drive can rest more.</li>
|
<li>whole database stored in RAM, thus your hard drive can rest more.</li>
|
||||||
@ -61,16 +157,91 @@ Disadvantages:
|
|||||||
<li>application startup and shutdown can take little longer (max. 2 seconds).</li>
|
<li>application startup and shutdown can take little longer (max. 2 seconds).</li>
|
||||||
</ul>
|
</ul>
|
||||||
Authors of this application are NOT responsible for lost data.</string>
|
Authors of this application are NOT responsible for lost data.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="indent">
|
<property name="indent">
|
||||||
<number>20</number>
|
<number>20</number>
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="m_pageMysql">
|
||||||
|
<layout class="QFormLayout" name="formLayout_16">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hostname</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="LineEditWithStatus" name="widget_2" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Username</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="LineEditWithStatus" name="widget" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Password</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="LineEditWithStatus" name="widget_3" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="m_lblDataStorageWarning">
|
||||||
|
<property name="text">
|
||||||
|
<string>WARNING: Note that switching to another data storage type will NOT preserve your data from currently active data storage.</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -102,8 +273,8 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>564</width>
|
||||||
<height>30</height>
|
<height>363</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
@ -180,8 +351,8 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>167</width>
|
<width>558</width>
|
||||||
<height>219</height>
|
<height>337</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
@ -839,67 +1010,6 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QListWidget" name="m_listSettings">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>220</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>220</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="showDropIndicator" stdset="0">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="movement">
|
|
||||||
<enum>QListView::Static</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionRectVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="currentRow">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>General</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Keyboard shortcuts</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>User interface</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Language</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Web browser & proxy</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Feeds & messages</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
<item row="1" column="0" colspan="2">
|
||||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -919,6 +1029,12 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||||||
<header>dynamicshortcutswidget.h</header>
|
<header>dynamicshortcutswidget.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineEditWithStatus</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>lineeditwithstatus.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
@ -1002,5 +1118,21 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_cmbDatabaseDriver</sender>
|
||||||
|
<signal>currentIndexChanged(int)</signal>
|
||||||
|
<receiver>m_stackedDatabaseDriver</receiver>
|
||||||
|
<slot>setCurrentIndex(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>558</x>
|
||||||
|
<y>96</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>516</x>
|
||||||
|
<y>215</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user