Use directly std::chrono_literals

wilder-5.25
Laurent Montel 4 years ago
parent cbe0a015b0
commit d09854cbc0
  1. 7
      components/containmentlayoutmanager/appletslayout.cpp
  2. 5
      components/containmentlayoutmanager/configoverlay.cpp
  3. 5
      components/containmentlayoutmanager/itemcontainer.cpp
  4. 5
      gmenu-dbusmenu-proxy/menuproxy.cpp
  5. 9
      klipper/klipper.cpp
  6. 5
      libnotificationmanager/abstractnotificationsmodel.cpp
  7. 5
      libtaskmanager/launchertasksmodel.cpp
  8. 5
      libtaskmanager/xwindowtasksmodel.cpp
  9. 6
      shell/panelconfigview.cpp
  10. 6
      shell/panelview.cpp
  11. 6
      shell/screenpool.cpp
  12. 5
      shell/scripting/configgroup.cpp
  13. 10
      shell/shellcontainmentconfig.cpp
  14. 6
      shell/shellcorona.cpp

@ -18,6 +18,9 @@
#include <Containment> #include <Containment>
#include <Corona> #include <Corona>
#include <PlasmaQuick/AppletQuickItem> #include <PlasmaQuick/AppletQuickItem>
#include <chrono>
using namespace std::chrono_literals;
AppletsLayout::AppletsLayout(QQuickItem *parent) AppletsLayout::AppletsLayout(QQuickItem *parent)
: QQuickItem(parent) : QQuickItem(parent)
@ -29,7 +32,7 @@ AppletsLayout::AppletsLayout(QQuickItem *parent)
m_saveLayoutTimer = new QTimer(this); m_saveLayoutTimer = new QTimer(this);
m_saveLayoutTimer->setSingleShot(true); 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_layoutManager, &AbstractLayoutManager::layoutNeedsSaving, m_saveLayoutTimer, QOverload<>::of(&QTimer::start));
connect(m_saveLayoutTimer, &QTimer::timeout, this, [this]() { 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 // 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 = new QTimer(this);
m_layoutChangeTimer->setSingleShot(true); m_layoutChangeTimer->setSingleShot(true);
m_layoutChangeTimer->setInterval(100); m_layoutChangeTimer->setInterval(100ms);
connect(m_layoutChangeTimer, &QTimer::timeout, this, [this]() { 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 // 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 // in "applet" mode, m_containment will never be valid

@ -6,14 +6,17 @@
#include "configoverlay.h" #include "configoverlay.h"
#include <chrono>
#include <cmath> #include <cmath>
using namespace std::chrono_literals;
ConfigOverlay::ConfigOverlay(QQuickItem *parent) ConfigOverlay::ConfigOverlay(QQuickItem *parent)
: QQuickItem(parent) : QQuickItem(parent)
{ {
m_hideTimer = new QTimer(this); m_hideTimer = new QTimer(this);
m_hideTimer->setSingleShot(true); m_hideTimer->setSingleShot(true);
m_hideTimer->setInterval(600); m_hideTimer->setInterval(600ms);
connect(m_hideTimer, &QTimer::timeout, this, [this]() { connect(m_hideTimer, &QTimer::timeout, this, [this]() {
setVisible(false); setVisible(false);
}); });

@ -17,6 +17,9 @@
#include <cmath> #include <cmath>
#include <PlasmaQuick/AppletQuickItem> #include <PlasmaQuick/AppletQuickItem>
#include <chrono>
using namespace std::chrono_literals;
ItemContainer::ItemContainer(QQuickItem *parent) ItemContainer::ItemContainer(QQuickItem *parent)
: QQuickItem(parent) : QQuickItem(parent)
@ -656,7 +659,7 @@ void ItemContainer::hoverLeaveEvent(QHoverEvent *event)
if (!m_closeEditModeTimer) { if (!m_closeEditModeTimer) {
m_closeEditModeTimer = new QTimer(this); m_closeEditModeTimer = new QTimer(this);
m_closeEditModeTimer->setSingleShot(true); m_closeEditModeTimer->setSingleShot(true);
m_closeEditModeTimer->setInterval(500); m_closeEditModeTimer->setInterval(500ms);
connect(m_closeEditModeTimer, &QTimer::timeout, this, [this]() { connect(m_closeEditModeTimer, &QTimer::timeout, this, [this]() {
setEditMode(false); setEditMode(false);
}); });

@ -32,6 +32,9 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include "window.h" #include "window.h"
#include <chrono>
using namespace std::chrono_literals;
static const QString s_ourServiceName = QStringLiteral("org.kde.plasma.gmenu_dbusmenu_proxy"); 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 // 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->setSingleShot(true);
m_writeGtk2SettingsTimer->setInterval(1000); m_writeGtk2SettingsTimer->setInterval(1s);
connect(m_writeGtk2SettingsTimer, &QTimer::timeout, this, &MenuProxy::writeGtk2Settings); connect(m_writeGtk2SettingsTimer, &QTimer::timeout, this, &MenuProxy::writeGtk2Settings);
auto startGtk2SettingsTimer = [this] { auto startGtk2SettingsTimer = [this] {

@ -47,7 +47,10 @@
#else #else
#include <QX11Info> #include <QX11Info>
#endif #endif
#include <chrono>
#include <xcb/xcb.h> #include <xcb/xcb.h>
using namespace std::chrono_literals;
#endif #endif
namespace namespace
@ -351,7 +354,7 @@ void Klipper::loadSettings()
if (m_bKeepContents && !m_saveFileTimer) { if (m_bKeepContents && !m_saveFileTimer) {
m_saveFileTimer = new QTimer(this); m_saveFileTimer = new QTimer(this);
m_saveFileTimer->setSingleShot(true); m_saveFileTimer->setSingleShot(true);
m_saveFileTimer->setInterval(5000); m_saveFileTimer->setInterval(5s);
connect(m_saveFileTimer, &QTimer::timeout, this, [this] { connect(m_saveFileTimer, &QTimer::timeout, this, [this] {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QtConcurrent::run(this, &Klipper::saveHistory, false); 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 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 || ((queryPointer->mask & XCB_KEY_BUT_MASK_BUTTON_1) == XCB_KEY_BUT_MASK_BUTTON_1)) { // BUG: 80302
m_pendingContentsCheck = true; m_pendingContentsCheck = true;
m_pendingCheckTimer.start(100); m_pendingCheckTimer.start(100ms);
return true; return true;
} }
m_pendingContentsCheck = false; m_pendingContentsCheck = false;
if (m_overflowCounter == 0) if (m_overflowCounter == 0)
m_overflowClearTimer.start(1000); m_overflowClearTimer.start(1s);
if (++m_overflowCounter > MAX_CLIPBOARD_CHANGES) if (++m_overflowCounter > MAX_CLIPBOARD_CHANGES)
return true; return true;
#endif #endif

@ -18,8 +18,11 @@
#include <KShell> #include <KShell>
#include <algorithm> #include <algorithm>
#include <chrono>
#include <functional> #include <functional>
using namespace std::chrono_literals;
static const int s_notificationsLimit = 1000; static const int s_notificationsLimit = 1000;
using namespace NotificationManager; using namespace NotificationManager;
@ -29,7 +32,7 @@ AbstractNotificationsModel::Private::Private(AbstractNotificationsModel *q)
, lastRead(QDateTime::currentDateTimeUtc()) , lastRead(QDateTime::currentDateTimeUtc())
{ {
pendingRemovalTimer.setSingleShot(true); pendingRemovalTimer.setSingleShot(true);
pendingRemovalTimer.setInterval(50); pendingRemovalTimer.setInterval(50ms);
connect(&pendingRemovalTimer, &QTimer::timeout, q, [this, q] { connect(&pendingRemovalTimer, &QTimer::timeout, q, [this, q] {
QVector<int> rowsToBeRemoved; QVector<int> rowsToBeRemoved;
rowsToBeRemoved.reserve(pendingRemovals.count()); rowsToBeRemoved.reserve(pendingRemovals.count());

@ -35,6 +35,9 @@
#endif #endif
#include "launchertasksmodel_p.h" #include "launchertasksmodel_p.h"
#include <chrono>
using namespace std::chrono_literals;
namespace TaskManager namespace TaskManager
{ {
@ -86,7 +89,7 @@ LauncherTasksModel::Private::Private(LauncherTasksModel *q)
void LauncherTasksModel::Private::init() void LauncherTasksModel::Private::init()
{ {
sycocaChangeTimer.setSingleShot(true); sycocaChangeTimer.setSingleShot(true);
sycocaChangeTimer.setInterval(100); sycocaChangeTimer.setInterval(100ms);
QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, [this]() { QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, [this]() {
if (!launchersOrder.count()) { if (!launchersOrder.count()) {

@ -30,6 +30,9 @@
#include <private/qtx11extras_p.h> #include <private/qtx11extras_p.h>
#else #else
#include <QX11Info> #include <QX11Info>
#include <chrono>
using namespace std::chrono_literals;
#endif #endif
namespace TaskManager namespace TaskManager
@ -122,7 +125,7 @@ void XWindowTasksModel::Private::init()
cachedStackingOrder = KWindowSystem::stackingOrder(); cachedStackingOrder = KWindowSystem::stackingOrder();
sycocaChangeTimer.setSingleShot(true); sycocaChangeTimer.setSingleShot(true);
sycocaChangeTimer.setInterval(100); sycocaChangeTimer.setInterval(100ms);
QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, clearCacheAndRefresh); QObject::connect(&sycocaChangeTimer, &QTimer::timeout, q, clearCacheAndRefresh);

@ -27,6 +27,10 @@
#include <KWayland/Client/plasmashell.h> #include <KWayland/Client/plasmashell.h>
#include <KWayland/Client/surface.h> #include <KWayland/Client/surface.h>
#include <chrono>
using namespace std::chrono_literals;
//////////////////////////////PanelConfigView //////////////////////////////PanelConfigView
PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent) PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent)
: ConfigView(containment, 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)); connect(panelView, &QWindow::screenChanged, &m_screenSyncTimer, QOverload<>::of(&QTimer::start));
m_screenSyncTimer.setSingleShot(true); m_screenSyncTimer.setSingleShot(true);
m_screenSyncTimer.setInterval(150); m_screenSyncTimer.setInterval(150ms);
connect(&m_screenSyncTimer, &QTimer::timeout, [=]() { connect(&m_screenSyncTimer, &QTimer::timeout, [=]() {
setScreen(panelView->screen()); setScreen(panelView->screen());
KWindowSystem::setType(winId(), NET::Dock); KWindowSystem::setType(winId(), NET::Dock);

@ -43,7 +43,9 @@
#endif #endif
#include <xcb/xcb.h> #include <xcb/xcb.h>
#endif #endif
#include <chrono>
using namespace std::chrono_literals;
static const int MINSIZE = 10; static const int MINSIZE = 10;
PanelView::PanelView(ShellCorona *corona, QScreen *targetScreen, QWindow *parent) 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); connect(&m_positionPaneltimer, &QTimer::timeout, this, &PanelView::restore);
m_unhideTimer.setSingleShot(true); m_unhideTimer.setSingleShot(true);
m_unhideTimer.setInterval(500); m_unhideTimer.setInterval(500ms);
connect(&m_unhideTimer, &QTimer::timeout, this, &PanelView::restoreAutoHide); connect(&m_unhideTimer, &QTimer::timeout, this, &PanelView::restoreAutoHide);
m_lastScreen = targetScreen; m_lastScreen = targetScreen;
@ -1355,7 +1357,7 @@ void PanelView::showTemporarily()
QTimer *t = new QTimer(this); QTimer *t = new QTimer(this);
t->setSingleShot(true); t->setSingleShot(true);
t->setInterval(3000); t->setInterval(3s);
connect(t, &QTimer::timeout, this, &PanelView::restoreAutoHide); connect(t, &QTimer::timeout, this, &PanelView::restoreAutoHide);
connect(t, &QTimer::timeout, t, &QObject::deleteLater); connect(t, &QTimer::timeout, t, &QObject::deleteLater);
t->start(); t->start();

@ -19,6 +19,10 @@
#define CHECK_SCREEN_INVARIANTS #define CHECK_SCREEN_INVARIANTS
#endif #endif
#include <chrono>
using namespace std::chrono_literals;
ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent) ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent)
: QObject(parent) : QObject(parent)
, m_configGroup(KConfigGroup(config, QStringLiteral("ScreenConnectors"))) , 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); connect(m_primaryWatcher, &PrimaryOutputWatcher::primaryOutputNameChanged, this, &ScreenPool::handlePrimaryOutputNameChanged);
m_reconsiderOutputsTimer.setSingleShot(true); m_reconsiderOutputsTimer.setSingleShot(true);
m_reconsiderOutputsTimer.setInterval(250); m_reconsiderOutputsTimer.setInterval(250ms);
connect(&m_reconsiderOutputsTimer, &QTimer::timeout, this, &ScreenPool::reconsiderOutputs); connect(&m_reconsiderOutputsTimer, &QTimer::timeout, this, &ScreenPool::reconsiderOutputs);
m_configSaveTimer.setSingleShot(true); m_configSaveTimer.setSingleShot(true);

@ -10,10 +10,13 @@
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <chrono>
#include <kconfig.h> #include <kconfig.h>
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <ksharedconfig.h> #include <ksharedconfig.h>
using namespace std::chrono_literals;
class ConfigGroupPrivate class ConfigGroupPrivate
{ {
public: public:
@ -44,7 +47,7 @@ ConfigGroup::ConfigGroup(QObject *parent)
// Delay and compress everything within 5 seconds into one sync // Delay and compress everything within 5 seconds into one sync
d->synchTimer = new QTimer(this); d->synchTimer = new QTimer(this);
d->synchTimer->setSingleShot(true); d->synchTimer->setSingleShot(true);
d->synchTimer->setInterval(1500); d->synchTimer->setInterval(1500ms);
connect(d->synchTimer, &QTimer::timeout, this, &ConfigGroup::sync); connect(d->synchTimer, &QTimer::timeout, this, &ConfigGroup::sync);
} }

@ -17,10 +17,12 @@
#include <QQuickItem> #include <QQuickItem>
#include <QScreen> #include <QScreen>
#include "shellcorona.h"
#include "screenpool.h"
#include "panelview.h" #include "panelview.h"
#include "screenpool.h"
#include "shellcorona.h"
#include <chrono>
using namespace std::chrono_literals;
ScreenPoolModel::ScreenPoolModel(ShellCorona *corona, QObject *parent) ScreenPoolModel::ScreenPoolModel(ShellCorona *corona, QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
@ -28,7 +30,7 @@ ScreenPoolModel::ScreenPoolModel(ShellCorona *corona, QObject *parent)
{ {
m_reloadTimer = new QTimer(this); m_reloadTimer = new QTimer(this);
m_reloadTimer->setSingleShot(true); m_reloadTimer->setSingleShot(true);
m_reloadTimer->setInterval(200); m_reloadTimer->setInterval(200ms);
connect(m_reloadTimer, &QTimer::timeout, this, &ScreenPoolModel::load); 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 = new QTimer(this);
m_reloadTimer->setSingleShot(true); m_reloadTimer->setSingleShot(true);
m_reloadTimer->setInterval(200); m_reloadTimer->setInterval(200ms);
connect(m_reloadTimer, &QTimer::timeout, this, &ShellContainmentModel::load); connect(m_reloadTimer, &QTimer::timeout, this, &ShellContainmentModel::load);

@ -77,7 +77,9 @@
#endif #endif
#include <xcb/xcb.h> #include <xcb/xcb.h>
#endif #endif
#include <chrono>
using namespace std::chrono_literals;
static const int s_configSyncDelay = 10000; // 10 seconds static const int s_configSyncDelay = 10000; // 10 seconds
ShellCorona::ShellCorona(QObject *parent) ShellCorona::ShellCorona(QObject *parent)
@ -117,12 +119,12 @@ void ShellCorona::init()
connect(this, &Corona::configSynced, this, &ShellCorona::syncAppConfig); connect(this, &Corona::configSynced, this, &ShellCorona::syncAppConfig);
m_waitingPanelsTimer.setSingleShot(true); m_waitingPanelsTimer.setSingleShot(true);
m_waitingPanelsTimer.setInterval(250); m_waitingPanelsTimer.setInterval(250ms);
connect(&m_waitingPanelsTimer, &QTimer::timeout, this, &ShellCorona::createWaitingPanels); connect(&m_waitingPanelsTimer, &QTimer::timeout, this, &ShellCorona::createWaitingPanels);
#ifndef NDEBUG #ifndef NDEBUG
m_invariantsTimer.setSingleShot(true); m_invariantsTimer.setSingleShot(true);
m_invariantsTimer.setInterval(250); m_invariantsTimer.setInterval(250ms);
connect(&m_invariantsTimer, &QTimer::timeout, this, &ShellCorona::screenInvariants); connect(&m_invariantsTimer, &QTimer::timeout, this, &ShellCorona::screenInvariants);
#endif #endif

Loading…
Cancel
Save