Commit d09854cb authored by Laurent Montel's avatar Laurent Montel
Browse files

Use directly std::chrono_literals

parent cbe0a015
Pipeline #151538 passed with stage
in 8 minutes and 32 seconds
......@@ -18,6 +18,9 @@
#include <Containment>
#include <Corona>
#include <PlasmaQuick/AppletQuickItem>
#include <chrono>
using namespace std::chrono_literals;
AppletsLayout::AppletsLayout(QQuickItem *parent)
: QQuickItem(parent)
......@@ -29,7 +32,7 @@ AppletsLayout::AppletsLayout(QQuickItem *parent)
m_saveLayoutTimer = new QTimer(this);
m_saveLayoutTimer->setSingleShot(true);
m_saveLayoutTimer->setInterval(100);
m_saveLayoutTimer->setInterval(100ms);
connect(m_layoutManager, &AbstractLayoutManager::layoutNeedsSaving, m_saveLayoutTimer, QOverload<>::of(&QTimer::start));
connect(m_saveLayoutTimer, &QTimer::timeout, this, [this]() {
// We can't assume m_containment to be valid: if we load in a plasmoid that can run also
......@@ -53,7 +56,7 @@ AppletsLayout::AppletsLayout(QQuickItem *parent)
m_layoutChangeTimer = new QTimer(this);
m_layoutChangeTimer->setSingleShot(true);
m_layoutChangeTimer->setInterval(100);
m_layoutChangeTimer->setInterval(100ms);
connect(m_layoutChangeTimer, &QTimer::timeout, this, [this]() {
// We can't assume m_containment to be valid: if we load in a plasmoid that can run also
// in "applet" mode, m_containment will never be valid
......
......@@ -6,14 +6,17 @@
#include "configoverlay.h"
#include <chrono>
#include <cmath>
using namespace std::chrono_literals;
ConfigOverlay::ConfigOverlay(QQuickItem *parent)
: QQuickItem(parent)
{
m_hideTimer = new QTimer(this);
m_hideTimer->setSingleShot(true);
m_hideTimer->setInterval(600);
m_hideTimer->setInterval(600ms);
connect(m_hideTimer, &QTimer::timeout, this, [this]() {
setVisible(false);
});
......
......@@ -17,6 +17,9 @@
#include <cmath>
#include <PlasmaQuick/AppletQuickItem>
#include <chrono>
using namespace std::chrono_literals;
ItemContainer::ItemContainer(QQuickItem *parent)
: QQuickItem(parent)
......@@ -656,7 +659,7 @@ void ItemContainer::hoverLeaveEvent(QHoverEvent *event)
if (!m_closeEditModeTimer) {
m_closeEditModeTimer = new QTimer(this);
m_closeEditModeTimer->setSingleShot(true);
m_closeEditModeTimer->setInterval(500);
m_closeEditModeTimer->setInterval(500ms);
connect(m_closeEditModeTimer, &QTimer::timeout, this, [this]() {
setEditMode(false);
});
......
......@@ -32,6 +32,9 @@
#include <xcb/xcb.h>
#include "window.h"
#include <chrono>
using namespace std::chrono_literals;
static const QString s_ourServiceName = QStringLiteral("org.kde.plasma.gmenu_dbusmenu_proxy");
......@@ -87,7 +90,7 @@ MenuProxy::MenuProxy()
// kde-gtk-config just deletes and re-creates the gtkrc-2.0, watch this and add our config to it again
m_writeGtk2SettingsTimer->setSingleShot(true);
m_writeGtk2SettingsTimer->setInterval(1000);
m_writeGtk2SettingsTimer->setInterval(1s);
connect(m_writeGtk2SettingsTimer, &QTimer::timeout, this, &MenuProxy::writeGtk2Settings);
auto startGtk2SettingsTimer = [this] {
......
......@@ -47,7 +47,10 @@
#else
#include <QX11Info>
#endif
#include <chrono>
#include <xcb/xcb.h>
using namespace std::chrono_literals;
#endif
namespace
......@@ -351,7 +354,7 @@ void Klipper::loadSettings()
if (m_bKeepContents && !m_saveFileTimer) {
m_saveFileTimer = new QTimer(this);
m_saveFileTimer->setSingleShot(true);
m_saveFileTimer->setInterval(5000);
m_saveFileTimer->setInterval(5s);
connect(m_saveFileTimer, &QTimer::timeout, this, [this] {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QtConcurrent::run(this, &Klipper::saveHistory, false);
......@@ -682,12 +685,12 @@ bool Klipper::blockFetchingNewData()
if (((queryPointer->mask & (XCB_KEY_BUT_MASK_SHIFT | XCB_KEY_BUT_MASK_BUTTON_1)) == XCB_KEY_BUT_MASK_SHIFT) // BUG: 85198
|| ((queryPointer->mask & XCB_KEY_BUT_MASK_BUTTON_1) == XCB_KEY_BUT_MASK_BUTTON_1)) { // BUG: 80302
m_pendingContentsCheck = true;
m_pendingCheckTimer.start(100);
m_pendingCheckTimer.start(100ms);
return true;
}
m_pendingContentsCheck = false;
if (m_overflowCounter == 0)
m_overflowClearTimer.start(1000);
m_overflowClearTimer.start(1s);
if (++m_overflowCounter > MAX_CLIPBOARD_CHANGES)
return true;
#endif
......
......@@ -18,8 +18,11 @@
#include <KShell>
#include <algorithm>
#include <chrono>
#include <functional>
using namespace std::chrono_literals;
static const int s_notificationsLimit = 1000;
using namespace NotificationManager;
......@@ -29,7 +32,7 @@ AbstractNotificationsModel::Private::Private(AbstractNotificationsModel *q)
, lastRead(QDateTime::currentDateTimeUtc())
{
pendingRemovalTimer.setSingleShot(true);
pendingRemovalTimer.setInterval(50);
pendingRemovalTimer.setInterval(50ms);
connect(&pendingRemovalTimer, &QTimer::timeout, q, [this, q] {
QVector<int> rowsToBeRemoved;
rowsToBeRemoved.reserve(pendingRemovals.count());
......
......@@ -35,6 +35,9 @@
#endif
#include "launchertasksmodel_p.h"
#include <chrono>
using namespace std::chrono_literals;
namespace TaskManager
{
......@@ -86,7 +89,7 @@ LauncherTasksModel::Private::Private(LauncherTasksModel *q)
void LauncherTasksModel::Private::init()
{
sycocaChangeTimer.setSingleShot(true);
sycocaChangeTimer.setInterval(100);
sycocaChangeTimer.setInterval(100ms);
QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, [this]() {
if (!launchersOrder.count()) {
......
......@@ -30,6 +30,9 @@
#include <private/qtx11extras_p.h>
#else
#include <QX11Info>
#include <chrono>
using namespace std::chrono_literals;
#endif
namespace TaskManager
......@@ -122,7 +125,7 @@ void XWindowTasksModel::Private::init()
cachedStackingOrder = KWindowSystem::stackingOrder();
sycocaChangeTimer.setSingleShot(true);
sycocaChangeTimer.setInterval(100);
sycocaChangeTimer.setInterval(100ms);
QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, clearCacheAndRefresh);
......
......@@ -27,6 +27,10 @@
#include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/surface.h>
#include <chrono>
using namespace std::chrono_literals;
//////////////////////////////PanelConfigView
PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent)
: ConfigView(containment, parent)
......@@ -39,7 +43,7 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa
connect(panelView, &QWindow::screenChanged, &m_screenSyncTimer, QOverload<>::of(&QTimer::start));
m_screenSyncTimer.setSingleShot(true);
m_screenSyncTimer.setInterval(150);
m_screenSyncTimer.setInterval(150ms);
connect(&m_screenSyncTimer, &QTimer::timeout, [=]() {
setScreen(panelView->screen());
KWindowSystem::setType(winId(), NET::Dock);
......
......@@ -43,7 +43,9 @@
#endif
#include <xcb/xcb.h>
#endif
#include <chrono>
using namespace std::chrono_literals;
static const int MINSIZE = 10;
PanelView::PanelView(ShellCorona *corona, QScreen *targetScreen, QWindow *parent)
......@@ -85,7 +87,7 @@ PanelView::PanelView(ShellCorona *corona, QScreen *targetScreen, QWindow *parent
connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore);
m_unhideTimer.setSingleShot(true);
m_unhideTimer.setInterval(500);
m_unhideTimer.setInterval(500ms);
connect(&m_unhideTimer, &QTimer::timeout, this, &PanelView::restoreAutoHide);
m_lastScreen = targetScreen;
......@@ -1355,7 +1357,7 @@ void PanelView::showTemporarily()
QTimer *t = new QTimer(this);
t->setSingleShot(true);
t->setInterval(3000);
t->setInterval(3s);
connect(t, &QTimer::timeout, this, &PanelView::restoreAutoHide);
connect(t, &QTimer::timeout, t, &QObject::deleteLater);
t->start();
......
......@@ -19,6 +19,10 @@
#define CHECK_SCREEN_INVARIANTS
#endif
#include <chrono>
using namespace std::chrono_literals;
ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent)
: QObject(parent)
, m_configGroup(KConfigGroup(config, QStringLiteral("ScreenConnectors")))
......@@ -29,7 +33,7 @@ ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent)
connect(m_primaryWatcher, &PrimaryOutputWatcher::primaryOutputNameChanged, this, &ScreenPool::handlePrimaryOutputNameChanged);
m_reconsiderOutputsTimer.setSingleShot(true);
m_reconsiderOutputsTimer.setInterval(250);
m_reconsiderOutputsTimer.setInterval(250ms);
connect(&m_reconsiderOutputsTimer, &QTimer::timeout, this, &ScreenPool::reconsiderOutputs);
m_configSaveTimer.setSingleShot(true);
......
......@@ -10,10 +10,13 @@
#include <QDebug>
#include <QTimer>
#include <chrono>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <ksharedconfig.h>
using namespace std::chrono_literals;
class ConfigGroupPrivate
{
public:
......@@ -44,7 +47,7 @@ ConfigGroup::ConfigGroup(QObject *parent)
// Delay and compress everything within 5 seconds into one sync
d->synchTimer = new QTimer(this);
d->synchTimer->setSingleShot(true);
d->synchTimer->setInterval(1500);
d->synchTimer->setInterval(1500ms);
connect(d->synchTimer, &QTimer::timeout, this, &ConfigGroup::sync);
}
......
......@@ -17,10 +17,12 @@
#include <QQuickItem>
#include <QScreen>
#include "shellcorona.h"
#include "screenpool.h"
#include "panelview.h"
#include "screenpool.h"
#include "shellcorona.h"
#include <chrono>
using namespace std::chrono_literals;
ScreenPoolModel::ScreenPoolModel(ShellCorona *corona, QObject *parent)
: QAbstractListModel(parent)
......@@ -28,7 +30,7 @@ ScreenPoolModel::ScreenPoolModel(ShellCorona *corona, QObject *parent)
{
m_reloadTimer = new QTimer(this);
m_reloadTimer->setSingleShot(true);
m_reloadTimer->setInterval(200);
m_reloadTimer->setInterval(200ms);
connect(m_reloadTimer, &QTimer::timeout, this, &ScreenPoolModel::load);
......@@ -148,7 +150,7 @@ ShellContainmentModel::ShellContainmentModel(ShellCorona *corona, int screenId,
{
m_reloadTimer = new QTimer(this);
m_reloadTimer->setSingleShot(true);
m_reloadTimer->setInterval(200);
m_reloadTimer->setInterval(200ms);
connect(m_reloadTimer, &QTimer::timeout, this, &ShellContainmentModel::load);
......
......@@ -77,7 +77,9 @@
#endif
#include <xcb/xcb.h>
#endif
#include <chrono>
using namespace std::chrono_literals;
static const int s_configSyncDelay = 10000; // 10 seconds
ShellCorona::ShellCorona(QObject *parent)
......@@ -117,12 +119,12 @@ void ShellCorona::init()
connect(this, &Corona::configSynced, this, &ShellCorona::syncAppConfig);
m_waitingPanelsTimer.setSingleShot(true);
m_waitingPanelsTimer.setInterval(250);
m_waitingPanelsTimer.setInterval(250ms);
connect(&m_waitingPanelsTimer, &QTimer::timeout, this, &ShellCorona::createWaitingPanels);
#ifndef NDEBUG
m_invariantsTimer.setSingleShot(true);
m_invariantsTimer.setInterval(250);
m_invariantsTimer.setInterval(250ms);
connect(&m_invariantsTimer, &QTimer::timeout, this, &ShellCorona::screenInvariants);
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment