|
|
@ -904,11 +904,14 @@ void GUI::configureSession(bool deleteOptions) { |
|
|
|
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION))); |
|
|
|
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION))); |
|
|
|
} |
|
|
|
} |
|
|
|
displaySpeedInTitle = new_displaySpeedInTitle; |
|
|
|
displaySpeedInTitle = new_displaySpeedInTitle; |
|
|
|
|
|
|
|
if(options->isToolbarDisplayed() != toolBar->isVisible()) { |
|
|
|
if(options->isToolbarDisplayed()) { |
|
|
|
if(options->isToolbarDisplayed()) { |
|
|
|
toolBar->setVisible(true); |
|
|
|
toolBar->setVisible(true); |
|
|
|
|
|
|
|
toolBar->layout()->setSpacing(7); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
toolBar->setVisible(false); |
|
|
|
toolBar->setVisible(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
unsigned int new_refreshInterval = options->getRefreshInterval(); |
|
|
|
unsigned int new_refreshInterval = options->getRefreshInterval(); |
|
|
|
if(refreshInterval != new_refreshInterval) { |
|
|
|
if(refreshInterval != new_refreshInterval) { |
|
|
|
refreshInterval = new_refreshInterval; |
|
|
|
refreshInterval = new_refreshInterval; |
|
|
@ -1502,38 +1505,33 @@ void GUI::on_actionOptions_triggered() { |
|
|
|
void GUI::OptionsSaved(bool deleteOptions) { |
|
|
|
void GUI::OptionsSaved(bool deleteOptions) { |
|
|
|
BTSession->addConsoleMessage(tr("Options were saved successfully.")); |
|
|
|
BTSession->addConsoleMessage(tr("Options were saved successfully.")); |
|
|
|
bool newSystrayIntegration = options->systrayIntegration(); |
|
|
|
bool newSystrayIntegration = options->systrayIntegration(); |
|
|
|
if(newSystrayIntegration && !systrayIntegration) { |
|
|
|
if(newSystrayIntegration != systrayIntegration) { |
|
|
|
|
|
|
|
if(newSystrayIntegration) { |
|
|
|
// create the trayicon
|
|
|
|
// create the trayicon
|
|
|
|
createTrayIcon(); |
|
|
|
createTrayIcon(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if(!newSystrayIntegration && systrayIntegration) { |
|
|
|
|
|
|
|
// Destroy trayicon
|
|
|
|
// Destroy trayicon
|
|
|
|
delete myTrayIcon; |
|
|
|
delete myTrayIcon; |
|
|
|
delete myTrayIconMenu; |
|
|
|
delete myTrayIconMenu; |
|
|
|
} |
|
|
|
} |
|
|
|
systrayIntegration = newSystrayIntegration; |
|
|
|
systrayIntegration = newSystrayIntegration; |
|
|
|
|
|
|
|
} |
|
|
|
// Update Web UI
|
|
|
|
// Update Web UI
|
|
|
|
if (options->isWebUiEnabled()) |
|
|
|
if (options->isWebUiEnabled()) { |
|
|
|
{ |
|
|
|
|
|
|
|
quint16 port = options->webUiPort(); |
|
|
|
quint16 port = options->webUiPort(); |
|
|
|
QString username = options->webUiUsername(); |
|
|
|
QString username = options->webUiUsername(); |
|
|
|
QString password = options->webUiPassword(); |
|
|
|
QString password = options->webUiPassword(); |
|
|
|
initWebUi(username, password, port); |
|
|
|
initWebUi(username, password, port); |
|
|
|
} |
|
|
|
} else if(httpServer) { |
|
|
|
else if(httpServer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete httpServer; |
|
|
|
delete httpServer; |
|
|
|
} |
|
|
|
} |
|
|
|
// Update session
|
|
|
|
// Update session
|
|
|
|
configureSession(deleteOptions); |
|
|
|
configureSession(deleteOptions); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool GUI::initWebUi(QString username, QString password, int port) |
|
|
|
bool GUI::initWebUi(QString username, QString password, int port) { |
|
|
|
{ |
|
|
|
|
|
|
|
if(httpServer) |
|
|
|
if(httpServer) |
|
|
|
{ |
|
|
|
|
|
|
|
httpServer->close(); |
|
|
|
httpServer->close(); |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
httpServer = new HttpServer(BTSession, 3000, this); |
|
|
|
httpServer = new HttpServer(BTSession, 3000, this); |
|
|
|
httpServer->setAuthorization(username, password); |
|
|
|
httpServer->setAuthorization(username, password); |
|
|
|