代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/ukui-menu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 98c95850ccc70d0a1547f07808073a735318c5a8 Mon Sep 17 00:00:00 2001
From: liuhao-startmenu <liuhao@kylinos.cn>
Date: Wed, 1 Apr 2020 11:59:53 +0800
Subject: [PATCH 2/2] Optimize the interaction strategy with the taskbar
---
main.cpp | 16 +-
src/Interface/ukuimenuinterface.cpp | 10 +-
src/LetterWidget/fullletterwidget.cpp | 6 +-
src/LetterWidget/letterbuttonwidget.cpp | 6 +-
src/MainViewWidget/mainviewwidget.cpp | 12 +-
src/MainWindow/mainwindow.cpp | 98 ++++--------
src/MainWindow/mainwindow.h | 2 +-
.../qtsingleapplication.cpp | 10 +-
src/RightClickMenu/rightclickmenu.cpp | 29 ++--
src/RightClickMenu/rightclickmenu.h | 8 +-
src/SideBarWidget/sidebarwidget.cpp | 142 +-----------------
src/Style/style.cpp | 19 +--
src/UtilityFunction/fullitemdelegate.cpp | 6 +-
src/UtilityFunction/fulllistview.cpp | 5 +-
.../functionclassifybutton.cpp | 36 ++---
src/UtilityFunction/itemdelegate.cpp | 6 +-
src/UtilityFunction/listview.cpp | 7 +-
src/UtilityFunction/pushbutton.cpp | 6 +-
18 files changed, 117 insertions(+), 307 deletions(-)
diff --git a/main.cpp b/main.cpp
index 4b9761d..0975c73 100644
--- a/main.cpp
+++ b/main.cpp
@@ -40,6 +40,12 @@ int main(int argc, char *argv[])
qss.open(QFile::ReadOnly);
qApp->setStyleSheet(qss.readAll());
+// QGSettings* setting=new QGSettings(QString("org.mate.interface").toLocal8Bit());
+// QString value=setting->get("font-name").toString();
+// QFont font;
+// font.setFamily(value);
+// qApp->setFont(font);
+
QString locale = QLocale::system().name();
QTranslator translator;
if (locale == "zh_CN"){
@@ -57,13 +63,9 @@ int main(int argc, char *argv[])
qApp->setStyleSheet(style);
MainWindow w;
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
-
- QDBusReply<int> position=iface.call("GetPanelPosition","");
- QDBusReply<int> panelSize=iface.call("GetPanelSize","");
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
+ int panelSize=gsetting->get("panelsize").toInt();
if(position==0)
w.setGeometry(QRect(0,Style::heightavailable-590,376,590));
else if(position==1)
diff --git a/src/Interface/ukuimenuinterface.cpp b/src/Interface/ukuimenuinterface.cpp
index c31893d..577873b 100644
--- a/src/Interface/ukuimenuinterface.cpp
+++ b/src/Interface/ukuimenuinterface.cpp
@@ -126,7 +126,6 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
recursiveSearchFile("/usr/share/applications/");
filePathList.removeAll("/usr/share/applications/peony-folder-handler.desktop");
- filePathList.removeAll("/usr/share/applications/peony.desktop");
filePathList.removeAll("/usr/share/applications/gnome-software-local-file.desktop");
filePathList.removeAll("/usr/share/applications/org.gnome.Software.Editor.desktop");
filePathList.removeAll("/usr/share/applications/apport-gtk.desktop");
@@ -159,7 +158,6 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
filePathList.removeAll("/usr/share/applications/remmina-gnome.desktop");
filePathList.removeAll("/usr/share/applications/ukwm.desktop");
filePathList.removeAll("/usr/share/applications/nm-applet.desktop");
- filePathList.removeAll("/usr/share/applications/peony-home.desktop");
filePathList.removeAll("/usr/share/applications/mate-user-guide.desktop");
filePathList.removeAll("/usr/share/applications/nm-connection-editor.desktop");
filePathList.removeAll("/usr/share/applications/pavucontrol-qt.desktop");
@@ -203,7 +201,13 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
filePathList.removeAll("/usr/share/applications/vim.desktop");
filePathList.removeAll("/usr/share/applications/kwalletmanager5-kwalletd.desktop");
filePathList.removeAll("/usr/share/applications/org.gnome.DejaDup.desktop");
-
+ filePathList.removeAll("/usr/share/applications/redshift.desktop");
+ filePathList.removeAll("/usr/share/applications/python3.8.desktop");
+ filePathList.removeAll("/usr/share/applications/yelp.desktop");
+ filePathList.removeAll("/usr/share/applications/peony-computer.desktop");
+ filePathList.removeAll("/usr/share/applications/peony-home.desktop");
+ filePathList.removeAll("/usr/share/applications/peony-trash.desktop");
+ filePathList.removeAll("/usr/share/applications/peony.desktop");
return filePathList;
}
diff --git a/src/LetterWidget/fullletterwidget.cpp b/src/LetterWidget/fullletterwidget.cpp
index 987b1e8..9fc863c 100644
--- a/src/LetterWidget/fullletterwidget.cpp
+++ b/src/LetterWidget/fullletterwidget.cpp
@@ -271,8 +271,8 @@ void FullLetterWidget::initLetterListScrollArea()
QToolButton:checked{background:transparent;color:#ffffff;border-radius:2px;}",
ClassifyBtnHoverBackground,ClassifyBtnHoverBackground);
- QFont font;
- font.setPixelSize(Style::LeftFontSize);
+// QFont font;
+// font.setPixelSize(Style::LeftFontSize);
QStringList letterbtnlist=this->letterbtnlist;
if(letterbtnlist.contains("&"))
@@ -284,7 +284,7 @@ void FullLetterWidget::initLetterListScrollArea()
letterbtn->setStyleSheet(btnstyle);
letterbtn->setFixedSize(Style::LeftBtnHeight,Style::LeftBtnHeight);
letterbtn->setCheckable(true);
- letterbtn->setFont(font);
+// letterbtn->setFont(font);
buttonList.append(letterbtn);
letterlistscrollareawidLayout->addWidget(letterbtn);
// connect(letterbtn,SIGNAL(clicked()),this,SLOT(letterBtnClickedSlot()));
diff --git a/src/LetterWidget/letterbuttonwidget.cpp b/src/LetterWidget/letterbuttonwidget.cpp
index 69a33c2..b5d5096 100644
--- a/src/LetterWidget/letterbuttonwidget.cpp
+++ b/src/LetterWidget/letterbuttonwidget.cpp
@@ -66,8 +66,8 @@ void LetterButtonWidget::initWidget()
letterlist.append("&&");
letterlist.append("#");
- QFont font;
- font.setPixelSize(Style::LeftFontSize);
+// QFont font;
+// font.setPixelSize(Style::LeftFontSize);
for(int row=0;row<6;row++)
{
for(int col=0;col<5;col++)
@@ -77,7 +77,7 @@ void LetterButtonWidget::initWidget()
QToolButton* btn=new QToolButton(this);
btn->setFixedSize(55,48);
btn->setStyleSheet(QString::fromLocal8Bit(btncolor));
- btn->setFont(font);
+// btn->setFont(font);
btn->setText(letterlist.at(row*5+col));
gridLayout->addWidget(btn,row,col);
connect(btn, SIGNAL(clicked()), this, SLOT(letterBtnClickedSlot()));
diff --git a/src/MainViewWidget/mainviewwidget.cpp b/src/MainViewWidget/mainviewwidget.cpp
index 19121cb..8a4f434 100644
--- a/src/MainViewWidget/mainviewwidget.cpp
+++ b/src/MainViewWidget/mainviewwidget.cpp
@@ -178,10 +178,10 @@ void MainViewWidget::initQueryLineEdit()
pQueryIcon->setStyleSheet("background:transparent");
pQueryIcon->setFixedSize(pixmap->size());
pQueryIcon->setPixmap(*pixmap);
- QFont font;
- font.setPixelSize(Style::QueryLineEditFontSize);
+// QFont font;
+// font.setPixelSize(Style::QueryLineEditFontSize);
pQueryText=new QLabel(pIconTextWid);
- pQueryText->setFont(font);
+// pQueryText->setFont(font);
pQueryText->setText(tr("Search"));
pQueryText->setStyleSheet("background:transparent;color:#626c6e;");
pQueryText->adjustSize();
@@ -203,8 +203,8 @@ void MainViewWidget::initQueryLineEdit()
bool MainViewWidget::eventFilter(QObject *watched, QEvent *event)
{
- QFont font;
- font.setPixelSize(Style::QueryLineEditFontSize);
+// QFont font;
+// font.setPixelSize(Style::QueryLineEditFontSize);
if(watched==querylineEdit)
{
if(event->type()==QEvent::FocusIn)
@@ -219,7 +219,7 @@ bool MainViewWidget::eventFilter(QObject *watched, QEvent *event)
QueryLineEditClickedBorder,QueryLineEditClickedBackground);
querylineEdit->setStyleSheet(style);
querylineEdit->setTextMargins(20,1,0,1);
- querylineEdit->setFont(font);
+// querylineEdit->setFont(font);
if(!querylineEdit->text().isEmpty())
searchAppSlot(querylineEdit->text());
}
diff --git a/src/MainWindow/mainwindow.cpp b/src/MainWindow/mainwindow.cpp
index 27dc2e9..0db0ffa 100644
--- a/src/MainWindow/mainwindow.cpp
+++ b/src/MainWindow/mainwindow.cpp
@@ -74,22 +74,6 @@ MainWindow::MainWindow(QWidget *parent) :
setting->endGroup();
initMainWindow();
-
-// pEnterAnimation=new QPropertyAnimation;
-// pEnterAnimation->setTargetObject(this);
-// pEnterAnimation->setPropertyName("size");
-// pEnterAnimation->setDuration(500);
-// pEnterAnimation->setStartValue(QSize(390,532));
-// pEnterAnimation->setEndValue(QSize(490,532));
-// pEnterAnimation->setEasingCurve(QEasingCurve::Linear);
-
-// pLeaveAnimation=new QPropertyAnimation;
-// pLeaveAnimation->setTargetObject(this);
-// pLeaveAnimation->setPropertyName("size");
-// pLeaveAnimation->setDuration(500);
-// pLeaveAnimation->setStartValue(QSize(490,532));
-// pLeaveAnimation->setEndValue(QSize(390,532));
-// pLeaveAnimation->setEasingCurve(QEasingCurve::Linear);
}
MainWindow::~MainWindow()
@@ -111,6 +95,12 @@ void MainWindow::initMainWindow()
this->setAutoFillBackground(false);
this->setFocusPolicy(Qt::StrongFocus);
+// QPainterPath path;
+// auto rect = this->rect();
+// rect.adjust(1, 1, -1, -1);
+// path.addRoundedRect(rect, 6, 6);
+// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
+
ui->mainToolBar->hide();
ui->menuBar->hide();
ui->statusBar->hide();
@@ -121,7 +111,7 @@ void MainWindow::initMainWindow()
this->setContentsMargins(0,0,0,0);
frame=new QFrame(this);
- sidebarwid=new SideBarWidget(this);
+ sidebarwid=new SideBarWidget();
mainviewwid=new MainViewWidget(this);
this->setCentralWidget(frame);
@@ -141,11 +131,8 @@ void MainWindow::initMainWindow()
mainlayout->setContentsMargins(0,0,0,0);
mainlayout->setSpacing(0);
centralWidget()->setLayout(mainlayout);
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
- QDBusReply<int> position=iface.call("GetPanelPosition","");
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
char style[100];
if(position==0)
sprintf(style, "border:0px;background-color:%s;border-top-right-radius:6px;",DefaultBackground);
@@ -173,6 +160,9 @@ void MainWindow::initMainWindow()
connect(QApplication::primaryScreen(),SIGNAL(geometryChanged(QRect)),
this,SLOT(monitorResolutionChange(QRect)));
+
+ connect(gsetting,SIGNAL(changed(QString)),
+ this,SLOT(panelShangedSlot(QString)));
}
/**
@@ -250,25 +240,11 @@ void MainWindow::paintEvent(QPaintEvent *)
*/
void MainWindow::showFullScreenWidget()
{
-//// this->showMaximized();
-// is_full=true;
-// classification_widget=arg;
-// sidebarwid->setVisible(false);
-// mainviewwid->setVisible(false);
-// char widgetcolor[100];
-// sprintf(widgetcolor, "border:0px;background-color:%s;",MAINVIEWWIDGETCOLOR);
-// mainwidget->setStyleSheet(QString::fromLocal8Bit(widgetcolor));
-// pAnimation->start();
-
is_fullscreen=true;
this->setContentsMargins(0,0,0,0);
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
-
- QDBusReply<int> position=iface.call("GetPanelPosition","");
- QDBusReply<int> panelSize=iface.call("GetPanelSize","");
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
+ int panelSize=gsetting->get("panelsize").toInt();
if(position==0)
this->setGeometry(QRect(0,0,Style::widthavailable,Style::heightavailable));
else if(position==1)
@@ -277,7 +253,6 @@ void MainWindow::showFullScreenWidget()
this->setGeometry(QRect(panelSize,0,Style::widthavailable,Style::heightavailable));
else
this->setGeometry(QRect(0,0,Style::widthavailable,Style::heightavailable));
-// this->setGeometry(QApplication::desktop()->availableGeometry());
sidebarwid->loadMaxSidebar();
mainviewwid->loadMaxMainView();
//移除分割线
@@ -295,25 +270,11 @@ void MainWindow::showFullScreenWidget()
*/
void MainWindow::showDefaultWidget()
{
-//// this->showNormal();
-// is_full=false;
-// classification_widget=arg;
-// sidebarwid->setVisible(false);
-// mainviewwid->setVisible(false);
-// char widgetcolor[100];
-// sprintf(widgetcolor, "border:0px;background-color:%s;",MAINVIEWWIDGETCOLOR);
-// mainwidget->setStyleSheet(QString::fromLocal8Bit(widgetcolor));
-// pAnimation->start();
-
is_fullscreen=false;
this->setContentsMargins(0,0,0,0);
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
-
- QDBusReply<int> position=iface.call("GetPanelPosition","");
- QDBusReply<int> panelSize=iface.call("GetPanelSize","");
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
+ int panelSize=gsetting->get("panelsize").toInt();
char style[100];
if(position==0)
{
@@ -385,14 +346,6 @@ void MainWindow::mainWindowMakeZero()
sidebarwid->widgetMakeZero();
}
-//void MainWindow::recv_hover_signal_slot(bool is_hover)
-//{
-// if(is_hover)
-// pEnterAnimation->start();
-// else
-// pLeaveAnimation->start();
-//}
-
void MainWindow::monitorResolutionChange(QRect rect)
{
Q_UNUSED(rect);
@@ -400,14 +353,17 @@ void MainWindow::monitorResolutionChange(QRect rect)
QProcess::startDetached(QString("/usr/bin/ukui-menu"));
}
-void MainWindow::setFrameStyle()
+void MainWindow::panelShangedSlot(QString key)
{
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
+ Q_UNUSED(key);
+ qApp->quit();
+ QProcess::startDetached(QString("/usr/bin/ukui-menu"));
+}
- QDBusReply<int> position=iface.call("GetPanelPosition","");
+void MainWindow::setFrameStyle()
+{
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
char style[100];
if(!is_fullscreen)
{
diff --git a/src/MainWindow/mainwindow.h b/src/MainWindow/mainwindow.h
index 28f9997..3c48c5b 100644
--- a/src/MainWindow/mainwindow.h
+++ b/src/MainWindow/mainwindow.h
@@ -79,8 +79,8 @@ private Q_SLOTS:
void showFullScreenWidget();//加载全屏窗口
void showDefaultWidget();//显示默认窗口
void recvHideMainWindowSlot();//接收隐藏主窗口信号
-// void recv_hover_signal_slot(bool is_hover);
void monitorResolutionChange(QRect rect);//监控屏幕分辨率
+ void panelShangedSlot(QString key);
};
#endif // MAINWINDOW_H
diff --git a/src/QtSingleApplication/qtsingleapplication.cpp b/src/QtSingleApplication/qtsingleapplication.cpp
index 4a9294d..ae9271d 100644
--- a/src/QtSingleApplication/qtsingleapplication.cpp
+++ b/src/QtSingleApplication/qtsingleapplication.cpp
@@ -333,13 +333,9 @@ void QtSingleApplication::activateWindow()
MainWindow* w=qobject_cast<MainWindow*>(actWin);
w->mainWindowMakeZero();
w->setFrameStyle();
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
-
- QDBusReply<int> position=iface.call("GetPanelPosition","");
- QDBusReply<int> panelSize=iface.call("GetPanelSize","");
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
+ int panelSize=gsetting->get("panelsize").toInt();
bool ret=w->checkIfFullScreen();
if(ret)
{
diff --git a/src/RightClickMenu/rightclickmenu.cpp b/src/RightClickMenu/rightclickmenu.cpp
index 24ac63f..165a9d6 100644
--- a/src/RightClickMenu/rightclickmenu.cpp
+++ b/src/RightClickMenu/rightclickmenu.cpp
@@ -172,7 +172,6 @@ RightClickMenu::~RightClickMenu()
void RightClickMenu::addCommonUseAppBtnAction()
{
setting->beginGroup("application");
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
if(!setting->contains(desktopfn) || setting->value(desktopfn).toInt()>0)
@@ -290,7 +289,6 @@ void RightClickMenu::addAppBtnAction()
{
setting->beginGroup("application");
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
if(!setting->contains(desktopfn) || setting->value(desktopfn).toInt()>0)
@@ -413,13 +411,13 @@ void RightClickMenu::addShutdownAction()
//其它按钮右键菜单
void RightClickMenu::addOtherAction()
{
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
+// QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QDBusInterface iface("com.ukui.panel.desktop",
"/",
"com.ukui.panel.desktop",
QDBusConnection::sessionBus());
- QDBusReply<bool> ret=iface.call("CheckIfExist",desktopfp);
+ QDBusReply<bool> ret=iface.call("CheckIfExist",this->desktopfp);
if(!ret)
{
initWidgetAction(OtherFix2TaskBarWid,":/data/img/sidebarwidget/fixed.svg",tr("Pin to taskbar"));
@@ -499,7 +497,6 @@ void RightClickMenu::initWidgetAction(QWidget *wid, QString iconstr, QString tex
void RightClickMenu::fixToCommonUseActionTriggerSlot()
{
action_number=1;
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
setting->beginGroup("application");
@@ -515,7 +512,6 @@ void RightClickMenu::fixToCommonUseActionTriggerSlot()
void RightClickMenu::unfixedFromCommonUseActionTriggerSlot()
{
action_number=2;
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
setting->beginGroup("application");
@@ -532,7 +528,6 @@ void RightClickMenu::unfixedFromCommonUseActionTriggerSlot()
void RightClickMenu::fixToTaskbarActionTriggerSlot()
{
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QDBusInterface iface("com.ukui.panel.desktop",
"/",
"com.ukui.panel.desktop",
@@ -544,7 +539,6 @@ void RightClickMenu::fixToTaskbarActionTriggerSlot()
void RightClickMenu::unfixedFromTaskbarActionTriggerSlot()
{
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QDBusInterface iface("com.ukui.panel.desktop",
"/",
"com.ukui.panel.desktop",
@@ -555,7 +549,6 @@ void RightClickMenu::unfixedFromTaskbarActionTriggerSlot()
void RightClickMenu::addToDesktopActionTriggerSlot()
{
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QString path=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
@@ -575,7 +568,6 @@ void RightClickMenu::addToDesktopActionTriggerSlot()
void RightClickMenu::uninstallActionTriggerSlot()
{
// QString exec=pUkuiMenuInterface->getAppExec(pUkuiMenuInterface->getDesktopPathByAppName(appname));
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
// QFileInfo fileInfo(exec.split(" ").at(0));
// bool ret=fileInfo.isAbsolute();
@@ -618,7 +610,6 @@ void RightClickMenu::onReadOutput()
void RightClickMenu::attributeActionTriggerSlot()
{
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
char command[100];
sprintf(command,"ukui-menu-attr %s",desktopfp.toLocal8Bit().data());
QProcess::startDetached(command);
@@ -628,7 +619,6 @@ void RightClickMenu::attributeActionTriggerSlot()
void RightClickMenu::commonUseDeleteActionTriggerSlot()
{
action_number=8;
- QString desktopfp=pUkuiMenuInterface->getDesktopPathByAppName(appname);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
setting->beginGroup("application");
@@ -700,17 +690,19 @@ void RightClickMenu::otherListActionTriggerSlot()
qDebug()<<"---2---";
}
-int RightClickMenu::showCommonUseAppBtnMenu(QString appname)
+int RightClickMenu::showCommonUseAppBtnMenu(QString desktopfp)
{
- this->appname=appname;
+ this->desktopfp.clear();
+ this->desktopfp=desktopfp;
addCommonUseAppBtnAction();
cuappbtnmenu->exec(QCursor::pos());
return action_number;
}
-int RightClickMenu::showAppBtnMenu(QString appname)
+int RightClickMenu::showAppBtnMenu(QString desktopfp)
{
- this->appname=appname;
+ this->desktopfp.clear();
+ this->desktopfp=desktopfp;
addAppBtnAction();
appbtnmenu->exec(QCursor::pos());
return action_number;
@@ -723,9 +715,10 @@ int RightClickMenu::showShutdownMenu()
}
-void RightClickMenu::showOtherMenu(QString appname)
+void RightClickMenu::showOtherMenu(QString desktopfp)
{
- this->appname=appname;
+ this->desktopfp.clear();
+ this->desktopfp=desktopfp;
addOtherAction();
othermenu->exec(QCursor::pos());
}
diff --git a/src/RightClickMenu/rightclickmenu.h b/src/RightClickMenu/rightclickmenu.h
index 4b105a5..2e4c62b 100644
--- a/src/RightClickMenu/rightclickmenu.h
+++ b/src/RightClickMenu/rightclickmenu.h
@@ -42,13 +42,13 @@ class RightClickMenu: public QWidget
public:
RightClickMenu(QWidget *parent);
virtual ~RightClickMenu();
- int showCommonUseAppBtnMenu(QString appname);
- int showAppBtnMenu(QString appname);
+ int showCommonUseAppBtnMenu(QString desktopfp);
+ int showAppBtnMenu(QString desktopfp);
int showShutdownMenu();
- void showOtherMenu(QString appname);
+ void showOtherMenu(QString desktopfp);
private:
- QString appname;
+ QString desktopfp;
int action_number;//记录执行的action编号
QSettings* setting=nullptr;
diff --git a/src/SideBarWidget/sidebarwidget.cpp b/src/SideBarWidget/sidebarwidget.cpp
index 481b84d..ca69135 100644
--- a/src/SideBarWidget/sidebarwidget.cpp
+++ b/src/SideBarWidget/sidebarwidget.cpp
@@ -360,16 +360,16 @@ void SideBarWidget::otherBtnRightClickSlot()
int index=otherButtonList.indexOf(btn);
QString desktopfp;
if(index==1)
- desktopfp=QString("/usr/share/applications/peony-qt.desktop");
+ desktopfp=QString("/usr/share/applications/peony-computer.desktop");
if(index==2)
desktopfp=QString("/usr/share/applications/ukui-control-center.desktop");
- othermenu->showOtherMenu(pUkuiMenuInterface->getAppName(desktopfp));
+ othermenu->showOtherMenu(desktopfp);
}
void SideBarWidget::computerBtnClickedSlot()
{
Q_EMIT sendHideMainWindowSignal();
- QProcess::startDetached(QString("peony computer:///"));
+ QProcess::startDetached(QString("/usr/bin/peony computer:///"));
}
void SideBarWidget::controlBtnClickedSlot()
@@ -394,7 +394,7 @@ void SideBarWidget::shutdownBtnClickedSlot()
void SideBarWidget::userIconBtnClickedSlot()
{
Q_EMIT sendHideMainWindowSignal();
- QProcess::startDetached(QString("ukui-control-center --u"));
+ QProcess::startDetached(QString("ukui-control-center -u"));
}
void SideBarWidget::userAccountsChanged()
@@ -511,16 +511,6 @@ void SideBarWidget::setMinSidebarBtn(QPushButton* btn)
childwid->setParent(nullptr);
}
}
-
-
-// btn->setFixedSize(160,48);
-// QLayoutItem* item=btn->layout()->itemAt(1);
-// QWidget* wid=item->widget();
-// QLabel* label=qobject_cast<QLabel*>(wid);
-// int len=label->text().length();
-//// btn->layout()->setContentsMargins(25,0,btn->width()-40-labelicon->width()-letterbtnname->width(),0);
-// btn->layout()->setContentsMargins(25,0,btn->width()-40-labelicon->width()-len*14,0);
-// btn->layout()->setSpacing(15);
}
/**
@@ -587,137 +577,14 @@ void SideBarWidget::setMinBtn()
*/
void SideBarWidget::setMaxSidebarBtn(QPushButton *btn)
{
-// btn->setFixedSize(60,48);
-// btn->layout()->setContentsMargins(0,0,0,0);
-// btn->layout()->setSpacing(10);
-
btn->setFixedSize(Style::SideBarBtnWidth,Style::SideBarBtnHeight);
-// QLayoutItem* item=btn->layout()->itemAt(1);
-// QWidget* wid=item->widget();
-// QLabel* label=qobject_cast<QLabel*>(wid);
-// int len=label->text().length();
-// qDebug()<<len;
-// btn->layout()->setContentsMargins(15,0,btn->width()-40-labelicon->width()-letterbtnname->width(),0);
btn->layout()->setContentsMargins(Style::SideBarSpaceIconLeft,
0,
0,
0);
btn->layout()->setSpacing(Style::SideBarSpaceIconText);
-// btn->setStyleSheet("border:1px solid #ff0000;");
-
}
-//void SideBarWidget::enterEvent(QEvent *e)
-//{
-// this->is_hover=true;
-// Q_UNUSED(e);
-// if(!is_fullscreen)
-// {
-// }
-// else
-// {
-//// pEnterAnimation->start();
-// }
-//}
-
-//void SideBarWidget::leaveEvent(QEvent *e)
-//{
-// this->is_hover=false;
-// Q_UNUSED(e);
-// if(!is_fullscreen)
-// {
-// }
-// else
-// {
-//// pLeaveAnimation->start();
-// }
-//}
-
-//void SideBarWidget::animation_finished_slot()
-//{
-//}
-
-/**
- * 按钮焦点事件过滤
- */
-//bool SideBarWidget::eventFilter(QObject *watched, QEvent *event)
-//{
-// char style[300];
-// sprintf(style,"QToolButton{background-color:%s;border:0px;padding-left:0;}\
-// QToolButton:hover{background-color:%s;}\
-// QToolButton:pressed{background-color:%s;}", SIDEBARWIDGETCOLOR,SIDEBARBTNHOVER,SIDEBARBTNPRESSED);
-
-// char pressstyle[200];
-// sprintf(pressstyle,"QToolButton{background-color:%s;border:0px;padding-left:0;}",MAINVIEWWIDGETCOLOR);
-
-// if(watched==commonusebtn)
-// {
-// if(event->type()==QEvent::FocusIn)
-// {
-// commonusebtn->setStyleSheet(QString::fromLocal8Bit(pressstyle));
-// }
-// else if(event->type()==QEvent::FocusOut){
-// commonusebtn->setStyleSheet(QString::fromLocal8Bit(style));
-
-// }
-// }
-// else if(watched==letterbtn)
-// {
-// if(event->type()==QEvent::FocusIn)
-// {
-// letterbtn->setStyleSheet(QString::fromLocal8Bit(pressstyle));
-// }
-// else if(event->type()==QEvent::FocusOut){
-// letterbtn->setStyleSheet(QString::fromLocal8Bit(style));
-
-// }
-// }
-// else if(watched==functionbtn)
-// {
-// if(event->type()==QEvent::FocusIn)
-// {
-// functionbtn->setStyleSheet(QString::fromLocal8Bit(pressstyle));
-// }
-// else if(event->type()==QEvent::FocusOut){
-// functionbtn->setStyleSheet(QString::fromLocal8Bit(style));
-
-// }
-
-// }
-// //屏蔽按键
-// if(event->type()==QEvent::KeyPress)
-// return true;
-
-// return QWidget::eventFilter(watched,event);
-//}
-
-//void SideBarWidget::mousePressEvent(QMouseEvent *e)
-//{
-// if(e->button()==Qt::RightButton)
-// {
-// if(commonusebtn->hasFocus())
-// {
-// if(is_fullscreen)
-// Q_EMIT send_fullscreen_commonusebtn_signal();
-// else Q_EMIT sendCommonUseBtnSignal();
-
-// }
-// else if(letterbtn->hasFocus())
-// {
-// if(is_fullscreen)
-// Q_EMIT sendFullScreenLetterBtnSignal();
-// else Q_EMIT sendLetterBtnSignal();
-// }
-// else if(functionbtn->hasFocus())
-// {
-// if(is_fullscreen)
-// Q_EMIT sendFullScreenFunctionBtnSignal();
-// else Q_EMIT sendFunctionBtnSignal();
-// }
-
-// }
-//}
-
void SideBarWidget::btnGroupClickedSlot(QAbstractButton *btn)
{
char btncolor[300];
@@ -757,7 +624,6 @@ void SideBarWidget::btnGroupClickedSlot(QAbstractButton *btn)
}
}
else{
-// button->setStyleSheet(QString::fromLocal8Bit(btncolor));
button->setStyleSheet("background:transparent;");
}
}
diff --git a/src/Style/style.cpp b/src/Style/style.cpp
index 4a8ae47..3569990 100644
--- a/src/Style/style.cpp
+++ b/src/Style/style.cpp
@@ -83,13 +83,10 @@ void Style::initWidStyle()
QStringList valstr=value.split(" ");
int fontSize=valstr.at(valstr.count()-1).toInt();
- QDBusInterface iface("com.ukui.panel.desktop",
- "/",
- "com.ukui.panel.desktop",
- QDBusConnection::sessionBus());
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ int position=gsetting->get("panelposition").toInt();
+ int panelSize=gsetting->get("panelsize").toInt();
- QDBusReply<int> position=iface.call("GetPanelPosition","");
- QDBusReply<int> panelSize=iface.call("GetPanelSize","");
if(position==0 || position==1)
{
widthavailable=QApplication::primaryScreen()->geometry().width();
@@ -229,7 +226,7 @@ void Style::initWidStyle()
SideBarBtnWidth=110;
SideBarBtnHeight=43;
SideBarFontSize=fontSize;
- SideBarIconSize=16;
+ SideBarIconSize=19;
SideBarSpaceIconLeft=14;
SideBarSpaceIconText=6;
SideBarSpaceBetweenItem=16;
@@ -273,7 +270,7 @@ void Style::initWidStyle()
SideBarBtnWidth=110;
SideBarBtnHeight=43;
SideBarFontSize=fontSize;
- SideBarIconSize=16;
+ SideBarIconSize=19;
SideBarSpaceIconLeft=14;
SideBarSpaceIconText=6;
SideBarSpaceBetweenItem=16;
@@ -317,7 +314,7 @@ void Style::initWidStyle()
SideBarBtnWidth=110;
SideBarBtnHeight=43;
SideBarFontSize=fontSize;
- SideBarIconSize=16;
+ SideBarIconSize=19;
SideBarSpaceIconLeft=14;
SideBarSpaceIconText=6;
SideBarSpaceBetweenItem=16;
@@ -361,7 +358,7 @@ void Style::initWidStyle()
SideBarBtnWidth=110;
SideBarBtnHeight=43;
SideBarFontSize=fontSize;
- SideBarIconSize=16;
+ SideBarIconSize=19;
SideBarSpaceIconLeft=14;
SideBarSpaceIconText=6;
SideBarSpaceBetweenItem=16;
@@ -405,7 +402,7 @@ void Style::initWidStyle()
SideBarBtnWidth=110;
SideBarBtnHeight=43;
SideBarFontSize=fontSize;
- SideBarIconSize=16;
+ SideBarIconSize=19;
SideBarSpaceIconLeft=14;
SideBarSpaceIconText=6;
SideBarSpaceBetweenItem=16;
diff --git a/src/UtilityFunction/fullitemdelegate.cpp b/src/UtilityFunction/fullitemdelegate.cpp
index e118a93..29de925 100644
--- a/src/UtilityFunction/fullitemdelegate.cpp
+++ b/src/UtilityFunction/fullitemdelegate.cpp
@@ -82,14 +82,14 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
icon=QIcon::fromTheme(QString("application-x-desktop"));
QString appname=pUkuiMenuInterface->getAppName(desktopfp);
- QFont font;
+// QFont font;
QRect iconRect;
- font.setPixelSize(Style::AppListFontSize);
+// font.setPixelSize(Style::AppListFontSize);
iconRect=QRect(rect.x()+Style::AppLeftSpace ,
rect.y()+Style::AppTopSpace,
Style::AppListIconSize,
Style::AppListIconSize);
- painter->setFont(font);
+// painter->setFont(font);
icon.paint(painter,iconRect);
if(module==0)
{
diff --git a/src/UtilityFunction/fulllistview.cpp b/src/UtilityFunction/fulllistview.cpp
index acebac2..18b77c2 100644
--- a/src/UtilityFunction/fulllistview.cpp
+++ b/src/UtilityFunction/fulllistview.cpp
@@ -120,11 +120,10 @@ void FullListView::rightClickedSlot()
QModelIndex index=this->currentIndex();
QVariant var=listmodel->data(index, Qt::DisplayRole);
QString desktopfp=var.value<QString>();
- QString appname=pUkuiMenuInterface->getAppName(desktopfp);
menu=new RightClickMenu(this);
if(module>0)
{
- int ret=menu->showAppBtnMenu(appname);
+ int ret=menu->showAppBtnMenu(desktopfp);
if(ret==1 || ret==2)
{
Q_EMIT sendFixedOrUnfixedSignal();
@@ -135,7 +134,7 @@ void FullListView::rightClickedSlot()
Q_EMIT sendHideMainWindowSignal();
}
else{
- int ret=menu->showCommonUseAppBtnMenu(appname);
+ int ret=menu->showCommonUseAppBtnMenu(desktopfp);
if(ret==1 || ret==2)
{
this->setCurrentIndex(index);
diff --git a/src/UtilityFunction/functionclassifybutton.cpp b/src/UtilityFunction/functionclassifybutton.cpp
index 03090c1..0bec80a 100644
--- a/src/UtilityFunction/functionclassifybutton.cpp
+++ b/src/UtilityFunction/functionclassifybutton.cpp
@@ -62,9 +62,9 @@ FunctionClassifyButton::FunctionClassifyButton(QWidget *parent,
textlabel=new QLabel(this);
textlabel->setText(this->text);
- QFont font;
- font.setPixelSize(textSize);
- textlabel->setFont(font);
+// QFont font;
+// font.setPixelSize(textSize);
+// textlabel->setFont(font);
if(is_fullscreen)
textlabel->setStyleSheet("background:transparent; color:rgba(255, 255, 255, 50%);");
else
@@ -105,9 +105,9 @@ void FunctionClassifyButton::enterEvent(QEvent *e)
svgRender->render(&p);
iconlabel->setPixmap(*pixmap);
iconlabel->setFixedSize(pixmap->size());
- QFont font;
- font.setPixelSize(textSize);
- textlabel->setFont(font);
+// QFont font;
+// font.setPixelSize(textSize);
+// textlabel->setFont(font);
if(enabled)
textlabel->setStyleSheet("background:transparent;color:rgba(255, 255, 255);");
textlabel->adjustSize();
@@ -124,9 +124,9 @@ void FunctionClassifyButton::leaveEvent(QEvent *e)
this->setFixedSize(width,height);
svgRender->load(piconstr);
pixmap=new QPixmap(iconSize,iconSize);
- QFont font;
- font.setPixelSize(textSize);
- textlabel->setFont(font);
+// QFont font;
+// font.setPixelSize(textSize);
+// textlabel->setFont(font);
}
else
@@ -134,9 +134,9 @@ void FunctionClassifyButton::leaveEvent(QEvent *e)
this->setFixedSize(width,height);
svgRender->load(iconstr);
pixmap=new QPixmap(iconSize,iconSize);
- QFont font;
- font.setPixelSize(textSize);
- textlabel->setFont(font);
+// QFont font;
+// font.setPixelSize(textSize);
+// textlabel->setFont(font);
}
// pixmap=new QPixmap(iconSize,iconSize);
@@ -175,9 +175,9 @@ void FunctionClassifyButton::mousePressEvent(QMouseEvent *event)
svgRender->render(&p);
iconlabel->setPixmap(*pixmap);
iconlabel->setFixedSize(pixmap->size());
- QFont font;
- font.setPixelSize(textSize);
- textlabel->setFont(font);
+// QFont font;
+// font.setPixelSize(textSize);
+// textlabel->setFont(font);
textlabel->setStyleSheet("background:transparent;color:#ffffff;");
textlabel->adjustSize();
is_pressed=true;
@@ -203,9 +203,9 @@ void FunctionClassifyButton::mouseReleaseEvent(QMouseEvent *event)
svgRender->render(&p);
iconlabel->setPixmap(*pixmap);
iconlabel->setFixedSize(pixmap->size());
- QFont font;
- font.setPixelSize(textSize);
- textlabel->setFont(font);
+// QFont font;
+// font.setPixelSize(textSize);
+// textlabel->setFont(font);
textlabel->setStyleSheet("background:transparent;color:#ffffff;");
textlabel->adjustSize();
Q_EMIT buttonClicked(this);
diff --git a/src/UtilityFunction/itemdelegate.cpp b/src/UtilityFunction/itemdelegate.cpp
index 57d33b0..4f9f0d1 100644
--- a/src/UtilityFunction/itemdelegate.cpp
+++ b/src/UtilityFunction/itemdelegate.cpp
@@ -59,11 +59,11 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
- QFont font;
+// QFont font;
// font.setFamily("Microsoft YaHei");
- font.setPixelSize(Style::AppListFontSize);
- painter->setFont(font);
+// font.setPixelSize(Style::AppListFontSize);
+// painter->setFont(font);
// QIcon icon=index.model()->data(index,Qt::DecorationRole).value<QIcon>();
QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
diff --git a/src/UtilityFunction/listview.cpp b/src/UtilityFunction/listview.cpp
index 0443d70..a0d4d1c 100644
--- a/src/UtilityFunction/listview.cpp
+++ b/src/UtilityFunction/listview.cpp
@@ -117,8 +117,7 @@ void ListView::rightClickedSlot()
{
if(strlist.at(1).toInt()==1)
{
- QString appname=pUkuiMenuInterface->getAppName(strlist.at(0));
- int ret=menu->showAppBtnMenu(appname);
+ int ret=menu->showAppBtnMenu(strlist.at(0));
if(ret==1 || ret==2)
Q_EMIT sendFixedOrUnfixedSignal();
if(ret==6)
@@ -128,8 +127,7 @@ void ListView::rightClickedSlot()
}
}
else{
- QString appname=pUkuiMenuInterface->getAppName(strlist.at(0));
- int ret=menu->showCommonUseAppBtnMenu(appname);
+ int ret=menu->showCommonUseAppBtnMenu(strlist.at(0));
if(ret==1 || ret==2)
{
this->setCurrentIndex(index);
@@ -173,7 +171,6 @@ void ListView::rightClickedSlot()
this->selectionModel()->clear();
}
-
}
void ListView::enterEvent(QEvent *e)
diff --git a/src/UtilityFunction/pushbutton.cpp b/src/UtilityFunction/pushbutton.cpp
index 3aff34b..464d729 100644
--- a/src/UtilityFunction/pushbutton.cpp
+++ b/src/UtilityFunction/pushbutton.cpp
@@ -47,10 +47,10 @@ void PushButton::initAppBtn()
char style[100];
sprintf(style,"color:#ffffff;");
- QFont font;
- font.setPixelSize(Style::LeftFontSize);
+// QFont font;
+// font.setPixelSize(Style::LeftFontSize);
QLabel* textlabel=new QLabel(this);
- textlabel->setFont(font);
+// textlabel->setFont(font);
textlabel->setAlignment(Qt::AlignCenter);
textlabel->setStyleSheet(style);
textlabel->setText(name);
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。