mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Allow to set custom suffix to window title
This is to allow users to differentiate qbt instances when there are multiple running. PR #20429. Closes #17905.
This commit is contained in:
parent
364bcf73ee
commit
46e8ee50c8
13 changed files with 98 additions and 27 deletions
|
@ -226,6 +226,7 @@ namespace
|
|||
Application::Application(int &argc, char **argv)
|
||||
: BaseApplication(argc, argv)
|
||||
, m_commandLineArgs(parseCommandLine(Application::arguments()))
|
||||
, m_storeInstanceName(SETTINGS_KEY(u"InstanceName"_s))
|
||||
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_s))
|
||||
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_s))
|
||||
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_s))
|
||||
|
@ -360,6 +361,23 @@ const QBtCommandLineParameters &Application::commandLineArgs() const
|
|||
return m_commandLineArgs;
|
||||
}
|
||||
|
||||
QString Application::instanceName() const
|
||||
{
|
||||
return m_storeInstanceName;
|
||||
}
|
||||
|
||||
void Application::setInstanceName(const QString &name)
|
||||
{
|
||||
if (name == instanceName())
|
||||
return;
|
||||
|
||||
m_storeInstanceName = name;
|
||||
#ifndef DISABLE_GUI
|
||||
if (MainWindow *mw = mainWindow())
|
||||
mw->setTitleSuffix(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
int Application::memoryWorkingSetLimit() const
|
||||
{
|
||||
return m_storeMemoryWorkingSetLimit.get(512);
|
||||
|
@ -880,7 +898,8 @@ int Application::exec()
|
|||
const WindowState windowState = (m_startupProgressDialog->windowState() & Qt::WindowMinimized)
|
||||
? WindowState::Minimized : WindowState::Normal;
|
||||
#endif
|
||||
m_window = new MainWindow(this, windowState);
|
||||
m_window = new MainWindow(this, windowState, instanceName());
|
||||
|
||||
delete m_startupProgressDialog;
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue