From 462a943b8c4aa519168cf0d95b80860fa6ea7f76 Mon Sep 17 00:00:00 2001 From: zhoubin Date: Sat, 13 Apr 2024 15:05:25 +0800 Subject: [PATCH] chore: mainwidow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 优化打印代码 Log: 优化打印代码 --- shell/mainwindow.cpp | 22 ++-------------------- shell/mainwindow.h | 2 -- shell/searchwidget.cpp | 1 + 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp index af57760..8adf251 100644 --- a/shell/mainwindow.cpp +++ b/shell/mainwindow.cpp @@ -83,7 +83,6 @@ MainWindow::MainWindow(QWidget *parent) : { qApp->installEventFilter(this); qApp->setStyle(new InternalStyle("ukui")); - is_ExitPower = isExitsPower(); pluginPathList = FunctionSelect::listExistsCustomNoticePath(PLUGINS_PATH); if (UkccCommon::isOpenkylin()) { connect(WindowManager::self(),&WindowManager::windowAdded,this,[=](const WindowId& windowId){ @@ -641,23 +640,19 @@ void MainWindow::determinePlugin(const QString &fileName, const QDir &dir) return; } #endif - qDebug() << "Scan Plugin: " << fileName; - if (!fileName.endsWith(".so") || - ("libpower.so" == fileName && !is_ExitPower)) { - return; - } + QPluginLoader loader(pluginPath); QObject * plugin = loader.instance(); if (plugin) { QtConcurrent::run([=]{ CommonInterface * pluginInstance = qobject_cast(plugin); + qDebug() << "Load Plugin : " << pluginInstance->name() << "isEnable:" << pluginInstance->isEnable(); // 插件是否启用 if (!pluginInstance || !pluginInstance->isEnable() || !fileName.endsWith("so")) { return; } - qDebug() << "Load Plugin :" << pluginInstance->plugini18nName(); QGSettings *pluginSettings = setGsettingsPath(pluginPathList, pluginInstance->name()); vecGsettins.insert(pluginInstance->name(), pluginSettings); @@ -880,19 +875,6 @@ bool MainWindow::isExitsCloudAccount() { return false; } -bool MainWindow::isExitsPower() -{ - QProcess *process = new QProcess; - process->start("dpkg -l ukui-power-manager"); - process->waitForFinished(); - - QByteArray ba = process->readAllStandardOutput(); - delete process; - QString mOutput = QString(ba.data()); - - return mOutput.contains("ii", Qt::CaseSensitive) ? true : false; -} - bool MainWindow::isExitWirelessDevice() { QDBusInterface *interface = new QDBusInterface("com.kylin.network", "/com/kylin/network", diff --git a/shell/mainwindow.h b/shell/mainwindow.h index 87aabda..4f9c398 100644 --- a/shell/mainwindow.h +++ b/shell/mainwindow.h @@ -103,7 +103,6 @@ private: QStringList m_updatePlugins; QVariantMap m_ModuleMap; QGSettings *m_fontSetting; - bool is_ExitPower = false; QHBoxLayout *titleLayout; KNavigationBar *scrollArea = nullptr; @@ -131,7 +130,6 @@ private: void initLeftsideBar(); QGSettings *setGsettingsPath(QList list , QString name); bool isExitsCloudAccount(); - bool isExitsPower(); bool isExitWirelessDevice(); bool dblOnEdge(QMouseEvent *event); void initStyleSheet(); diff --git a/shell/searchwidget.cpp b/shell/searchwidget.cpp index 7d0a615..b04ec65 100644 --- a/shell/searchwidget.cpp +++ b/shell/searchwidget.cpp @@ -45,6 +45,7 @@ SearchWidget::SearchWidget(QWidget *parent) m_completer->setCaseSensitivity(Qt::CaseInsensitive);//这个属性可设置进行匹配时的大小写敏感性 m_completer->setCompletionRole(Qt::UserRole); //设置ItemDataRole m_completer->setWrapAround(false); + m_completer->popup()->setWindowFlags(Qt::ToolTip); connect(this, &QLineEdit::textEdited, this, [ = ] { if (text() != "") {