File indexing completed on 2024-11-10 04:56:49

0001 /*
0002     SPDX-FileCopyrightText: 2021 Cyril Rossi <cyril.rossi@enioka.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "virtualdesktopsdata.h"
0008 
0009 #include "animationsmodel.h"
0010 #include "desktopsmodel.h"
0011 #include "virtualdesktopssettings.h"
0012 
0013 namespace KWin
0014 {
0015 
0016 VirtualDesktopsData::VirtualDesktopsData(QObject *parent)
0017     : KCModuleData(parent)
0018     , m_settings(new VirtualDesktopsSettings(this))
0019     , m_desktopsModel(new DesktopsModel(this))
0020     , m_animationsModel(new AnimationsModel(this))
0021 {
0022     // Default behavior of KCModuleData is to emit loaded signal after being initialized.
0023     // To handle asynchronous load of EffectsModel we disable default behavior and
0024     // emit loaded signal when EffectsModel is actually loaded.
0025     disconnect(this, &KCModuleData::aboutToLoad, nullptr, nullptr);
0026     connect(m_animationsModel, &EffectsModel::loaded, this, &KCModuleData::loaded);
0027 
0028     m_desktopsModel->load();
0029     m_animationsModel->load();
0030 }
0031 
0032 bool VirtualDesktopsData::isDefaults() const
0033 {
0034     return m_animationsModel->isDefaults() && m_desktopsModel->isDefaults() && m_settings->isDefaults();
0035 }
0036 
0037 VirtualDesktopsSettings *VirtualDesktopsData::settings() const
0038 {
0039     return m_settings;
0040 }
0041 
0042 DesktopsModel *VirtualDesktopsData::desktopsModel() const
0043 {
0044     return m_desktopsModel;
0045 }
0046 
0047 AnimationsModel *VirtualDesktopsData::animationsModel() const
0048 {
0049     return m_animationsModel;
0050 }
0051 
0052 }
0053 
0054 #include "moc_virtualdesktopsdata.cpp"