mirror of https://github.com/qTox/qTox.git
5 changed files with 223 additions and 4 deletions
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox. |
||||
|
||||
This program is libre software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
|
||||
See the COPYING file for more details. |
||||
*/ |
||||
|
||||
#include "ui_advancedsettings.h" |
||||
|
||||
#include "advancedform.h" |
||||
#include "src/historykeeper.h" |
||||
#include "src/misc/settings.h" |
||||
#include "src/misc/db/plaindb.h" |
||||
|
||||
AdvancedForm::AdvancedForm() : |
||||
GenericForm(tr("Advanced"), QPixmap(":/img/settings/general.png")) |
||||
{ |
||||
bodyUI = new Ui::AdvancedSettings; |
||||
bodyUI->setupUi(this); |
||||
|
||||
bodyUI->dbLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); |
||||
bodyUI->dbLabel->setOpenExternalLinks(true); |
||||
|
||||
bodyUI->syncTypeComboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); |
||||
bodyUI->syncTypeComboBox->addItems({"FULL - very safe, slowest (recommended)", |
||||
"NORMAL - almost as safe as FULL, about 20% faster than FULL", |
||||
"OFF - disables all safety, when something goes wrong your history may be lost, fastest (not recommended)" |
||||
}); |
||||
int index = 2 - static_cast<int>(Settings::getInstance().getDbSyncType()); |
||||
bodyUI->syncTypeComboBox->setCurrentIndex(index); |
||||
|
||||
connect(bodyUI->syncTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDbSyncTypeUpdated())); |
||||
connect(bodyUI->resetButton, SIGNAL(clicked()), this, SLOT(resetToDefault())); |
||||
} |
||||
|
||||
AdvancedForm::~AdvancedForm() |
||||
{ |
||||
delete bodyUI; |
||||
} |
||||
|
||||
void AdvancedForm::onDbSyncTypeUpdated() |
||||
{ |
||||
int index = 2 - bodyUI->syncTypeComboBox->currentIndex(); |
||||
Settings::getInstance().setDbSyncType(index); |
||||
HistoryKeeper::getInstance()->setSyncType(Settings::getInstance().getDbSyncType()); |
||||
} |
||||
|
||||
void AdvancedForm::resetToDefault() |
||||
{ |
||||
int index = 2 - static_cast<int>(Db::syncType::stFull); |
||||
bodyUI->syncTypeComboBox->setCurrentIndex(index); |
||||
onDbSyncTypeUpdated(); |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox. |
||||
|
||||
This program is libre software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
|
||||
See the COPYING file for more details. |
||||
*/ |
||||
|
||||
#ifndef ADVANCEDFORM_H |
||||
#define ADVANCEDFORM_H |
||||
|
||||
#include "genericsettings.h" |
||||
|
||||
class Core; |
||||
|
||||
namespace Ui { |
||||
class AdvancedSettings; |
||||
} |
||||
|
||||
class AdvancedForm : public GenericForm |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
AdvancedForm(); |
||||
virtual ~AdvancedForm(); |
||||
|
||||
private slots: |
||||
void onDbSyncTypeUpdated(); |
||||
void resetToDefault(); |
||||
|
||||
private: |
||||
Ui::AdvancedSettings* bodyUI; |
||||
}; |
||||
|
||||
#endif // ADVANCEDFORM_H
|
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>AdvancedSettings</class> |
||||
<widget class="QWidget" name="AdvancedSettings"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>400</width> |
||||
<height>300</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Form</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
<item> |
||||
<widget class="QScrollArea" name="scrollArea"> |
||||
<property name="widgetResizable"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<widget class="QWidget" name="scrollAreaWidgetContents"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>380</width> |
||||
<height>280</height> |
||||
</rect> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout_2"> |
||||
<item> |
||||
<widget class="QLabel" name="warningLabel"> |
||||
<property name="text"> |
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#ff0000;">IMPORTANT NOTE</span></p><p><span style=" color:#ff0000;">Unless you </span><span style=" font-weight:600; color:#ff0000;">really</span><span style=" color:#ff0000;"> know what you are doing, please do </span><span style=" font-weight:600; color:#ff0000;">not</span><span style=" color:#ff0000;"> change anything here. Changes made here may lead to problems with qTox, and even to loss of your data, e.g. history.</span></p></body></html></string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::RichText</enum> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignCenter</set> |
||||
</property> |
||||
<property name="wordWrap"> |
||||
<bool>true</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item alignment="Qt::AlignTop"> |
||||
<widget class="QPushButton" name="resetButton"> |
||||
<property name="text"> |
||||
<string>Reset to default settings</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item alignment="Qt::AlignTop"> |
||||
<widget class="QGroupBox" name="historyGroup"> |
||||
<property name="title"> |
||||
<string>History</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout_3"> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="dbLabel"> |
||||
<property name="text"> |
||||
<string><html><head/><body><p><a href="http://www.sqlite.org/pragma.html#pragma_synchronous"><span style=" text-decoration: underline; color:#0000ff;">Synchronous writing to DB</span></a></p></body></html></string> |
||||
</property> |
||||
<property name="textFormat"> |
||||
<enum>Qt::RichText</enum> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QComboBox" name="syncTypeComboBox"> |
||||
<property name="sizePolicy"> |
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
||||
<horstretch>0</horstretch> |
||||
<verstretch>0</verstretch> |
||||
</sizepolicy> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<spacer name="verticalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Vertical</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>20</width> |
||||
<height>40</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<resources/> |
||||
<connections/> |
||||
</ui> |
Loading…
Reference in new issue