1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr447'

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-10-16 20:57:36 +02:00
commit 2a401a7e3b
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
5 changed files with 55 additions and 1 deletions

View File

@ -52,6 +52,8 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
else else
bodyUI->styleBrowser->setCurrentText("None"); bodyUI->styleBrowser->setCurrentText("None");
bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime());
bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP()); bodyUI->cbUDPDisabled->setChecked(Settings::getInstance().getForceTCP());
bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr()); bodyUI->proxyAddr->setText(Settings::getInstance().getProxyAddr());
int port = Settings::getInstance().getProxyPort(); int port = Settings::getInstance().getProxyPort();
@ -73,6 +75,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int))); connect(bodyUI->proxyPort, SIGNAL(valueChanged(int)), this, SLOT(onProxyPortEdited(int)));
connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated); connect(bodyUI->cbUseProxy, &QCheckBox::stateChanged, this, &GeneralForm::onUseProxyUpdated);
connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString))); connect(bodyUI->styleBrowser, SIGNAL(currentTextChanged(QString)), this, SLOT(onStyleSelected(QString)));
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
} }
GeneralForm::~GeneralForm() GeneralForm::~GeneralForm()
@ -107,6 +110,13 @@ void GeneralForm::onStyleSelected(QString style)
parent->setBodyHeadStyle(style); parent->setBodyHeadStyle(style);
} }
void GeneralForm::onAutoAwayChanged()
{
int minutes = bodyUI->autoAwaySpinBox->value();
Settings::getInstance().setAutoAwayTime(minutes);
Widget::getInstance()->setIdleTimer(minutes);
}
void GeneralForm::onSetStatusChange() void GeneralForm::onSetStatusChange()
{ {
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked()); Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked());

View File

@ -42,6 +42,8 @@ private slots:
void onUseProxyUpdated(); void onUseProxyUpdated();
void onStyleSelected(QString style); void onStyleSelected(QString style);
void onSetStatusChange(); void onSetStatusChange();
void onAutoAwayChanged();
private: private:
Ui::GeneralSettings *bodyUI; Ui::GeneralSettings *bodyUI;

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>527</width> <width>527</width>
<height>397</height> <height>500</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -60,6 +60,42 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item alignment="Qt::AlignLeft">
<widget class="QLabel" name="autoAwayLabel">
<property name="toolTip">
<string>Provided in minutes</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Auto away after:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="autoAwaySpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> minutes</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>600</number>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -294,6 +294,11 @@ QString Widget::askProfiles()
return profile; return profile;
} }
void Widget::setIdleTimer(int minutes)
{
idleTimer->start(minutes * 1000*60);
}
QString Widget::getUsername() QString Widget::getUsername()
{ {
return core->getUsername(); return core->getUsername();

View File

@ -59,6 +59,7 @@ public:
bool getIsWindowMinimized(); bool getIsWindowMinimized();
static QList<QString> searchProfiles(); static QList<QString> searchProfiles();
void clearContactsList(); void clearContactsList();
void setIdleTimer(int minutes);
~Widget(); ~Widget();
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);