mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: re-format and cleanup
This commit is contained in:
parent
0ea409054a
commit
c6a197feca
|
@ -258,8 +258,6 @@ set(${PROJECT_NAME}_SOURCES
|
|||
src/core/dhtserver.cpp
|
||||
src/core/dhtserver.h
|
||||
src/core/icoresettings.h
|
||||
src/core/recursivesignalblocker.cpp
|
||||
src/core/recursivesignalblocker.h
|
||||
src/core/toxcall.cpp
|
||||
src/core/toxcall.h
|
||||
src/core/toxencrypt.cpp
|
||||
|
@ -472,6 +470,8 @@ set(${PROJECT_NAME}_SOURCES
|
|||
src/widget/tool/movablewidget.h
|
||||
src/widget/tool/profileimporter.cpp
|
||||
src/widget/tool/profileimporter.h
|
||||
src/widget/tool/recursivesignalblocker.cpp
|
||||
src/widget/tool/recursivesignalblocker.h
|
||||
src/widget/tool/removefrienddialog.cpp
|
||||
src/widget/tool/removefrienddialog.h
|
||||
src/widget/tool/screengrabberchooserrectitem.cpp
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
~History();
|
||||
|
||||
bool isValid();
|
||||
void import(const HistoryKeeper& oldHistory);
|
||||
|
||||
bool isHistoryExistence(const QString& friendPk);
|
||||
|
||||
|
@ -82,10 +81,11 @@ public:
|
|||
const std::function<void(int64_t)>& insertIdCallback = {});
|
||||
|
||||
QList<HistMessage> getChatHistoryFromDate(const QString& friendPk, const QDateTime& from,
|
||||
const QDateTime& to);
|
||||
const QDateTime& to);
|
||||
QList<HistMessage> getChatHistoryDefaultNum(const QString& friendPk);
|
||||
QList<DateMessages> getChatHistoryCounts(const ToxPk& friendPk, const QDate& from, const QDate& to);
|
||||
QDateTime getDateWhereFindPhrase(const QString& friendPk, const QDateTime& from, QString phrase, const ParameterSearch ¶meter);
|
||||
QDateTime getDateWhereFindPhrase(const QString& friendPk, const QDateTime& from, QString phrase,
|
||||
const ParameterSearch& parameter);
|
||||
QDateTime getStartDateChatHistory(const QString& friendPk);
|
||||
|
||||
void markAsSent(qint64 messageId);
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include <QTimer>
|
||||
#include <tox/tox.h>
|
||||
|
||||
#include "src/core/recursivesignalblocker.h"
|
||||
#include "src/net/autoupdate.h"
|
||||
#include "src/widget/tool/recursivesignalblocker.h"
|
||||
#include "src/widget/translator.h"
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ void AboutForm::replaceVersions()
|
|||
"More information on how to write good bug reports in the wiki: "
|
||||
"https://github.com/qTox/qTox/wiki/Writing-Useful-Bug-Reports.\n\n"
|
||||
"Please remove any unnecessary template section before submitting.")
|
||||
.arg(QSysInfo::prettyProductName(), GIT_DESCRIBE, GIT_VERSION,
|
||||
.arg(QSysInfo::prettyProductName(), GIT_DESCRIBE, GIT_VERSION,
|
||||
TOXCORE_VERSION, QT_VERSION_STR);
|
||||
|
||||
issueBody.replace("#", "%23").replace(":", "%3A");
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
|
||||
#include "src/core/core.h"
|
||||
#include "src/core/coreav.h"
|
||||
#include "src/core/recursivesignalblocker.h"
|
||||
#include "src/nexus.h"
|
||||
#include "src/persistence/profile.h"
|
||||
#include "src/persistence/settings.h"
|
||||
#include "src/widget/gui.h"
|
||||
#include "src/widget/tool/recursivesignalblocker.h"
|
||||
#include "src/widget/translator.h"
|
||||
|
||||
/**
|
||||
|
@ -157,9 +157,8 @@ void AdvancedForm::on_btnCopyDebug_clicked()
|
|||
void AdvancedForm::on_resetButton_clicked()
|
||||
{
|
||||
const QString titile = tr("Reset settings");
|
||||
bool result =
|
||||
GUI::askQuestion(titile, tr("All settings will be reset to default. Are you sure?"),
|
||||
tr("Yes"), tr("No"));
|
||||
bool result = GUI::askQuestion(titile, tr("All settings will be reset to default. Are you sure?"),
|
||||
tr("Yes"), tr("No"));
|
||||
|
||||
if (!result)
|
||||
return;
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
#include "src/audio/iaudiosettings.h"
|
||||
#include "src/core/core.h"
|
||||
#include "src/core/coreav.h"
|
||||
#include "src/core/recursivesignalblocker.h"
|
||||
#include "src/video/cameradevice.h"
|
||||
#include "src/video/camerasource.h"
|
||||
#include "src/video/ivideosettings.h"
|
||||
#include "src/video/videosurface.h"
|
||||
#include "src/widget/tool/recursivesignalblocker.h"
|
||||
#include "src/widget/tool/screenshotgrabber.h"
|
||||
#include "src/widget/translator.h"
|
||||
|
||||
|
@ -43,8 +43,8 @@
|
|||
#define ALC_ALL_DEVICES_SPECIFIER ALC_DEVICE_SPECIFIER
|
||||
#endif
|
||||
|
||||
AVForm::AVForm(Audio* audio, CoreAV* coreAV, CameraSource& camera,
|
||||
IAudioSettings* audioSettings, IVideoSettings* videoSettings)
|
||||
AVForm::AVForm(Audio* audio, CoreAV* coreAV, CameraSource& camera, IAudioSettings* audioSettings,
|
||||
IVideoSettings* videoSettings)
|
||||
: GenericForm(QPixmap(":/img/settings/av.png"))
|
||||
, audio{audio}
|
||||
, coreAV{coreAV}
|
||||
|
@ -72,7 +72,8 @@ AVForm::AVForm(Audio* audio, CoreAV* coreAV, CameraSource& camera,
|
|||
playbackSlider->setTracking(false);
|
||||
playbackSlider->setMaximum(totalSliderSteps);
|
||||
playbackSlider->setValue(getStepsFromValue(audioSettings->getOutVolume(),
|
||||
audioSettings->getOutVolumeMin(), audioSettings->getOutVolumeMax()));
|
||||
audioSettings->getOutVolumeMin(),
|
||||
audioSettings->getOutVolumeMax()));
|
||||
playbackSlider->installEventFilter(this);
|
||||
|
||||
microphoneSlider->setToolTip(tr("Use slider to set the gain of your input device ranging"
|
||||
|
@ -85,13 +86,15 @@ AVForm::AVForm(Audio* audio, CoreAV* coreAV, CameraSource& camera,
|
|||
microphoneSlider->setTickInterval(totalSliderSteps / numTicks);
|
||||
microphoneSlider->setTracking(false);
|
||||
microphoneSlider->installEventFilter(this);
|
||||
microphoneSlider->setValue(getStepsFromValue(audio->inputGain(), audio->minInputGain(), audio->maxInputGain()));
|
||||
microphoneSlider->setValue(
|
||||
getStepsFromValue(audio->inputGain(), audio->minInputGain(), audio->maxInputGain()));
|
||||
|
||||
audioThresholdSlider->setToolTip(tr("Use slider to set the activation volume for your"
|
||||
" input device."));
|
||||
" input device."));
|
||||
audioThresholdSlider->setMaximum(totalSliderSteps);
|
||||
audioThresholdSlider->setValue(getStepsFromValue(audioSettings->getAudioThreshold(),
|
||||
audio->minInputThreshold(), audio->maxInputThreshold()));
|
||||
audio->minInputThreshold(),
|
||||
audio->maxInputThreshold()));
|
||||
audioThresholdSlider->setTracking(false);
|
||||
audioThresholdSlider->installEventFilter(this);
|
||||
|
||||
|
@ -167,7 +170,8 @@ void AVForm::rescanDevices()
|
|||
|
||||
void AVForm::setVolume(float value)
|
||||
{
|
||||
volumeDisplay->setValue(getStepsFromValue(value, audio->minOutputVolume(), audio->maxOutputVolume()));
|
||||
volumeDisplay->setValue(
|
||||
getStepsFromValue(value, audio->minOutputVolume(), audio->maxOutputVolume()));
|
||||
}
|
||||
|
||||
void AVForm::on_cbEnableBackend2_stateChanged()
|
||||
|
@ -335,7 +339,7 @@ int AVForm::searchPreferredIndex()
|
|||
for (int i = 0; i < videoModes.size(); ++i) {
|
||||
VideoMode mode = videoModes[i];
|
||||
if (mode.width == prefRes.width() && mode.height == prefRes.height()
|
||||
&& (qAbs(mode.FPS - prefFPS) < 0.0001f)) {
|
||||
&& (qAbs(mode.FPS - prefFPS) < 0.0001f)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -544,7 +548,6 @@ void AVForm::on_inDevCombobox_currentIndexChanged(int deviceIndex)
|
|||
if (!inputEnabled) {
|
||||
volumeDisplay->setValue(volumeDisplay->minimum());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AVForm::on_outDevCombobox_currentIndexChanged(int deviceIndex)
|
||||
|
@ -561,18 +564,19 @@ void AVForm::on_outDevCombobox_currentIndexChanged(int deviceIndex)
|
|||
|
||||
audio->reinitOutput(deviceName);
|
||||
playbackSlider->setEnabled(outputEnabled);
|
||||
playbackSlider->setSliderPosition(getStepsFromValue(audio->outputVolume(),
|
||||
audio->minOutputVolume(), audio->maxOutputVolume()));
|
||||
playbackSlider->setSliderPosition(
|
||||
getStepsFromValue(audio->outputVolume(), audio->minOutputVolume(), audio->maxOutputVolume()));
|
||||
}
|
||||
|
||||
void AVForm::on_playbackSlider_valueChanged(int sliderSteps)
|
||||
{
|
||||
const int settingsVolume = getValueFromSteps(sliderSteps,
|
||||
audioSettings->getOutVolumeMin(),audioSettings->getOutVolumeMax());
|
||||
const int settingsVolume = getValueFromSteps(sliderSteps, audioSettings->getOutVolumeMin(),
|
||||
audioSettings->getOutVolumeMax());
|
||||
audioSettings->setOutVolume(settingsVolume);
|
||||
|
||||
if (audio->isOutputReady()) {
|
||||
const qreal volume = getValueFromSteps(sliderSteps, audio->minOutputVolume(), audio->maxOutputVolume());
|
||||
const qreal volume =
|
||||
getValueFromSteps(sliderSteps, audio->minOutputVolume(), audio->maxOutputVolume());
|
||||
audio->setOutputVolume(volume);
|
||||
|
||||
if (cbEnableTestSound->isChecked())
|
||||
|
@ -597,7 +601,8 @@ void AVForm::on_microphoneSlider_valueChanged(int sliderSteps)
|
|||
|
||||
void AVForm::on_audioThresholdSlider_valueChanged(int sliderSteps)
|
||||
{
|
||||
const qreal normThreshold = getValueFromSteps(sliderSteps, audio->minInputThreshold(), audio->maxInputThreshold());
|
||||
const qreal normThreshold =
|
||||
getValueFromSteps(sliderSteps, audio->minInputThreshold(), audio->maxInputThreshold());
|
||||
audioSettings->setAudioThreshold(normThreshold);
|
||||
Audio::getInstance().setInputThreshold(normThreshold);
|
||||
}
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
|
||||
#include "src/core/core.h"
|
||||
#include "src/core/coreav.h"
|
||||
#include "src/core/recursivesignalblocker.h"
|
||||
#include "src/net/autoupdate.h"
|
||||
#include "src/persistence/profile.h"
|
||||
#include "src/persistence/settings.h"
|
||||
#include "src/persistence/smileypack.h"
|
||||
#include "src/widget/form/settingswidget.h"
|
||||
#include "src/widget/style.h"
|
||||
#include "src/widget/tool/recursivesignalblocker.h"
|
||||
#include "src/widget/translator.h"
|
||||
#include "src/widget/widget.h"
|
||||
|
||||
|
@ -153,7 +153,8 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
|
|||
|
||||
|
||||
#ifndef QTOX_PLATFORM_EXT
|
||||
bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
|
||||
bodyUI->autoAwayLabel->setEnabled(
|
||||
false); // these don't seem to change the appearance of the widgets,
|
||||
bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <QMessageBox>
|
||||
|
||||
#include "src/core/core.h"
|
||||
#include "src/core/recursivesignalblocker.h"
|
||||
#include "src/nexus.h"
|
||||
#include "src/persistence/history.h"
|
||||
#include "src/persistence/profile.h"
|
||||
|
@ -33,6 +32,7 @@
|
|||
#include "src/widget/form/setpassworddialog.h"
|
||||
#include "src/widget/form/settingswidget.h"
|
||||
#include "src/widget/gui.h"
|
||||
#include "src/widget/tool/recursivesignalblocker.h"
|
||||
#include "src/widget/translator.h"
|
||||
#include "src/widget/widget.h"
|
||||
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
|
||||
#include "src/core/core.h"
|
||||
#include "src/core/coreav.h"
|
||||
#include "src/core/recursivesignalblocker.h"
|
||||
#include "src/net/autoupdate.h"
|
||||
#include "src/persistence/profile.h"
|
||||
#include "src/persistence/settings.h"
|
||||
#include "src/persistence/smileypack.h"
|
||||
#include "src/widget/form/settingswidget.h"
|
||||
#include "src/widget/style.h"
|
||||
#include "src/widget/tool/recursivesignalblocker.h"
|
||||
#include "src/widget/translator.h"
|
||||
#include "src/widget/widget.h"
|
||||
|
||||
|
@ -142,7 +142,7 @@ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent)
|
|||
|
||||
QStringList dateFormats;
|
||||
dateFormats << QStringLiteral("yyyy-MM-dd") // ISO 8601
|
||||
// format strings from system locale
|
||||
// format strings from system locale
|
||||
<< ql.dateFormat(QLocale::LongFormat) << ql.dateFormat(QLocale::ShortFormat)
|
||||
<< ql.dateFormat(QLocale::NarrowFormat) << "dd-MM-yyyy"
|
||||
<< "d-MM-yyyy"
|
||||
|
|
Loading…
Reference in New Issue
Block a user