qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Go to the documentation of this file.
21 #include "ui_advancedsettings.h"
23 #include <QApplication>
26 #include <QFileDialog>
27 #include <QMessageBox>
45 :
GenericForm(QPixmap(
":/img/settings/general.png"))
46 , bodyUI(new
Ui::AdvancedSettings)
59 bodyUI->proxyPort->setValue(port);
63 bodyUI->proxyType->setCurrentIndex(index);
66 bodyUI->cbEnableUDP->setChecked(udpEnabled);
68 bodyUI->cbEnableLanDiscovery->setEnabled(udpEnabled);
70 QString warningBody = tr(
"Unless you %1 know what you are doing, "
71 "please do %2 change anything here. Changes "
72 "made here may lead to problems with qTox, and even "
73 "to loss of your data, e.g. history."
75 .arg(QString(
"<b>%1</b>").arg(tr(
"really")))
76 .arg(QString(
"<b>%1</b>").arg(tr(
"not")))
77 .arg(QString(
"<p>%1</p>").arg(tr(
"Changes here are applied only after restarting qTox.")));
79 QString warning = QString(
"<div style=\"color:#ff0000;\">"
80 "<p><b>%1</b></p><p>%2</p></div>")
81 .arg(tr(
"IMPORTANT NOTE"))
84 bodyUI->warningLabel->setText(warning);
103 QFileDialog::getSaveFileName(Q_NULLPTR, tr(
"Save file"), QString{}, tr(
"Logs (*.log)"));
105 if (savefile.isNull() || savefile.isEmpty()) {
106 qDebug() <<
"Debug log save file was not properly chosen";
111 QString logfile = logFileDir +
"qtox.log";
115 qDebug() <<
"Found debug log for copying";
117 qDebug() <<
"No debug file found";
121 if (QFile::copy(logfile, savefile))
122 qDebug() <<
"Successfully copied to: " << savefile;
124 qDebug() <<
"File was not copied";
130 QString logfile = logFileDir +
"qtox.log";
133 if (!
file.exists()) {
134 qDebug() <<
"No debug file found";
138 QClipboard* clipboard = QApplication::clipboard();
141 if (
file.open(QIODevice::ReadOnly | QIODevice::Text)) {
142 QTextStream in(&
file);
143 debugtext = in.readAll();
146 qDebug() <<
"Unable to open file for copying to clipboard";
150 clipboard->setText(debugtext, QClipboard::Clipboard);
151 qDebug() <<
"Debug log copied to clipboard";
153 qDebug() <<
"Unable to access clipboard";
159 const QString titile = tr(
"Reset settings");
160 bool result =
GUI::askQuestion(titile, tr(
"All settings will be reset to default. Are you sure?"),
161 tr(
"Yes"), tr(
"No"));
167 GUI::showInfo(titile,
"Changes will take effect after restart");
177 const bool enableUdp =
bodyUI->cbEnableUDP->isChecked();
180 bodyUI->cbEnableLanDiscovery->setEnabled(enableUdp);
181 bodyUI->cbEnableLanDiscovery->setChecked(enableUdp && enableLanDiscovery);
208 bodyUI->proxyAddr->setEnabled(proxyEnabled);
209 bodyUI->proxyPort->setEnabled(proxyEnabled);
211 bodyUI->cbEnableUDP->setEnabled(!proxyEnabled);
212 bodyUI->cbEnableUDP->setChecked(!proxyEnabled);
222 int proxyType =
bodyUI->proxyType->currentIndex();
223 bodyUI->retranslateUi(
this);
224 bodyUI->proxyType->setCurrentIndex(proxyType);
void setProxyType(ICoreSettings::ProxyType type) override
bool getEnableLanDiscovery() const override
void setProxyPort(quint16 port) override
bool getForceTCP() const override
static void unregister(void *owner)
Unregisters all handlers of an owner.
void setForceTCP(bool enabled) override
static bool askQuestion(const QString &title, const QString &msg, bool defaultAns=false, bool warning=true, bool yesno=true)
Asks the user a question with Ok/Cancel or Yes/No buttons.
void setEnableIPv6(bool enabled) override
void setProxyAddr(const QString &address) override
static void showInfo(const QString &title, const QString &msg)
Show some text to the user.
quint16 getProxyPort() const override
void setEnableLanDiscovery(bool enabled) override
static void registerHandler(const std::function< void()> &, void *owner)
Register a function to be called when the UI needs to be retranslated.
static Settings & getInstance()
Returns the singleton instance.
QString getProxyAddr() const override
QString getAppCacheDirPath() const
Get path to directory, where the application cache are stored.
bool getEnableIPv6() const override
Recursively blocks all signals from an object and its children.
ICoreSettings::ProxyType getProxyType() const override
void setMakeToxPortable(bool newValue)