diff --git a/resources/icons/ccc-app-manager_56px.svg b/resources/icons/ccc-app-manager_56px.svg index 6fc5f5a858c569928c684144d61fb5dd63a5a346..8bbd9ceb83435b977fda58a3f0ae03797526a304 100644 --- a/resources/icons/ccc-app-manager_56px.svg +++ b/resources/icons/ccc-app-manager_56px.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/appmanagermodel.cpp b/src/appmanagermodel.cpp index e3d6cb25a623f7113900f77e8fdcbd909d6f5329..edc1b2a713f4a7fbe5afcc4496ca3b4f14fa204a 100644 --- a/src/appmanagermodel.cpp +++ b/src/appmanagermodel.cpp @@ -29,6 +29,11 @@ AppManagerModel::~AppManagerModel() m_appManagerJob = nullptr; } +bool AppManagerModel::IsInGxdeOs() +{ + return m_osId == GxdeOsId; +} + RunningStatus AppManagerModel::getRunningStatus() { return m_appManagerJob->getRunningStatus(); @@ -279,6 +284,8 @@ void AppManagerModel::initData() m_appManagerJobThread = new QThread; m_appManagerJob = new AppManagerJob; m_appManagerJob->moveToThread(m_appManagerJobThread); + + readOsInfo(); } void AppManagerModel::initConnection() @@ -333,3 +340,11 @@ void AppManagerModel::postInit() // 启动线程 m_appManagerJobThread->start(); } + +void AppManagerModel::readOsInfo() +{ + QSettings readIniSettingMethod("/etc/os-release", QSettings::Format::IniFormat); + QTextCodec *textCodec = QTextCodec::codecForName("UTF-8"); + readIniSettingMethod.setIniCodec(textCodec); + m_osId = readIniSettingMethod.value("ID").toString(); +} diff --git a/src/appmanagermodel.h b/src/appmanagermodel.h index f10949d3c677b0c590be60632b711ca96861a838..5b0b8daa0dedaaac4e26151ce54a9679c50088d6 100644 --- a/src/appmanagermodel.h +++ b/src/appmanagermodel.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include DCORE_USE_NAMESPACE @@ -23,6 +25,8 @@ public: explicit AppManagerModel(QObject *parent = nullptr); virtual ~AppManagerModel() override; + bool IsInGxdeOs(); + RunningStatus getRunningStatus(); QList getAppInfosList(); @@ -86,8 +90,10 @@ private: void initData(); void initConnection(); void postInit(); + void readOsInfo(); private: AppManagerJob *m_appManagerJob; QThread *m_appManagerJobThread; + QString m_osId; }; diff --git a/src/common/appmanagercommon.h b/src/common/appmanagercommon.h index 7caa491a388d1e9f6f7874669cb272c2ad6bd10a..d051abfd0add9764d407de2f547c4ce734b38dc7 100644 --- a/src/common/appmanagercommon.h +++ b/src/common/appmanagercommon.h @@ -31,6 +31,9 @@ // 包名格式化字符串 #define PKG_NAME_FORMAT_STR "%1_%2_%3.deb" +// GXDE OS 识别号 +const QString GxdeOsId = "GXDE"; + namespace AM { // 运行状态 enum RunningStatus { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a410c1b120ef994f7c6642c9b4e020d80d46fd93..41f9fcda4e229984fc35a78e2c5aee164a92a58c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -32,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) // setTitlebarShadowEnabled(false); setFocusPolicy(Qt::FocusPolicy::ClickFocus); + m_appManagerModel = new AppManagerModel(this); + QMenuBar *menuBar = this->menuBar(); m_mainMenu = new QMenu(this); m_mainMenu->setTitle("打开"); @@ -56,7 +58,10 @@ MainWindow::MainWindow(QWidget *parent) m_centralWidgetBlurBg->lower(); // 判断系统是否是deepin - m_isDeepin = DSysInfo::isDeepin(); + m_isDeepin = DSysInfo::isDeepin(); + if (m_appManagerModel->IsInGxdeOs()) { + m_isDeepin = true; + } DFrame *centralWidget = new DFrame(this); QPalette pa = centralWidget->palette(); @@ -82,7 +87,6 @@ MainWindow::MainWindow(QWidget *parent) mainLayout->addLayout(contentLayout, 1); // 应用管理 - m_appManagerModel = new AppManagerModel(this); m_appManagerWidget = new AppManagerWidget(m_appManagerModel, this); contentLayout->addWidget(m_appManagerWidget);