Browse Source

docs(settingsform): Added docs to settings forms

reviewable/pr3457/r14
Diadlo 9 years ago
parent
commit
b6f14a658f
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 28
      src/widget/form/settings/aboutform.cpp
  2. 10
      src/widget/form/settings/advancedform.cpp
  3. 8
      src/widget/form/settings/generalform.cpp
  4. 26
      src/widget/form/settings/genericsettings.cpp
  5. 8
      src/widget/form/settings/userinterfaceform.cpp

28
src/widget/form/settings/aboutform.cpp

@ -28,6 +28,16 @@
#include "src/net/autoupdate.h" #include "src/net/autoupdate.h"
#include "src/widget/translator.h" #include "src/widget/translator.h"
/**
* @class AboutForm
*
* This form contains information about qTox and libraries versions, external
* links and licence text. Shows progress during an update.
*/
/**
* @brief Constructor of AboutForm.
*/
AboutForm::AboutForm() AboutForm::AboutForm()
: GenericForm(QPixmap(":/img/settings/general.png")) : GenericForm(QPixmap(":/img/settings/general.png"))
, bodyUI(new Ui::AboutSettings) , bodyUI(new Ui::AboutSettings)
@ -52,6 +62,12 @@ AboutForm::AboutForm()
Translator::registerHandler(std::bind(&AboutForm::retranslateUi, this), this); Translator::registerHandler(std::bind(&AboutForm::retranslateUi, this), this);
} }
/**
* @brief Update versions and links.
*
* Update commit hash if built with git, show author and known issues info
* It also updates qTox, toxcore and Qt versions.
*/
void AboutForm::replaceVersions() void AboutForm::replaceVersions()
{ {
// TODO: When we finally have stable releases: build-in a way to tell // TODO: When we finally have stable releases: build-in a way to tell
@ -115,6 +131,12 @@ void AboutForm::replaceVersions()
bodyUI->authorInfo->setText(authorInfo); bodyUI->authorInfo->setText(authorInfo);
} }
/**
* @brief Creates hyperlink with specific style.
* @param path The URL of the page the link goes to.
* @param text Text, which will be clickable.
* @return Hyperlink to paste.
*/
QString AboutForm::createLink(QString path, QString text) const QString AboutForm::createLink(QString path, QString text) const
{ {
return QString::fromUtf8("<a href=\"%1\" style=\"text-decoration: underline; color:#0000ff;\">%2</a>") return QString::fromUtf8("<a href=\"%1\" style=\"text-decoration: underline; color:#0000ff;\">%2</a>")
@ -127,6 +149,9 @@ AboutForm::~AboutForm()
delete bodyUI; delete bodyUI;
} }
/**
* @brief Update information about update.
*/
void AboutForm::showUpdateProgress() void AboutForm::showUpdateProgress()
{ {
QString version = AutoUpdater::getProgressVersion(); QString version = AutoUpdater::getProgressVersion();
@ -160,6 +185,9 @@ void AboutForm::showEvent(QShowEvent *)
progressTimer->start(); progressTimer->start();
} }
/**
* @brief Retranslate all elements in the form.
*/
void AboutForm::retranslateUi() void AboutForm::retranslateUi()
{ {
bodyUI->retranslateUi(this); bodyUI->retranslateUi(this);

10
src/widget/form/settings/advancedform.cpp

@ -35,6 +35,13 @@
#include "src/widget/gui.h" #include "src/widget/gui.h"
#include "src/widget/translator.h" #include "src/widget/translator.h"
/**
* @class AdvancedForm
*
* This form contains all connection settings.
* Is also contains "Reset settings" button and "Make portable" checkbox.
*/
AdvancedForm::AdvancedForm() AdvancedForm::AdvancedForm()
: GenericForm(QPixmap(":/img/settings/general.png")) : GenericForm(QPixmap(":/img/settings/general.png"))
, bodyUI (new Ui::AdvancedSettings) , bodyUI (new Ui::AdvancedSettings)
@ -144,6 +151,9 @@ void AdvancedForm::on_reconnectButton_clicked()
Nexus::getProfile()->restartCore(); Nexus::getProfile()->restartCore();
} }
/**
* @brief Retranslate all elements in the form.
*/
void AdvancedForm::retranslateUi() void AdvancedForm::retranslateUi()
{ {
int proxyType = bodyUI->proxyType->currentIndex(); int proxyType = bodyUI->proxyType->currentIndex();

8
src/widget/form/settings/generalform.cpp

@ -98,6 +98,11 @@ static QStringList langs = {"Arabic",
"Українська", "Українська",
"简体中文"}; "简体中文"};
/**
* @class GeneralForm
*
* This form contains all settings that are not suited to other forms
*/
GeneralForm::GeneralForm(SettingsWidget *myParent) GeneralForm::GeneralForm(SettingsWidget *myParent)
: GenericForm(QPixmap(":/img/settings/general.png")) : GenericForm(QPixmap(":/img/settings/general.png"))
, bodyUI(new Ui::GeneralSettings) , bodyUI(new Ui::GeneralSettings)
@ -248,6 +253,9 @@ void GeneralForm::on_checkUpdates_stateChanged()
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked()); Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
} }
/**
* @brief Retranslate all elements in the form.
*/
void GeneralForm::retranslateUi() void GeneralForm::retranslateUi()
{ {
bodyUI->retranslateUi(this); bodyUI->retranslateUi(this);

26
src/widget/form/settings/genericsettings.cpp

@ -5,6 +5,13 @@
#include <QEvent> #include <QEvent>
#include <QSpinBox> #include <QSpinBox>
/**
* @class GenericForm
*
* This is abstract class used as superclass for all settings forms.
* It provides correct behaviour of controls for settings forms.
*/
GenericForm::GenericForm(const QPixmap &icon) GenericForm::GenericForm(const QPixmap &icon)
: formIcon(icon) : formIcon(icon)
{ {
@ -15,12 +22,16 @@ QPixmap GenericForm::getFormIcon()
return formIcon; return formIcon;
} }
/**
* @brief Prevent stealing mouse wheel scroll.
*
* Scrolling event won't be transmitted to comboboxes or spinboxes.
* You can scroll through general settings without accidentially changing
* theme / skin / icons etc.
* @see GenericForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
*/
void GenericForm::eventsInit() void GenericForm::eventsInit()
{ {
// prevent stealing mouse wheel scroll
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
// you can scroll through general settings without accidentially changing theme/skin/icons etc.
// @see GenericForm::eventFilter(QObject *o, QEvent *e) at the bottom of this file for more
for (QComboBox *cb : findChildren<QComboBox*>()) for (QComboBox *cb : findChildren<QComboBox*>())
{ {
cb->installEventFilter(this); cb->installEventFilter(this);
@ -37,6 +48,12 @@ void GenericForm::eventsInit()
cb->installEventFilter(this); cb->installEventFilter(this);
} }
/**
* @brief Ignore scroll on different controls.
* @param o Object which has been installed for the watched object.
* @param e Event object.
* @return True to stop it being handled further, false otherwise.
*/
bool GenericForm::eventFilter(QObject *o, QEvent *e) bool GenericForm::eventFilter(QObject *o, QEvent *e)
{ {
if ((e->type() == QEvent::Wheel) && if ((e->type() == QEvent::Wheel) &&
@ -47,5 +64,6 @@ bool GenericForm::eventFilter(QObject *o, QEvent *e)
e->ignore(); e->ignore();
return true; return true;
} }
return QWidget::eventFilter(o, e); return QWidget::eventFilter(o, e);
} }

8
src/widget/form/settings/userinterfaceform.cpp

@ -1,5 +1,5 @@
/* /*
Copyright © 2014-2015 by The qTox Project Copyright © 2014-2016 by The qTox Project
This file is part of qTox, a Qt-based graphical interface for Tox. This file is part of qTox, a Qt-based graphical interface for Tox.
@ -56,10 +56,10 @@ static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"}; static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
/** /**
* @brief UserInterfaceForm::UserInterfaceForm * @brief Constructor of UserInterfaceForm.
* @param myParent Setting widget which will contain this form as tab. * @param myParent Setting widget which will contain this form as tab.
* *
* Constructor of UserInterfaceForm. Restores all controls from the settings. * Restores all controls from the settings.
*/ */
UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) : UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) :
GenericForm(QPixmap(":/img/settings/general.png")) GenericForm(QPixmap(":/img/settings/general.png"))
@ -288,7 +288,7 @@ void UserInterfaceForm::on_themeColorCBox_currentIndexChanged(int)
} }
/** /**
* @brief Retranslate all elements on the form. * @brief Retranslate all elements in the form.
*/ */
void UserInterfaceForm::retranslateUi() void UserInterfaceForm::retranslateUi()
{ {

Loading…
Cancel
Save