refactor:move Importer to "layouts" folder

pull/5/head
Michail Vourlakos 6 years ago
parent d426ecb50f
commit 8c3d658a0d

@ -2,7 +2,6 @@ set(lattedock-app_SRCS
../liblatte2/commontools.cpp
../liblatte2/types.cpp
alternativeshelper.cpp
importer.cpp
infoview.cpp
lattecorona.cpp
schemecolors.cpp

@ -20,7 +20,7 @@
#include "factory.h"
// local
#include "../importer.h"
#include "../layouts/importer.h"
// Qt
#include <QDebug>
@ -49,7 +49,7 @@ Factory::Factory(QObject *parent)
{
m_parentWidget = new QWidget();
m_watchedPaths = Latte::Importer::standardPaths();
m_watchedPaths = Latte::Layouts::Importer::standardPaths();
for(int i=0; i<m_watchedPaths.count(); ++i) {
m_watchedPaths[i] = m_watchedPaths[i] + "/latte/indicators";
@ -242,7 +242,7 @@ Latte::Types::ImportExportState Factory::importIndicatorFile(QString compressedF
KPluginMetaData metadata = KPluginMetaData::fromDesktopFile(metadataFile);
if (metadataAreValid(metadata)) {
QStringList standardPaths = Latte::Importer::standardPaths();
QStringList standardPaths = Latte::Layouts::Importer::standardPaths();
QString installPath = standardPaths[0] + "/latte/indicators/" + metadata.pluginId();
bool updated{QDir(installPath).exists()};

@ -22,13 +22,13 @@
// local
#include "alternativeshelper.h"
#include "importer.h"
#include "lattedockadaptor.h"
#include "screenpool.h"
#include "indicator/factory.h"
#include "layout/centrallayout.h"
#include "layout/genericlayout.h"
#include "layout/sharedlayout.h"
#include "layouts/importer.h"
#include "layouts/manager.h"
#include "layouts/launcherssignals.h"
#include "shortcuts/globalshortcuts.h"

@ -22,9 +22,9 @@
// local
#include "sharedlayout.h"
#include "importer.h"
#include "../lattecorona.h"
#include "../screenpool.h"
#include "../layouts/importer.h"
#include "../layouts/manager.h"
#include "../settings/universalsettings.h"
#include "../view/view.h"
@ -199,7 +199,7 @@ QString CentralLayout::sharedLayoutName() const
void CentralLayout::setSharedLayoutName(QString name)
{
if (m_sharedLayoutName == name || (!Importer::layoutExists(name) && !name.isEmpty())) {
if (m_sharedLayoutName == name || (!Layouts::Importer::layoutExists(name) && !name.isEmpty())) {
return;
}
@ -255,7 +255,7 @@ void CentralLayout::loadConfig()
QString sharedLayoutName = m_layoutGroup.readEntry("sharedLayout", QString());
if (Importer::layoutExists(sharedLayoutName)) {
if (Layouts::Importer::layoutExists(sharedLayoutName)) {
m_sharedLayoutName = sharedLayoutName;
}

@ -22,9 +22,9 @@
// local
#include "abstractlayout.h"
#include "storage.h"
#include "../importer.h"
#include "../lattecorona.h"
#include "../screenpool.h"
#include "../layouts/importer.h"
#include "../layouts/manager.h"
#include "../shortcuts/shortcutstracker.h"
#include "../view/view.h"
@ -597,8 +597,8 @@ void GenericLayout::renameLayout(QString newName)
return;
}
if (m_layoutFile != Importer::layoutFilePath(newName)) {
setFile(Importer::layoutFilePath(newName));
if (m_layoutFile != Layouts::Importer::layoutFilePath(newName)) {
setFile(Layouts::Importer::layoutFilePath(newName));
}
setName(newName);

@ -20,10 +20,10 @@
#include "storage.h"
// local
#include "../importer.h"
#include "../lattecorona.h"
#include "../screenpool.h"
#include "../layouts/manager.h"
#include "../layouts/importer.h"
#include "../view/view.h"
// Qt
#include <QDir>
@ -615,7 +615,7 @@ bool Storage::layoutIsBroken() const
qDebug() << " --- storaged file : " << m_layout->file();
} else {
if (m_layout->corona()->layoutsManager()->memoryUsage() == Types::MultipleLayouts) {
qDebug() << " --- in multiple layouts hidden file : " << Importer::layoutFilePath(AbstractLayout::MultipleLayoutsName);
qDebug() << " --- in multiple layouts hidden file : " << Layouts::Importer::layoutFilePath(AbstractLayout::MultipleLayoutsName);
} else {
qDebug() << " --- in active layout file : " << m_layout->file();
}

@ -1,5 +1,6 @@
set(lattedock-app_SRCS
${lattedock-app_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/importer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/launcherssignals.cpp
${CMAKE_CURRENT_SOURCE_DIR}/manager.cpp
PARENT_SCOPE

@ -21,11 +21,11 @@
#include "importer.h"
// local
#include "lattecorona.h"
#include "screenpool.h"
#include "layout/abstractlayout.h"
#include "layouts/manager.h"
#include "settings/universalsettings.h"
#include "manager.h"
#include "../lattecorona.h"
#include "../screenpool.h"
#include "../layout/abstractlayout.h"
#include "../settings/universalsettings.h"
#include "../liblatte2/types.h"
// Qt
@ -41,6 +41,7 @@
#include <KNotification>
namespace Latte {
namespace Layouts {
Importer::Importer(QObject *parent)
: QObject(parent)
@ -641,3 +642,4 @@ QStringList Importer::checkRepairMultipleLayoutsLinkedFile()
}
}
}

@ -31,6 +31,7 @@ class Manager;
}
namespace Latte {
namespace Layouts {
//! This class is responsible to import/export configurations
//! and of course to import old configuration to new architecture
@ -106,6 +107,7 @@ private:
Layouts::Manager *m_manager;
};
}
}
#endif // IMPORTER_H

@ -23,8 +23,8 @@
#include "manager.h"
// local
#include "importer.h"
#include "launcherssignals.h"
#include "../importer.h"
#include "../infoview.h"
#include "../screenpool.h"
#include "../layout/abstractlayout.h"

@ -44,7 +44,6 @@ class Controller;
namespace Latte {
class Corona;
class Importer;
class CentralLayout;
class SharedLayout;
class View;
@ -52,6 +51,7 @@ namespace Layout {
class GenericLayout;
}
namespace Layouts {
class Importer;
class LaunchersSignals;
}
}

@ -20,8 +20,8 @@
// local
#include "config-latte.h"
#include "importer.h"
#include "lattecorona.h"
#include "layouts/importer.h"
#include "../liblatte2/types.h"
// C++
@ -146,7 +146,7 @@ int main(int argc, char **argv)
//! print available-layouts
if (parser.isSet(QStringLiteral("available-layouts"))) {
QStringList layouts = Latte::Importer::availableLayouts();
QStringList layouts = Latte::Layouts::Importer::availableLayouts();
if (layouts.count() > 0) {
qInfo() << i18n("Available layouts that can be used to start Latte:");
@ -172,7 +172,7 @@ int main(int argc, char **argv)
} else if (parser.isSet(QStringLiteral("layout"))) {
layoutNameOnStartup = parser.value(QStringLiteral("layout"));
if (!Latte::Importer::layoutExists(layoutNameOnStartup)) {
if (!Latte::Layouts::Importer::layoutExists(layoutNameOnStartup)) {
qInfo() << i18nc("layout missing", "This layout doesn't exist in the system.");
qGuiApp->exit();
return 0;
@ -216,7 +216,7 @@ int main(int argc, char **argv)
//! import-full option
if (parser.isSet(QStringLiteral("import-full"))) {
bool imported = Latte::Importer::importHelper(parser.value(QStringLiteral("import-full")));
bool imported = Latte::Layouts::Importer::importHelper(parser.value(QStringLiteral("import-full")));
if (!imported) {
qInfo() << i18n("The configuration cannot be imported");
@ -227,7 +227,7 @@ int main(int argc, char **argv)
//! import-layout option
if (parser.isSet(QStringLiteral("import-layout"))) {
QString importedLayout = Latte::Importer::importLayoutHelper(parser.value(QStringLiteral("import-layout")));
QString importedLayout = Latte::Layouts::Importer::importLayoutHelper(parser.value(QStringLiteral("import-layout")));
if (importedLayout.isEmpty()) {
qInfo() << i18n("The layout cannot be imported");

@ -23,7 +23,7 @@
// local
#include "lattecorona.h"
#include "schemecolors.h"
#include "../../importer.h"
#include "../../layouts/importer.h"
#include "../../view/panelshadows_p.h"
#include "../../../liblatte2/commontools.h"
@ -395,12 +395,12 @@ void Theme::loadRoundness()
void Theme::loadThemePaths()
{
m_themePath = Importer::standardPath("plasma/desktoptheme/" + m_theme.themeName());
m_themePath = Layouts::Importer::standardPath("plasma/desktoptheme/" + m_theme.themeName());
if (QDir(m_themePath+"/widgets").exists()) {
m_themeWidgetsPath = m_themePath + "/widgets";
} else {
m_themeWidgetsPath = Importer::standardPath("plasma/desktoptheme/default/widgets");
m_themeWidgetsPath = Layouts::Importer::standardPath("plasma/desktoptheme/default/widgets");
}
qDebug() << "current plasma theme ::: " << m_theme.themeName();

@ -21,7 +21,7 @@
#include "schemecolors.h"
// local
#include "importer.h"
#include "layouts/importer.h"
// Qt
#include <QDebug>
@ -166,13 +166,13 @@ QString SchemeColors::possibleSchemeFile(QString scheme)
}
}
QString schemePath = Importer::standardPath("color-schemes/" + tempScheme + ".colors");
QString schemePath = Layouts::Importer::standardPath("color-schemes/" + tempScheme + ".colors");
if (schemePath.isEmpty() || !QFileInfo(schemePath).exists()) {
//! remove all whitespaces and "-" from scheme in order to access correctly its file
QString schemeNameSimplified = tempScheme.simplified().remove(" ").remove("-");
schemePath = Importer::standardPath("color-schemes/" + schemeNameSimplified + ".colors");
schemePath = Layouts::Importer::standardPath("color-schemes/" + schemeNameSimplified + ".colors");
}
if (QFileInfo(schemePath).exists()) {

@ -22,13 +22,13 @@
#include "settingsdialog.h"
// local
#include "importer.h"
#include "universalsettings.h"
#include "ui_settingsdialog.h"
#include "../lattecorona.h"
#include "../layout/genericlayout.h"
#include "../layout/centrallayout.h"
#include "../layout/sharedlayout.h"
#include "../layouts/importer.h"
#include "../layouts/manager.h"
#include "../liblatte2/types.h"
#include "../plasma/extended/theme.h"
@ -415,9 +415,9 @@ void SettingsDialog::on_downloadButton_clicked()
if (!dialog.changedEntries().isEmpty() || !dialog.installedEntries().isEmpty()) {
for (const auto &entry : dialog.installedEntries()) {
for (const auto &entryFile : entry.installedFiles()) {
Importer::LatteFileVersion version = Importer::fileVersion(entryFile);
Layouts::Importer::LatteFileVersion version = Layouts::Importer::fileVersion(entryFile);
if (version == Importer::LayoutVersion2) {
if (version == Layouts::Importer::LayoutVersion2) {
layoutAdded = true;
addLayoutForFile(entryFile);
break;
@ -538,12 +538,12 @@ void SettingsDialog::on_importButton_clicked()
connect(fileDialog, &QFileDialog::fileSelected
, this, [&](const QString & file) {
Importer::LatteFileVersion version = Importer::fileVersion(file);
Layouts::Importer::LatteFileVersion version = Layouts::Importer::fileVersion(file);
qDebug() << "VERSION :::: " << version;
if (version == Importer::LayoutVersion2) {
if (version == Layouts::Importer::LayoutVersion2) {
addLayoutForFile(file);
} else if (version == Importer::ConfigVersion1) {
} else if (version == Layouts::Importer::ConfigVersion1) {
auto msg = new QMessageBox(this);
msg->setIcon(QMessageBox::Warning);
msg->setWindowTitle(i18n("Import: Configuration file version v0.1"));
@ -578,7 +578,7 @@ void SettingsDialog::on_importButton_clicked()
QProcess::startDetached(qGuiApp->applicationFilePath() + " --import-full \"" + file + "\"");
qGuiApp->exit();
});
} else if (version == Importer::ConfigVersion2) {
} else if (version == Layouts::Importer::ConfigVersion2) {
auto msg = new QMessageBox(this);
msg->setIcon(QMessageBox::Warning);
msg->setWindowTitle(i18n("Import: Configuration file version v0.2"));
@ -619,7 +619,7 @@ bool SettingsDialog::importLayoutsFromV1ConfigFile(QString file)
fileEntry->copyTo(tempDir.absolutePath());
}
QString name = Importer::nameOfConfigFile(file);
QString name = Layouts::Importer::nameOfConfigFile(file);
QString applets(tempDir.absolutePath() + "/" + "lattedock-appletsrc");

@ -21,7 +21,7 @@
#include "universalsettings.h"
// local
#include "../importer.h"
#include "../layouts/importer.h"
#include "../layouts/manager.h"
// Qt
@ -243,7 +243,7 @@ void UniversalSettings::setAutostart(bool state)
//! end of removal of old autostart file
QFile autostartFile(QDir::homePath() + "/.config/autostart/org.kde.latte-dock.desktop");
QFile metaFile(Importer::standardPath("applications", false)+"/org.kde.latte-dock.desktop");
QFile metaFile(Layouts::Importer::standardPath("applications", false)+"/org.kde.latte-dock.desktop");
if (!state && autostartFile.exists()) {
//! the first time that the user disables the autostart, this is recorded

Loading…
Cancel
Save