mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Make use of chrono literals from std library
This commit is contained in:
parent
2a5dbe840c
commit
6de72ecc77
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -79,6 +80,8 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
|||||||
#include "gui/utils.h"
|
#include "gui/utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
void displayVersion();
|
void displayVersion();
|
||||||
bool userAgreesWithLegalNotice();
|
bool userAgreesWithLegalNotice();
|
||||||
void displayBadArgMessage(const QString &message);
|
void displayBadArgMessage(const QString &message);
|
||||||
@ -284,7 +287,7 @@ void showSplashScreen()
|
|||||||
painter.drawText(224 - painter.fontMetrics().horizontalAdvance(version), 270, version);
|
painter.drawText(224 - painter.fontMetrics().horizontalAdvance(version), 270, version);
|
||||||
QSplashScreen *splash = new QSplashScreen(splashImg);
|
QSplashScreen *splash = new QSplashScreen(splashImg);
|
||||||
splash->show();
|
splash->show();
|
||||||
QTimer::singleShot(1500, splash, &QObject::deleteLater);
|
QTimer::singleShot(1500ms, splash, &QObject::deleteLater);
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
}
|
}
|
||||||
#endif // DISABLE_GUI
|
#endif // DISABLE_GUI
|
||||||
|
@ -29,14 +29,16 @@
|
|||||||
|
|
||||||
#include "bandwidthscheduler.h"
|
#include "bandwidthscheduler.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include "base/preferences.h"
|
#include "base/preferences.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
BandwidthScheduler::BandwidthScheduler(QObject *parent)
|
BandwidthScheduler::BandwidthScheduler(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_lastAlternative(false)
|
, m_lastAlternative(false)
|
||||||
@ -51,7 +53,7 @@ void BandwidthScheduler::start()
|
|||||||
|
|
||||||
// Timeout regularly to accommodate for external system clock changes
|
// Timeout regularly to accommodate for external system clock changes
|
||||||
// eg from the user or from a timesync utility
|
// eg from the user or from a timesync utility
|
||||||
m_timer.start(30000);
|
m_timer.start(30s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BandwidthScheduler::isTimeForAlternative() const
|
bool BandwidthScheduler::isTimeForAlternative() const
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
@ -107,6 +108,7 @@
|
|||||||
#include "torrentimpl.h"
|
#include "torrentimpl.h"
|
||||||
#include "tracker.h"
|
#include "tracker.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
using namespace BitTorrent;
|
using namespace BitTorrent;
|
||||||
|
|
||||||
const Path CATEGORIES_FILE_NAME {u"categories.json"_qs};
|
const Path CATEGORIES_FILE_NAME {u"categories.json"_qs};
|
||||||
@ -442,11 +444,11 @@ Session::Session(QObject *parent)
|
|||||||
m_port = Utils::Random::rand(1024, 65535);
|
m_port = Utils::Random::rand(1024, 65535);
|
||||||
|
|
||||||
m_recentErroredTorrentsTimer->setSingleShot(true);
|
m_recentErroredTorrentsTimer->setSingleShot(true);
|
||||||
m_recentErroredTorrentsTimer->setInterval(1000);
|
m_recentErroredTorrentsTimer->setInterval(1s);
|
||||||
connect(m_recentErroredTorrentsTimer, &QTimer::timeout
|
connect(m_recentErroredTorrentsTimer, &QTimer::timeout
|
||||||
, this, [this]() { m_recentErroredTorrents.clear(); });
|
, this, [this]() { m_recentErroredTorrents.clear(); });
|
||||||
|
|
||||||
m_seedingLimitTimer->setInterval(10000);
|
m_seedingLimitTimer->setInterval(10s);
|
||||||
connect(m_seedingLimitTimer, &QTimer::timeout, this, &Session::processShareLimits);
|
connect(m_seedingLimitTimer, &QTimer::timeout, this, &Session::processShareLimits);
|
||||||
|
|
||||||
initializeNativeSession();
|
initializeNativeSession();
|
||||||
@ -497,7 +499,7 @@ Session::Session(QObject *parent)
|
|||||||
const int saveInterval = saveResumeDataInterval();
|
const int saveInterval = saveResumeDataInterval();
|
||||||
if (saveInterval > 0)
|
if (saveInterval > 0)
|
||||||
{
|
{
|
||||||
m_resumeDataTimer->setInterval(saveInterval * 60 * 1000);
|
m_resumeDataTimer->setInterval(std::chrono::minutes(saveInterval));
|
||||||
m_resumeDataTimer->start();
|
m_resumeDataTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2907,7 +2909,7 @@ void Session::setSaveResumeDataInterval(const int value)
|
|||||||
|
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
{
|
{
|
||||||
m_resumeDataTimer->setInterval(value * 60 * 1000);
|
m_resumeDataTimer->setInterval(std::chrono::minutes(value));
|
||||||
m_resumeDataTimer->start();
|
m_resumeDataTimer->start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5243,7 +5245,6 @@ void Session::handleSessionStatsAlert(const lt::session_stats_alert *p)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(current >= previous);
|
Q_ASSERT(current >= previous);
|
||||||
Q_ASSERT(interval >= 0);
|
Q_ASSERT(interval >= 0);
|
||||||
using namespace std::chrono_literals;
|
|
||||||
return (((current - previous) * lt::microseconds(1s).count()) / interval);
|
return (((current - previous) * lt::microseconds(1s).count()) / interval);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
using namespace BitTorrent;
|
using namespace BitTorrent;
|
||||||
|
|
||||||
const qint64 SAVE_INTERVAL = std::chrono::milliseconds(15min).count();
|
const int SAVE_INTERVAL = std::chrono::milliseconds(15min).count();
|
||||||
|
|
||||||
Statistics::Statistics(Session *session)
|
Statistics::Statistics(Session *session)
|
||||||
: QObject(session)
|
: QObject(session)
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QSslCipher>
|
#include <QSslCipher>
|
||||||
@ -44,11 +45,13 @@
|
|||||||
#include "base/utils/net.h"
|
#include "base/utils/net.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const int KEEP_ALIVE_DURATION = 7 * 1000; // milliseconds
|
const int KEEP_ALIVE_DURATION = std::chrono::milliseconds(7s).count();
|
||||||
const int CONNECTIONS_LIMIT = 500;
|
const int CONNECTIONS_LIMIT = 500;
|
||||||
const int CONNECTIONS_SCAN_INTERVAL = 2; // seconds
|
const std::chrono::seconds CONNECTIONS_SCAN_INTERVAL {2};
|
||||||
|
|
||||||
QList<QSslCipher> safeCipherList()
|
QList<QSslCipher> safeCipherList()
|
||||||
{
|
{
|
||||||
@ -81,7 +84,7 @@ Server::Server(IRequestHandler *requestHandler, QObject *parent)
|
|||||||
|
|
||||||
auto *dropConnectionTimer = new QTimer(this);
|
auto *dropConnectionTimer = new QTimer(this);
|
||||||
connect(dropConnectionTimer, &QTimer::timeout, this, &Server::dropTimedOutConnection);
|
connect(dropConnectionTimer, &QTimer::timeout, this, &Server::dropTimedOutConnection);
|
||||||
dropConnectionTimer->start(CONNECTIONS_SCAN_INTERVAL * 1000);
|
dropConnectionTimer->start(CONNECTIONS_SCAN_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::incomingConnection(const qintptr socketDescriptor)
|
void Server::incomingConnection(const qintptr socketDescriptor)
|
||||||
|
@ -37,8 +37,11 @@
|
|||||||
#include "base/net/downloadmanager.h"
|
#include "base/net/downloadmanager.h"
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
using namespace Net;
|
using namespace Net;
|
||||||
|
|
||||||
|
const std::chrono::seconds IP_CHECK_INTERVAL = 30min;
|
||||||
|
|
||||||
DNSUpdater::DNSUpdater(QObject *parent)
|
DNSUpdater::DNSUpdater(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_state(OK)
|
, m_state(OK)
|
||||||
@ -52,14 +55,14 @@ DNSUpdater::DNSUpdater(QObject *parent)
|
|||||||
m_lastIP = QHostAddress(pref->getDNSLastIP());
|
m_lastIP = QHostAddress(pref->getDNSLastIP());
|
||||||
|
|
||||||
// Start IP checking timer
|
// Start IP checking timer
|
||||||
m_ipCheckTimer.setInterval(IP_CHECK_INTERVAL_MS);
|
m_ipCheckTimer.setInterval(IP_CHECK_INTERVAL);
|
||||||
connect(&m_ipCheckTimer, &QTimer::timeout, this, &DNSUpdater::checkPublicIP);
|
connect(&m_ipCheckTimer, &QTimer::timeout, this, &DNSUpdater::checkPublicIP);
|
||||||
m_ipCheckTimer.start();
|
m_ipCheckTimer.start();
|
||||||
|
|
||||||
// Check lastUpdate to avoid flooding
|
// Check lastUpdate to avoid flooding
|
||||||
if (!m_lastIPCheckTime.isValid()
|
if (!m_lastIPCheckTime.isValid()
|
||||||
|| (m_lastIPCheckTime.secsTo(QDateTime::currentDateTime()) * 1000 > IP_CHECK_INTERVAL_MS))
|
|| (m_lastIPCheckTime.secsTo(QDateTime::currentDateTime()) > IP_CHECK_INTERVAL.count()))
|
||||||
{
|
{
|
||||||
checkPublicIP();
|
checkPublicIP();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,8 +68,6 @@ namespace Net
|
|||||||
FATAL
|
FATAL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int IP_CHECK_INTERVAL_MS = 1800000; // 30 min
|
|
||||||
|
|
||||||
QString getUpdateUrl() const;
|
QString getUpdateUrl() const;
|
||||||
void processIPUpdateReply(const QString &reply);
|
void processIPUpdateReply(const QString &reply);
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "rss_session.h"
|
#include "rss_session.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
@ -48,7 +50,6 @@
|
|||||||
#include "rss_folder.h"
|
#include "rss_folder.h"
|
||||||
#include "rss_item.h"
|
#include "rss_item.h"
|
||||||
|
|
||||||
const int MsecsPerMin = 60000;
|
|
||||||
const QString CONF_FOLDER_NAME = u"rss"_qs;
|
const QString CONF_FOLDER_NAME = u"rss"_qs;
|
||||||
const QString DATA_FOLDER_NAME = u"rss/articles"_qs;
|
const QString DATA_FOLDER_NAME = u"rss/articles"_qs;
|
||||||
const QString FEEDS_FILE_NAME = u"feeds.json"_qs;
|
const QString FEEDS_FILE_NAME = u"feeds.json"_qs;
|
||||||
@ -92,7 +93,7 @@ Session::Session()
|
|||||||
connect(&m_refreshTimer, &QTimer::timeout, this, &Session::refresh);
|
connect(&m_refreshTimer, &QTimer::timeout, this, &Session::refresh);
|
||||||
if (isProcessingEnabled())
|
if (isProcessingEnabled())
|
||||||
{
|
{
|
||||||
m_refreshTimer.start(refreshInterval() * MsecsPerMin);
|
m_refreshTimer.start(std::chrono::minutes(refreshInterval()));
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +434,7 @@ void Session::setProcessingEnabled(const bool enabled)
|
|||||||
m_storeProcessingEnabled = enabled;
|
m_storeProcessingEnabled = enabled;
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
m_refreshTimer.start(refreshInterval() * MsecsPerMin);
|
m_refreshTimer.start(std::chrono::minutes(refreshInterval()));
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -480,7 +481,7 @@ void Session::setRefreshInterval(const int refreshInterval)
|
|||||||
if (m_storeRefreshInterval != refreshInterval)
|
if (m_storeRefreshInterval != refreshInterval)
|
||||||
{
|
{
|
||||||
m_storeRefreshInterval = refreshInterval;
|
m_storeRefreshInterval = refreshInterval;
|
||||||
m_refreshTimer.start(m_storeRefreshInterval * MsecsPerMin);
|
m_refreshTimer.start(std::chrono::minutes(m_storeRefreshInterval));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "searchhandler.h"
|
#include "searchhandler.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -40,6 +42,8 @@
|
|||||||
#include "base/utils/fs.h"
|
#include "base/utils/fs.h"
|
||||||
#include "searchpluginmanager.h"
|
#include "searchpluginmanager.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum SearchResultColumn
|
enum SearchResultColumn
|
||||||
@ -85,7 +89,7 @@ SearchHandler::SearchHandler(const QString &pattern, const QString &category, co
|
|||||||
|
|
||||||
m_searchTimeout->setSingleShot(true);
|
m_searchTimeout->setSingleShot(true);
|
||||||
connect(m_searchTimeout, &QTimer::timeout, this, &SearchHandler::cancelSearch);
|
connect(m_searchTimeout, &QTimer::timeout, this, &SearchHandler::cancelSearch);
|
||||||
m_searchTimeout->start(180000); // 3 min
|
m_searchTimeout->start(3min);
|
||||||
|
|
||||||
// deferred start allows clients to handle starting-related signals
|
// deferred start allows clients to handle starting-related signals
|
||||||
QMetaObject::invokeMethod(this, [this]() { m_searchProcess->start(QIODevice::ReadOnly); }
|
QMetaObject::invokeMethod(this, [this]() { m_searchProcess->start(QIODevice::ReadOnly); }
|
||||||
|
@ -29,7 +29,9 @@
|
|||||||
|
|
||||||
#include "settingsstorage.h"
|
#include "settingsstorage.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
@ -39,6 +41,8 @@
|
|||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "utils/fs.h"
|
#include "utils/fs.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Encapsulates serialization of settings in "atomic" way.
|
// Encapsulates serialization of settings in "atomic" way.
|
||||||
@ -73,7 +77,7 @@ SettingsStorage::SettingsStorage()
|
|||||||
: m_data {TransactionalSettings(u"qBittorrent"_qs).read()}
|
: m_data {TransactionalSettings(u"qBittorrent"_qs).read()}
|
||||||
{
|
{
|
||||||
m_timer.setSingleShot(true);
|
m_timer.setSingleShot(true);
|
||||||
m_timer.setInterval(5 * 1000);
|
m_timer.setInterval(5s);
|
||||||
connect(&m_timer, &QTimer::timeout, this, &SettingsStorage::save);
|
connect(&m_timer, &QTimer::timeout, this, &SettingsStorage::save);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
const std::chrono::duration WATCH_INTERVAL = 10s;
|
const std::chrono::seconds WATCH_INTERVAL {10};
|
||||||
const int MAX_FAILED_RETRIES = 5;
|
const int MAX_FAILED_RETRIES = 5;
|
||||||
const QString CONF_FILE_NAME = u"watched_folders.json"_qs;
|
const QString CONF_FILE_NAME = u"watched_folders.json"_qs;
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ void TorrentFilesWatcher::Worker::removeWatchedFolder(const Path &path)
|
|||||||
|
|
||||||
void TorrentFilesWatcher::Worker::scheduleWatchedFolderProcessing(const Path &path)
|
void TorrentFilesWatcher::Worker::scheduleWatchedFolderProcessing(const Path &path)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(2000, this, [this, path]()
|
QTimer::singleShot(2s, this, [this, path]()
|
||||||
{
|
{
|
||||||
processWatchedFolder(path);
|
processWatchedFolder(path);
|
||||||
});
|
});
|
||||||
|
@ -1762,7 +1762,7 @@ void MainWindow::createTrayIcon(const int retries)
|
|||||||
if (retries > 0)
|
if (retries > 0)
|
||||||
{
|
{
|
||||||
LogMsg(tr("System tray icon is not available, retrying..."), Log::WARNING);
|
LogMsg(tr("System tray icon is not available, retrying..."), Log::WARNING);
|
||||||
QTimer::singleShot(std::chrono::seconds(2), this, [this, retries]()
|
QTimer::singleShot(2s, this, [this, retries]()
|
||||||
{
|
{
|
||||||
if (Preferences::instance()->systemTrayEnabled())
|
if (Preferences::instance()->systemTrayEnabled())
|
||||||
createTrayIcon(retries - 1);
|
createTrayIcon(retries - 1);
|
||||||
|
@ -267,7 +267,7 @@ quint64 SpeedPlotView::maxYValue() const
|
|||||||
if (!m_properties[static_cast<GraphID>(id)].enable)
|
if (!m_properties[static_cast<GraphID>(id)].enable)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
milliseconds duration {0ms};
|
milliseconds duration {0};
|
||||||
for (int i = static_cast<int>(queue.size()) - 1; i >= 0; --i)
|
for (int i = static_cast<int>(queue.size()) - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
maxYValue = std::max(maxYValue, queue[i].data[id]);
|
maxYValue = std::max(maxYValue, queue[i].data[id]);
|
||||||
@ -360,7 +360,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
QVector<QPoint> points;
|
QVector<QPoint> points;
|
||||||
milliseconds duration {0ms};
|
milliseconds duration {0};
|
||||||
|
|
||||||
for (int i = static_cast<int>(queue.size()) - 1; i >= 0; --i)
|
for (int i = static_cast<int>(queue.size()) - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
const milliseconds m_resolution;
|
const milliseconds m_resolution;
|
||||||
const milliseconds m_maxDuration;
|
const milliseconds m_maxDuration;
|
||||||
milliseconds m_currentDuration {0ms};
|
milliseconds m_currentDuration {0};
|
||||||
int m_counter = 0;
|
int m_counter = 0;
|
||||||
SampleData m_accumulator {};
|
SampleData m_accumulator {};
|
||||||
DataCircularBuffer m_sink {};
|
DataCircularBuffer m_sink {};
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "shutdownconfirmdialog.h"
|
#include "shutdownconfirmdialog.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -38,6 +40,8 @@
|
|||||||
#include "ui_shutdownconfirmdialog.h"
|
#include "ui_shutdownconfirmdialog.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
ShutdownConfirmDialog::ShutdownConfirmDialog(QWidget *parent, const ShutdownDialogAction &action)
|
ShutdownConfirmDialog::ShutdownConfirmDialog(QWidget *parent, const ShutdownDialogAction &action)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_ui(new Ui::ShutdownConfirmDialog)
|
, m_ui(new Ui::ShutdownConfirmDialog)
|
||||||
@ -64,7 +68,7 @@ ShutdownConfirmDialog::ShutdownConfirmDialog(QWidget *parent, const ShutdownDial
|
|||||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
move(Utils::Gui::screenCenter(this));
|
move(Utils::Gui::screenCenter(this));
|
||||||
|
|
||||||
m_timer.setInterval(1000); // 1sec
|
m_timer.setInterval(1s);
|
||||||
connect(&m_timer, &QTimer::timeout, this, &ShutdownConfirmDialog::updateSeconds);
|
connect(&m_timer, &QTimer::timeout, this, &ShutdownConfirmDialog::updateSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "appcontroller.h"
|
#include "appcontroller.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -62,6 +63,8 @@
|
|||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
#include "../webapplication.h"
|
#include "../webapplication.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
void AppController::webapiVersionAction()
|
void AppController::webapiVersionAction()
|
||||||
{
|
{
|
||||||
setResult(API_VERSION.toString());
|
setResult(API_VERSION.toString());
|
||||||
@ -93,7 +96,7 @@ void AppController::shutdownAction()
|
|||||||
// Special case handling for shutdown, we
|
// Special case handling for shutdown, we
|
||||||
// need to reply to the Web UI before
|
// need to reply to the Web UI before
|
||||||
// actually shutting down.
|
// actually shutting down.
|
||||||
QTimer::singleShot(100, qApp, &QCoreApplication::quit);
|
QTimer::singleShot(100ms, qApp, &QCoreApplication::quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppController::preferencesAction()
|
void AppController::preferencesAction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user