File indexing completed on 2024-12-22 04:28:07

0001 /*
0002   SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "textautocorrectioncore_export.h"
0010 #include "textautocorrectionsetting_base.h"
0011 
0012 class QTimer;
0013 
0014 namespace TextAutoCorrectionCore
0015 {
0016 /**
0017  * @brief The TextAutoCorrectionSettings class
0018  * @author Laurent Montel <montel@kde.org>
0019  */
0020 class TEXTAUTOCORRECTIONCORE_EXPORT TextAutoCorrectionSettings : public TextAutoCorrectionCore::TextAutoCorrectionSettingsBase
0021 {
0022     Q_OBJECT
0023 public:
0024     static TextAutoCorrectionSettings *self();
0025 
0026     /** Call this slot instead of directly @ref KConfig::sync() to
0027       minimize the overall config writes. Calling this slot will
0028       schedule a sync of the application config file using a timer, so
0029       that many consecutive calls can be condensed into a single
0030       sync, which is more efficient. */
0031     void requestSync();
0032 
0033 private Q_SLOTS:
0034     TEXTAUTOCORRECTIONCORE_NO_EXPORT void slotSyncNow();
0035 
0036 private:
0037     TEXTAUTOCORRECTIONCORE_NO_EXPORT TextAutoCorrectionSettings();
0038     ~TextAutoCorrectionSettings() override;
0039     static TextAutoCorrectionSettings *mSelf;
0040 
0041     QTimer *mConfigSyncTimer = nullptr;
0042 };
0043 }