chore: mainwidow

Description: 优化打印代码

Log: 优化打印代码
This commit is contained in:
zhoubin 2024-04-13 15:05:25 +08:00
parent e7f6afa2d4
commit 462a943b8c
3 changed files with 3 additions and 22 deletions

View File

@ -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<CommonInterface *>(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",

View File

@ -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<char *> list , QString name);
bool isExitsCloudAccount();
bool isExitsPower();
bool isExitWirelessDevice();
bool dblOnEdge(QMouseEvent *event);
void initStyleSheet();

View File

@ -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() != "") {