mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
AdvancedSettings tab introduced
This commit is contained in:
parent
e782a9d587
commit
08f523b8ff
9
qtox.pro
9
qtox.pro
|
@ -33,7 +33,8 @@ FORMS += \
|
|||
src/widget/form/settings/privacysettings.ui \
|
||||
src/widget/form/loadhistorydialog.ui \
|
||||
src/widget/form/inputpassworddialog.ui \
|
||||
src/widget/form/setpassworddialog.ui
|
||||
src/widget/form/setpassworddialog.ui \
|
||||
src/widget/form/settings/advancedsettings.ui
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
|
@ -150,7 +151,8 @@ HEADERS += src/widget/form/addfriendform.h \
|
|||
src/toxdns.h \
|
||||
src/widget/toxsave.h \
|
||||
src/autoupdate.h \
|
||||
src/misc/serialize.h
|
||||
src/misc/serialize.h \
|
||||
src/widget/form/settings/advancedform.h
|
||||
|
||||
SOURCES += \
|
||||
src/widget/form/addfriendform.cpp \
|
||||
|
@ -215,4 +217,5 @@ SOURCES += \
|
|||
src/ipc.cpp \
|
||||
src/widget/toxsave.cpp \
|
||||
src/autoupdate.cpp \
|
||||
src/misc/serialize.cpp
|
||||
src/misc/serialize.cpp \
|
||||
src/widget/form/settings/advancedform.cpp
|
||||
|
|
62
src/widget/form/settings/advancedform.cpp
Normal file
62
src/widget/form/settings/advancedform.cpp
Normal file
|
@ -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();
|
||||
}
|
43
src/widget/form/settings/advancedform.h
Normal file
43
src/widget/form/settings/advancedform.h
Normal file
|
@ -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
|
109
src/widget/form/settings/advancedsettings.ui
Normal file
109
src/widget/form/settings/advancedsettings.ui
Normal file
|
@ -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>
|
|
@ -22,6 +22,7 @@
|
|||
#include "src/widget/form/settings/identityform.h"
|
||||
#include "src/widget/form/settings/privacyform.h"
|
||||
#include "src/widget/form/settings/avform.h"
|
||||
#include "src/widget/form/settings/advancedform.h"
|
||||
#include <QTabWidget>
|
||||
|
||||
SettingsWidget::SettingsWidget(QWidget* parent)
|
||||
|
@ -54,8 +55,9 @@ SettingsWidget::SettingsWidget(QWidget* parent)
|
|||
IdentityForm* ifrm = new IdentityForm;
|
||||
PrivacyForm* pfrm = new PrivacyForm;
|
||||
AVForm* avfrm = new AVForm;
|
||||
AdvancedForm *expfrm = new AdvancedForm;
|
||||
|
||||
GenericForm* cfgForms[] = { gfrm, ifrm, pfrm, avfrm };
|
||||
GenericForm* cfgForms[] = { gfrm, ifrm, pfrm, avfrm, expfrm };
|
||||
for (GenericForm* cfgForm : cfgForms)
|
||||
settingsWidgets->addTab(cfgForm, cfgForm->getFormIcon(), cfgForm->getFormName());
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user