Skip to content

Commit

Permalink
feat: Control Center-General Module Design and Transformation
Browse files Browse the repository at this point in the history
Log: Control Center-General Module Requirements Development

Task: https://pms.uniontech.com/task-view-364169.html
  • Loading branch information
swq authored and deepin-bot[bot] committed Oct 11, 2024
1 parent 54018e9 commit 042d344
Show file tree
Hide file tree
Showing 23 changed files with 1,939 additions and 13 deletions.
8 changes: 8 additions & 0 deletions src/plugin-commoninfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.18)
set(CommonInfo_Name commonInfo)

pkg_check_modules(DEEPIN_PW_CHECK REQUIRED libdeepin_pw_check)


file(GLOB_RECURSE commonInfo_SRCS
"operation/*.cpp"
"operation/*.h"
Expand All @@ -8,16 +12,20 @@ file(GLOB_RECURSE commonInfo_SRCS

add_library(${CommonInfo_Name} MODULE
${commonInfo_SRCS}
operation/grubmenulistmodel.h
operation/grubmenulistmodel.cpp
)

set(CommonInfo_Libraries
dde-control-center
${DEEPIN_PW_CHECK_INCLUDE_DIRS}
${QT_NS}::DBus
${DTK_NS}::Gui
)

target_link_libraries(${CommonInfo_Name} PRIVATE
${CommonInfo_Libraries}
${DEEPIN_PW_CHECK_LIBRARIES}
)

dcc_install_plugin(NAME ${CommonInfo_Name} TARGET ${CommonInfo_Name})
47 changes: 47 additions & 0 deletions src/plugin-commoninfo/operation/commoninfointeraction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
//SPDX-License-Identifier: GPL-3.0-or-later

#include "commoninfointeraction.h"
#include "dccfactory.h"

#include <QtQml/qqml.h>

CommonInfoInteraction::CommonInfoInteraction(QObject *parent)
: QObject{ parent }
, m_work(NULL)
, m_mode(NULL)
{
qmlRegisterType<CommonInfoWork>("org.deepin.dcc.systemInfo", 1, 0, "CommonInfoWork");
qmlRegisterType<CommonInfoModel>("org.deepin.dcc.systemInfo", 1, 0, "CommonInfoModel");

m_mode = new CommonInfoModel(this);
m_work = new CommonInfoWork(m_mode, this);

m_work->active();
}

CommonInfoWork *CommonInfoInteraction::work() const
{
return m_work;
}

void CommonInfoInteraction::setWork(CommonInfoWork *newWork)
{
m_work = newWork;
}

CommonInfoModel *CommonInfoInteraction::mode() const
{
return m_mode;
}

void CommonInfoInteraction::setMode(CommonInfoModel *newMode)
{
m_mode = newMode;
}

DCC_FACTORY_CLASS(CommonInfoInteraction)


#include "commoninfointeraction.moc"
33 changes: 33 additions & 0 deletions src/plugin-commoninfo/operation/commoninfointeraction.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
//SPDX-License-Identifier: GPL-3.0-or-later

#ifndef COMMONINFOINTERACTION_H
#define COMMONINFOINTERACTION_H

#include "commoninfomodel.h"
#include "commoninfowork.h"

#include <QObject>

class CommonInfoInteraction : public QObject
{
Q_OBJECT
public:
explicit CommonInfoInteraction(QObject *parent = nullptr);

Q_INVOKABLE CommonInfoWork *work() const;
void setWork(CommonInfoWork *newWork);

Q_INVOKABLE CommonInfoModel *mode() const;
void setMode(CommonInfoModel *newMode);

signals:


private:
CommonInfoWork* m_work;
CommonInfoModel* m_mode;
};

#endif // COMMONINFOINTERACTION_H
37 changes: 35 additions & 2 deletions src/plugin-commoninfo/operation/commoninfomodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include "commoninfomodel.h"

#include <QDebug>

using namespace DCC_NAMESPACE;
#include <dtk5/DCore/DSysInfo>

CommonInfoModel::CommonInfoModel(QObject *parent)
: QObject(parent)
Expand All @@ -16,6 +15,9 @@ CommonInfoModel::CommonInfoModel(QObject *parent)
, m_activation(false)
, m_plymouthscale(0)
, m_plymouththeme(QString())
, m_GrubAnimationModel(new GrubAnimationModel(this))
, m_GrubMenuListModel(new GrubMenuListModel(this))
, m_debugLogCurrentIndex(0)
{
}

Expand Down Expand Up @@ -54,6 +56,8 @@ void CommonInfoModel::setDefaultEntry(const QString &entry)
m_defaultEntry = entry;
Q_EMIT defaultEntryChanged(entry);
}

m_GrubMenuListModel->updateCheckIndex(m_defaultEntry);
}

void CommonInfoModel::setUpdating(bool updating)
Expand Down Expand Up @@ -136,6 +140,7 @@ void CommonInfoModel::setPlymouthScale(int scale)
{
m_plymouthscale = scale;

m_GrubAnimationModel->updateCheckIndex(scale, false);
Q_EMIT plymouthScaleChanged(scale);
}

Expand All @@ -145,3 +150,31 @@ void CommonInfoModel::setPlymouthTheme(const QString &themeName)

Q_EMIT plymouthThemeChanged(themeName);
}

int CommonInfoModel::debugLogCurrentIndex() const
{
return m_debugLogCurrentIndex;
}

void CommonInfoModel::setDebugLogCurrentIndex(int newDebugLogCurrentIndex)
{
if (m_debugLogCurrentIndex == newDebugLogCurrentIndex)
return;
m_debugLogCurrentIndex = newDebugLogCurrentIndex;
emit debugLogCurrentIndexChanged();
}

GrubAnimationModel *CommonInfoModel::grubAnimationModel()
{
return m_GrubAnimationModel;
}

GrubMenuListModel * CommonInfoModel::grubMenuListModel()
{
return m_GrubMenuListModel;
}

bool CommonInfoModel::isCommunitySystem() const
{
return Dtk::Core::DSysInfo::UosCommunity == Dtk::Core::DSysInfo::DSysInfo::uosEditionType();
}
38 changes: 34 additions & 4 deletions src/plugin-commoninfo/operation/commoninfomodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,38 @@
//SPDX-License-Identifier: GPL-3.0-or-later
#pragma once

#include "grubanimationmodel.h"
#include "grubmenulistmodel.h"

#include <QtQml/qqml.h>
#include <QObject>
#include <QPixmap>

namespace DCC_NAMESPACE {
class CommonInfoModel : public QObject
{
Q_OBJECT

QML_NAMED_ELEMENT(CommonInfoModel)
QML_SINGLETON

Q_PROPERTY(bool bootDelay READ bootDelay NOTIFY bootDelayChanged FINAL)
Q_PROPERTY(bool themeEnabled READ themeEnabled NOTIFY themeEnabledChanged FINAL)
Q_PROPERTY(bool grubEditAuthEnabled READ grubEditAuthEnabled NOTIFY grubEditAuthEnabledChanged FINAL)
Q_PROPERTY(int debugLogCurrentIndex READ debugLogCurrentIndex NOTIFY debugLogCurrentIndexChanged FINAL)
Q_PROPERTY(bool developerModeState READ developerModeState NOTIFY developerModeStateChanged FINAL)
Q_PROPERTY(bool isLogin READ isLogin NOTIFY isLoginChenged FINAL)
Q_PROPERTY(bool isActivate READ isActivate NOTIFY LicenseStateChanged FINAL)

public:
explicit CommonInfoModel(QObject *parent = nullptr);

void setEntryLists(const QStringList &list);
inline QStringList entryLists() const { return m_entryLists;}
inline QString defaultEntry() const { return m_defaultEntry;}
bool bootDelay() const;
inline bool themeEnabled() const { return m_themeEnabled; }
bool themeEnabled() const { return m_themeEnabled; }
inline bool isShowGrubEditAuth() { return m_isShowGrubEditAuth; }
inline bool grubEditAuthEnabled() { return m_grubEditAuthEnabled; }
bool grubEditAuthEnabled() { return m_grubEditAuthEnabled; }
inline bool updating() const { return m_updating; }
QPixmap background() const;
void setBackground(const QPixmap &background);
Expand All @@ -31,6 +46,13 @@ class CommonInfoModel : public QObject
inline int plymouthScale() const { return m_plymouthscale; }
inline QString plymouthTheme() const { return m_plymouththeme; }

Q_INVOKABLE GrubAnimationModel *grubAnimationModel();
Q_INVOKABLE GrubMenuListModel *grubMenuListModel();
Q_INVOKABLE bool isCommunitySystem() const;

int debugLogCurrentIndex() const;
void setDebugLogCurrentIndex(int newDebugLogCurrentIndex);

Q_SIGNALS:
void bootDelayChanged(const bool enabled) const;
void themeEnabledChanged(const bool enabled) const;
Expand All @@ -46,6 +68,10 @@ class CommonInfoModel : public QObject
void plymouthScaleChanged(int scale);
void plymouthThemeChanged(const QString &themeName);

void GrubAnimationModelChanged();

void debugLogCurrentIndexChanged();

public Q_SLOTS:
void setBootDelay(bool bootDelay);
void setThemeEnabled(const bool enabled);
Expand Down Expand Up @@ -74,5 +100,9 @@ public Q_SLOTS:
bool m_activation;
int m_plymouthscale;
QString m_plymouththeme;

GrubAnimationModel* m_GrubAnimationModel;
GrubMenuListModel* m_GrubMenuListModel;

int m_debugLogCurrentIndex;
};
} // namespace DCC_NAMESPACE
Loading

0 comments on commit 042d344

Please sign in to comment.