mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
@@ -50,6 +50,7 @@ add_library(qbt_gui STATIC
|
||||
fspathedit.h
|
||||
fspathedit_p.h
|
||||
hidabletabwidget.h
|
||||
interfaces/iguiapplication.h
|
||||
ipsubnetwhitelistoptionsdialog.h
|
||||
lineedit.h
|
||||
log/logfiltermodel.h
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#include "base/global.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "app/application.h"
|
||||
#include "gui/addnewtorrentdialog.h"
|
||||
#include "gui/mainwindow.h"
|
||||
#include "interfaces/iguiapplication.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -200,7 +200,7 @@ void AdvancedSettings::saveAdvancedSettings()
|
||||
}
|
||||
session->setOSMemoryPriority(prio);
|
||||
|
||||
static_cast<Application *>(QCoreApplication::instance())->setMemoryWorkingSetLimit(m_spinBoxMemoryWorkingSetLimit.value());
|
||||
dynamic_cast<IApplication *>(QCoreApplication::instance())->setMemoryWorkingSetLimit(m_spinBoxMemoryWorkingSetLimit.value());
|
||||
#endif
|
||||
// Async IO threads
|
||||
session->setAsyncIOThreads(m_spinBoxAsyncIOThreads.value());
|
||||
@@ -292,7 +292,7 @@ void AdvancedSettings::saveAdvancedSettings()
|
||||
// Stop tracker timeout
|
||||
session->setStopTrackerTimeout(m_spinBoxStopTrackerTimeout.value());
|
||||
// Program notification
|
||||
MainWindow *const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
|
||||
MainWindow *mainWindow = dynamic_cast<IGUIApplication *>(QCoreApplication::instance())->mainWindow();
|
||||
mainWindow->setNotificationsEnabled(m_checkBoxProgramNotifications.isChecked());
|
||||
mainWindow->setTorrentAddedNotificationsEnabled(m_checkBoxTorrentAddedNotifications.isChecked());
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
|
||||
@@ -449,7 +449,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
m_spinBoxMemoryWorkingSetLimit.setMinimum(1);
|
||||
m_spinBoxMemoryWorkingSetLimit.setMaximum(std::numeric_limits<int>::max());
|
||||
m_spinBoxMemoryWorkingSetLimit.setSuffix(tr(" MiB"));
|
||||
m_spinBoxMemoryWorkingSetLimit.setValue(static_cast<Application *>(QCoreApplication::instance())->memoryWorkingSetLimit());
|
||||
m_spinBoxMemoryWorkingSetLimit.setValue(dynamic_cast<IApplication *>(QCoreApplication::instance())->memoryWorkingSetLimit());
|
||||
|
||||
addRow(MEMORY_WORKING_SET_LIMIT, (tr("Physical memory (RAM) usage limit")
|
||||
+ u' ' + makeLink(u"https://wikipedia.org/wiki/Working_set", u"(?)"))
|
||||
@@ -694,7 +694,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
, &m_spinBoxStopTrackerTimeout);
|
||||
|
||||
// Program notifications
|
||||
const MainWindow *const mainWindow = static_cast<Application*>(QCoreApplication::instance())->mainWindow();
|
||||
const MainWindow *mainWindow = dynamic_cast<IGUIApplication *>(QCoreApplication::instance())->mainWindow();
|
||||
m_checkBoxProgramNotifications.setChecked(mainWindow->isNotificationsEnabled());
|
||||
addRow(PROGRAM_NOTIFICATIONS, tr("Display notifications"), &m_checkBoxProgramNotifications);
|
||||
// Torrent added notifications
|
||||
|
||||
@@ -17,6 +17,7 @@ HEADERS += \
|
||||
$$PWD/fspathedit.h \
|
||||
$$PWD/fspathedit_p.h \
|
||||
$$PWD/hidabletabwidget.h \
|
||||
$$PWD/interfaces/iguiapplication.h \
|
||||
$$PWD/ipsubnetwhitelistoptionsdialog.h \
|
||||
$$PWD/lineedit.h \
|
||||
$$PWD/log/logfiltermodel.h \
|
||||
|
||||
43
src/gui/interfaces/iguiapplication.h
Normal file
43
src/gui/interfaces/iguiapplication.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt and libtorrent.
|
||||
* Copyright (C) 2022 Mike Tzou (Chocobo1)
|
||||
* Copyright (C) 2015, 2019 Vladimir Golovnev <glassez@yandex.ru>
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
*
|
||||
* This program is free 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 2
|
||||
* 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
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "base/interfaces/iapplication.h"
|
||||
|
||||
class MainWindow;
|
||||
|
||||
class IGUIApplication : public IApplication
|
||||
{
|
||||
public:
|
||||
virtual ~IGUIApplication() = default;
|
||||
|
||||
virtual QPointer<MainWindow> mainWindow() = 0;
|
||||
};
|
||||
@@ -61,8 +61,8 @@
|
||||
#include "base/utils/random.h"
|
||||
#include "addnewtorrentdialog.h"
|
||||
#include "advancedsettings.h"
|
||||
#include "app/application.h"
|
||||
#include "banlistoptionsdialog.h"
|
||||
#include "interfaces/iguiapplication.h"
|
||||
#include "ipsubnetwhitelistoptionsdialog.h"
|
||||
#include "rss/automatedrssdownloader.h"
|
||||
#include "ui_optionsdialog.h"
|
||||
@@ -719,7 +719,7 @@ void OptionsDialog::saveOptions()
|
||||
#endif
|
||||
session->setPerformanceWarningEnabled(m_ui->checkBoxPerformanceWarning->isChecked());
|
||||
|
||||
auto *const app = static_cast<Application *>(QCoreApplication::instance());
|
||||
auto *app = dynamic_cast<IApplication *>(QCoreApplication::instance());
|
||||
app->setFileLoggerPath(m_ui->textFileLogPath->selectedPath());
|
||||
app->setFileLoggerBackup(m_ui->checkFileLogBackup->isChecked());
|
||||
app->setFileLoggerMaxSize(m_ui->spinFileLogSize->value() * 1024);
|
||||
@@ -969,7 +969,7 @@ void OptionsDialog::loadOptions()
|
||||
#endif
|
||||
m_ui->checkBoxPerformanceWarning->setChecked(session->isPerformanceWarningEnabled());
|
||||
|
||||
const Application *const app = static_cast<Application*>(QCoreApplication::instance());
|
||||
const auto *app = dynamic_cast<IApplication *>(QCoreApplication::instance());
|
||||
m_ui->checkFileLog->setChecked(app->isFileLoggerEnabled());
|
||||
m_ui->textFileLogPath->setSelectedPath(app->fileLoggerPath());
|
||||
const bool fileLogBackup = app->isFileLoggerBackup();
|
||||
|
||||
Reference in New Issue
Block a user