2014-09-15 18:45:59 +08:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2014-10-06 00:17:01 +08:00
|
|
|
#include "ui_generalsettings.h"
|
2014-09-15 18:45:59 +08:00
|
|
|
#include "generalform.h"
|
|
|
|
#include "widget/form/settingswidget.h"
|
2014-09-30 17:44:27 +08:00
|
|
|
#include "widget/widget.h"
|
|
|
|
#include "misc/settings.h"
|
|
|
|
#include "misc/smileypack.h"
|
2014-09-15 18:45:59 +08:00
|
|
|
|
2014-10-06 00:17:01 +08:00
|
|
|
GeneralForm::GeneralForm() :
|
|
|
|
GenericForm(tr("General Settings"), QPixmap(":/img/settings/general.png"))
|
2014-09-15 18:45:59 +08:00
|
|
|
{
|
2014-10-06 00:17:01 +08:00
|
|
|
bodyUI = new Ui::GeneralSettings;
|
|
|
|
bodyUI->setupUi(this);
|
|
|
|
|
|
|
|
bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
|
|
|
|
bodyUI->cbUseTranslations->setChecked(Settings::getInstance().getUseTranslations());
|
|
|
|
bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable());
|
2014-09-30 17:44:27 +08:00
|
|
|
|
|
|
|
for (auto entry : SmileyPack::listSmileyPacks())
|
2014-10-06 00:17:01 +08:00
|
|
|
{
|
|
|
|
bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);
|
|
|
|
}
|
|
|
|
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
2014-09-30 17:44:27 +08:00
|
|
|
|
2014-10-06 00:17:01 +08:00
|
|
|
connect(bodyUI->cbEnableIPv6, SIGNAL(stateChanged(int)), this, SLOT(onEnableIPv6Updated()));
|
|
|
|
connect(bodyUI->cbUseTranslations, SIGNAL(stateChanged(int)), this, SLOT(onUseTranslationUpdated()));
|
|
|
|
connect(bodyUI->cbMakeToxPortable, SIGNAL(stateChanged(int)), this, SLOT(onMakeToxPortableUpdated()));
|
|
|
|
connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int)));
|
2014-09-15 18:45:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GeneralForm::~GeneralForm()
|
|
|
|
{
|
2014-10-06 00:17:01 +08:00
|
|
|
delete bodyUI;
|
2014-09-15 18:45:59 +08:00
|
|
|
}
|
2014-09-30 17:44:27 +08:00
|
|
|
|
|
|
|
void GeneralForm::onEnableIPv6Updated()
|
|
|
|
{
|
2014-10-06 00:17:01 +08:00
|
|
|
Settings::getInstance().setEnableIPv6(bodyUI->cbEnableIPv6->isChecked());
|
2014-09-30 17:44:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralForm::onUseTranslationUpdated()
|
|
|
|
{
|
2014-10-06 00:17:01 +08:00
|
|
|
Settings::getInstance().setUseTranslations(bodyUI->cbUseTranslations->isChecked());
|
2014-09-30 17:44:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralForm::onMakeToxPortableUpdated()
|
|
|
|
{
|
2014-10-06 00:17:01 +08:00
|
|
|
Settings::getInstance().setMakeToxPortable(bodyUI->cbMakeToxPortable->isChecked());
|
2014-09-30 17:44:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralForm::onSmileyBrowserIndexChanged(int index)
|
|
|
|
{
|
2014-10-06 00:17:01 +08:00
|
|
|
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();
|
2014-09-30 17:44:27 +08:00
|
|
|
Settings::getInstance().setSmileyPack(filename);
|
|
|
|
}
|