mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
docs(settingsform): Added docs to settings forms
This commit is contained in:
parent
db758e29c5
commit
b6f14a658f
|
@ -28,6 +28,16 @@
|
|||
#include "src/net/autoupdate.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()
|
||||
: GenericForm(QPixmap(":/img/settings/general.png"))
|
||||
, bodyUI(new Ui::AboutSettings)
|
||||
|
@ -52,6 +62,12 @@ AboutForm::AboutForm()
|
|||
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()
|
||||
{
|
||||
// TODO: When we finally have stable releases: build-in a way to tell
|
||||
|
@ -115,6 +131,12 @@ void AboutForm::replaceVersions()
|
|||
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
|
||||
{
|
||||
return QString::fromUtf8("<a href=\"%1\" style=\"text-decoration: underline; color:#0000ff;\">%2</a>")
|
||||
|
@ -127,6 +149,9 @@ AboutForm::~AboutForm()
|
|||
delete bodyUI;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update information about update.
|
||||
*/
|
||||
void AboutForm::showUpdateProgress()
|
||||
{
|
||||
QString version = AutoUpdater::getProgressVersion();
|
||||
|
@ -160,6 +185,9 @@ void AboutForm::showEvent(QShowEvent *)
|
|||
progressTimer->start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retranslate all elements in the form.
|
||||
*/
|
||||
void AboutForm::retranslateUi()
|
||||
{
|
||||
bodyUI->retranslateUi(this);
|
||||
|
|
|
@ -35,6 +35,13 @@
|
|||
#include "src/widget/gui.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()
|
||||
: GenericForm(QPixmap(":/img/settings/general.png"))
|
||||
, bodyUI (new Ui::AdvancedSettings)
|
||||
|
@ -144,6 +151,9 @@ void AdvancedForm::on_reconnectButton_clicked()
|
|||
Nexus::getProfile()->restartCore();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retranslate all elements in the form.
|
||||
*/
|
||||
void AdvancedForm::retranslateUi()
|
||||
{
|
||||
int proxyType = bodyUI->proxyType->currentIndex();
|
||||
|
|
|
@ -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)
|
||||
: GenericForm(QPixmap(":/img/settings/general.png"))
|
||||
, bodyUI(new Ui::GeneralSettings)
|
||||
|
@ -248,6 +253,9 @@ void GeneralForm::on_checkUpdates_stateChanged()
|
|||
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retranslate all elements in the form.
|
||||
*/
|
||||
void GeneralForm::retranslateUi()
|
||||
{
|
||||
bodyUI->retranslateUi(this);
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
#include <QEvent>
|
||||
#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)
|
||||
: formIcon(icon)
|
||||
{
|
||||
|
@ -15,12 +22,16 @@ QPixmap GenericForm::getFormIcon()
|
|||
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()
|
||||
{
|
||||
// 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*>())
|
||||
{
|
||||
cb->installEventFilter(this);
|
||||
|
@ -37,6 +48,12 @@ void GenericForm::eventsInit()
|
|||
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)
|
||||
{
|
||||
if ((e->type() == QEvent::Wheel) &&
|
||||
|
@ -47,5 +64,6 @@ bool GenericForm::eventFilter(QObject *o, QEvent *e)
|
|||
e->ignore();
|
||||
return true;
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(o, e);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
@ -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"};
|
||||
|
||||
/**
|
||||
* @brief UserInterfaceForm::UserInterfaceForm
|
||||
* @brief Constructor of UserInterfaceForm.
|
||||
* @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) :
|
||||
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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user