Import Upstream version 3.0.1.0720.1update1

This commit is contained in:
谢炜 2022-05-20 16:38:37 +08:00
parent d56635f2e8
commit 3c242b8f5a
67 changed files with 3913 additions and 3410 deletions

View File

@ -0,0 +1 @@
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 256 256"><defs><style>.cls-1{fill:none;}.cls-2{clip-path:url(#clip-path);}.cls-3{opacity:0.15;}.cls-4{fill:#fff;}</style><clipPath id="clip-path"><rect class="cls-1" width="256" height="256"/></clipPath></defs><title>avatar</title><g class="cls-2"><g class="cls-2"><g class="cls-3"><g class="cls-2"><path d="M256,128A128,128,0,1,1,128,0,128,128,0,0,1,256,128"/></g></g><path class="cls-4" d="M164,143H92a30,30,0,0,0-30,30v12a18,18,0,0,0,18,18h96a18,18,0,0,0,18-18V173a30,30,0,0,0-30-30"/><path class="cls-4" d="M128,123A35,35,0,1,0,93,88a35,35,0,0,0,35,35"/></g></g></svg>

After

Width:  |  Height:  |  Size: 703 B

View File

@ -36,6 +36,7 @@ int main(int argc, char *argv[])
{
initUkuiLog4qt("ukui-menu");
qRegisterMetaType<QVector<QStringList>>("QVector<QStringList>");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
@ -43,29 +44,34 @@ int main(int argc, char *argv[])
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
QtSingleApplication app("ukui-menu", argc, argv);
app.setQuitOnLastWindowClosed(false);
if (app.isRunning()) {
if(app.isRunning())
{
app.sendMessage("raise_window_noop");
return EXIT_SUCCESS;
}
// auto Style=new ProxyStyle;
// app.setStyle(Style);
QTranslator translator;
if (translator.load(QLocale(), "ukui-menu", "_", QM_FILES_INSTALL_PATH)) {
QTranslator translator;
if (translator.load(QLocale(), "ukui-menu", "_", QM_FILES_INSTALL_PATH))
app.installTranslator(&translator);
} else {
else
qDebug() << "Load translations file" << QLocale() << "failed!";
}
Zeeker::FileUtils::loadHanziTable(":/src/SearchResultWidget/pinyinWithoutTone.txt");
MainWindow w;
app.setActivationWindow(&w);
// w.setProperty("useSystemStyleBlur", true);
//测试
// if(Style::panelPosition==0)
// w.setGeometry(QRect(Style::primaryScreenX+4,Style::primaryScreenY+Style::primaryScreenHeight-Style::panelSize-Style::minh-3,
// Style::minw,Style::minh));
@ -76,11 +82,13 @@ int main(int argc, char *argv[])
// else
// w.setGeometry(QRect(Style::primaryScreenX+Style::primaryScreenWidth-Style::panelSize-Style::minw-4,Style::primaryScreenY+4,
// Style::minw,Style::minh));
w.show();
w.raise();
w.update();
w.activateWindow();
w.hide();
//测试
return app.exec();
}

View File

@ -27,14 +27,12 @@ CommonUseWidget::CommonUseWidget(QWidget *parent) :
QWidget(parent)
{
initUi();
}
CommonUseWidget::~CommonUseWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void CommonUseWidget::initUi()
@ -43,7 +41,9 @@ void CommonUseWidget::initUi()
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
this->setAttribute(Qt::WA_TranslucentBackground);
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
m_ukuiMenuInterface=new UkuiMenuInterface;
initAppListWidget();
fillAppList();
}
@ -53,14 +53,12 @@ void CommonUseWidget::initUi()
*/
void CommonUseWidget::initAppListWidget()
{
m_listView = new ListView(this, this->width(), this->height() - 6, 0);
m_listView->setFixedSize(this->width(), this->height() - 6);
//m_listView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
m_listView=new ListView(this,this->width()-6,this->height()-6,0);
m_listView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
m_listView->show();
connect(m_listView,&ListView::sendItemClickedSignal,this,&CommonUseWidget::execApplication);
connect(m_listView,&ListView::sendUpdateAppListSignal,this,&CommonUseWidget::updateListViewSlot);
connect(m_listView,&ListView::sendHideMainWindowSignal,this,&CommonUseWidget::sendHideMainWindowSignal);
connect(m_listView, &ListView::sendMainWinActiveSignal, this, &CommonUseWidget::sendMainWinActiveSignal);
}
/**
@ -69,11 +67,8 @@ void CommonUseWidget::initAppListWidget()
void CommonUseWidget::fillAppList()
{
m_data.clear();
Q_FOREACH (QString desktopfp, UkuiMenuInterface::allAppVector) {
Q_FOREACH(QString desktopfp,UkuiMenuInterface::allAppVector)
m_data.append(QStringList()<<desktopfp<<"1");
}
m_listView->addData(m_data);
}
@ -86,8 +81,8 @@ void CommonUseWidget::selectFirstItem()
void CommonUseWidget::selectFirstItemTab()
{
this->setFocus();
if (m_listView->currentIndex().row() == -1) {
if(m_listView->currentIndex().row() == -1)
{
m_listView->setCurrentIndex(m_listView->model()->index(0,0));
}
}
@ -113,11 +108,8 @@ void CommonUseWidget::updateListViewSlot()
void CommonUseWidget::updateListView()
{
m_data.clear();
Q_FOREACH (QString desktopfp, m_ukuiMenuInterface->getAllClassification()) {
Q_FOREACH(QString desktopfp,m_ukuiMenuInterface->getAllClassification())
m_data.append(QStringList()<<desktopfp<<"1");
}
m_listView->updateData(m_data);
// m_listView->setFocus();
}
@ -129,12 +121,11 @@ void CommonUseWidget::widgetMakeZero()
void CommonUseWidget::moveScrollBar(int type)
{
if (type == 0) {
if(type==0)
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-100);
} else {
else
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+100);
}
}
void CommonUseWidget::repaintWidget()
{

View File

@ -103,7 +103,6 @@ Q_SIGNALS:
* @brief Send a hidden main window signal to the MainViewWidget
*/
void sendHideMainWindowSignal();
void sendMainWinActiveSignal(bool flag);
};
#endif // COMMONUSEWIDGET_H

View File

@ -30,10 +30,7 @@ FullCommonUseWidget::FullCommonUseWidget(QWidget *parent) :
FullCommonUseWidget::~FullCommonUseWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullCommonUseWidget::initUi()
@ -60,9 +57,22 @@ void FullCommonUseWidget::initUi()
m_scrollAreaWidLayout->setSpacing(10);
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
mainLayout->addWidget(m_scrollArea);
m_ukuiMenuInterface=new UkuiMenuInterface;
initAppListWidget();
fillAppList();
flag = true;
//翻页灵敏度时间调节
time = new QTimer(this);
connect(time,&QTimer::timeout,[=](){
if(flag == false)
{
flag = true;
time->stop();
}
});
}
void FullCommonUseWidget::initAppListWidget()
@ -72,12 +82,6 @@ void FullCommonUseWidget::initAppListWidget()
// QHBoxLayout *mainLayout=qobject_cast<QHBoxLayout*>(this->layout());
// mainLayout->insertWidget(1,m_listView);
m_scrollAreaWidLayout->addWidget(m_listView);
connect(m_scrollArea, &ScrollArea::requestUpdate, m_listView->viewport(), [ = ]() {
QEventLoop loop;
QTimer::singleShot(1, &loop, SLOT(quit()));
loop.exec();
m_listView->repaint();
});
connect(m_listView,&FullListView::sendItemClickedSignal,this,&FullCommonUseWidget::execApplication);
connect(m_listView,&FullListView::sendUpdateAppListSignal,this,&FullCommonUseWidget::updateListViewSlot);
connect(m_listView,&FullListView::sendHideMainWindowSignal,this,&FullCommonUseWidget::sendHideMainWindowSignal);
@ -92,11 +96,14 @@ void FullCommonUseWidget::resizeScrollAreaControls()
listview->adjustSize();
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
int rowcount=0;
if (listview->model()->rowCount() % dividend > 0) {
if(listview->model()->rowCount()%dividend>0)
{
rowcount=listview->model()->rowCount()/dividend+1;
} else {
}
else
{
rowcount=listview->model()->rowCount()/dividend;
}
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
@ -106,11 +113,8 @@ void FullCommonUseWidget::resizeScrollAreaControls()
void FullCommonUseWidget::fillAppList()
{
m_data.clear();
Q_FOREACH (QString desktopfp, UkuiMenuInterface::allAppVector) {
Q_FOREACH(QString desktopfp,UkuiMenuInterface::allAppVector)
m_data.append(desktopfp);
}
m_listView->addData(m_data);
resizeScrollAreaControls();
}
@ -134,20 +138,28 @@ void FullCommonUseWidget::selectFirstItem()
void FullCommonUseWidget::selectFirstItemTab()
{
this->setFocus();
if (m_listView->currentIndex().row() == -1) {
if(m_listView->currentIndex().row() == -1)
{
m_listView->setCurrentIndex(m_listView->model()->index(0,0));
}
}
void FullCommonUseWidget::onSetSlider(int value)
{
if (value == 0) {
// if(flag)
// {
// flag = false;
// time->start(100);
if(value == 0)
{
m_scrollArea->verticalScrollBar()->setValue(0);
} else {
}
else
{
int curvalue = m_scrollArea->verticalScrollBar()->value();
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
}
// }
}
/**
*
@ -160,11 +172,8 @@ void FullCommonUseWidget::updateListViewSlot()
void FullCommonUseWidget::updateListView()
{
m_data.clear();
Q_FOREACH (QString desktopfp, m_ukuiMenuInterface->getAllClassification()) {
Q_FOREACH(QString desktopfp,m_ukuiMenuInterface->getAllClassification())
m_data.append(desktopfp);
}
m_listView->updateData(m_data);
}
@ -173,6 +182,7 @@ void FullCommonUseWidget::repaintWidget()
this->setFixedSize(Style::MainViewWidWidth,
Style::AppListWidHeight);
m_scrollArea->setFixedSize(Style::AppListWidWidth,this->height());
m_scrollAreaWid->setFixedWidth(m_scrollArea->width() - Style::SliderSize);
m_scrollAreaWidLayout->removeWidget(m_listView);
m_listView->setParent(nullptr);
delete m_listView;
@ -188,10 +198,8 @@ void FullCommonUseWidget::widgetMakeZero()
void FullCommonUseWidget::moveScrollBar(int type)
{
int height=Style::primaryScreenHeight;
if (type == 0) {
if(type==0)
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-height*100/1080);
} else {
else
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+height*100/1080);
}
}

View File

@ -74,6 +74,8 @@ private:
ScrollArea* m_scrollArea=nullptr;
ScrollAreaWid* m_scrollAreaWid=nullptr;
QVBoxLayout* m_scrollAreaWidLayout=nullptr;
bool flag;
QTimer *time = nullptr;
protected:
/**

View File

@ -1,20 +1,3 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#include "dbus.h"
#include <QFileInfo>
#include <QDir>

View File

@ -1,20 +1,3 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#ifndef DBUS_H
#define DBUS_H

View File

@ -32,10 +32,7 @@ FullFunctionWidget::FullFunctionWidget(QWidget *parent) :
FullFunctionWidget::~FullFunctionWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullFunctionWidget::initUi()
@ -49,20 +46,25 @@ void FullFunctionWidget::initUi()
Style::AppListWidHeight);
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
m_iconListWid->setFixedSize(Style::LeftWidWidth,this->height());
QHBoxLayout* mainLayout=new QHBoxLayout;
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->setSpacing(0);
mainLayout->addWidget(m_iconListWid);
mainLayout->addWidget(m_applistWid);
this->setLayout(mainLayout);
m_ukuiMenuInterface=new UkuiMenuInterface;
initAppListWidget();
initIconListWidget();
flag = true;
//翻页灵敏度时间调节
time = new QTimer(this);
connect(time,&QTimer::timeout,[=](){
if (flag == false) {
if(flag == false)
{
flag = true;
time->stop();
}
@ -77,6 +79,7 @@ void FullFunctionWidget::initAppListWidget()
QHBoxLayout* layout=new QHBoxLayout(m_applistWid);
layout->setContentsMargins(0,0,0,0);
m_applistWid->setLayout(layout);
m_scrollArea=new ScrollArea;
m_scrollAreaWid=new ScrollAreaWid;
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
@ -102,91 +105,83 @@ void FullFunctionWidget::fillAppList()
m_classificationList.clear();
QVector<QStringList> vector=UkuiMenuInterface::functionalVector;
QStringList androidlist=vector.at(0);
if (!androidlist.isEmpty()) {
if(!androidlist.isEmpty())
{
insertClassificationBtn("Mobile");
insertAppList(androidlist);
}
QStringList netlist=vector.at(1);
if (!netlist.isEmpty()) {
if(!netlist.isEmpty())
{
insertClassificationBtn("Internet");
insertAppList(netlist);
}
QStringList sociallist=vector.at(2);
if (!sociallist.isEmpty()) {
if(!sociallist.isEmpty())
{
insertClassificationBtn("Social");
insertAppList(sociallist);
}
QStringList avlist=vector.at(3);
if (!avlist.isEmpty()) {
if(!avlist.isEmpty())
{
insertClassificationBtn("Video");
insertAppList(avlist);
}
QStringList developlist=vector.at(4);
if (!developlist.isEmpty()) {
if(!developlist.isEmpty())
{
insertClassificationBtn("Development");
insertAppList(developlist);
}
QStringList graphicslist=vector.at(5);
if (!graphicslist.isEmpty()) {
if(!graphicslist.isEmpty())
{
insertClassificationBtn("Image");
insertAppList(graphicslist);
}
QStringList gamelist=vector.at(6);
if (!gamelist.isEmpty()) {
if(!gamelist.isEmpty())
{
insertClassificationBtn("Game");
insertAppList(gamelist);
}
QStringList officelist=vector.at(7);
if (!officelist.isEmpty()) {
if(!officelist.isEmpty())
{
insertClassificationBtn("Office");
insertAppList(officelist);
}
QStringList educationlist=vector.at(8);
if (!educationlist.isEmpty()) {
if(!educationlist.isEmpty())
{
insertClassificationBtn("Education");
insertAppList(educationlist);
}
QStringList systemadminlist=vector.at(9);
if (!systemadminlist.isEmpty()) {
if(!systemadminlist.isEmpty())
{
insertClassificationBtn("System");
insertAppList(systemadminlist);
}
QStringList otherlist=vector.at(10);
if (!otherlist.isEmpty()) {
if(!otherlist.isEmpty())
{
insertClassificationBtn("Others");
insertAppList(otherlist);
}
m_scrollAreaWidLayout->addItem(m_appListBottomSpacer);
resizeScrollAreaControls();
}
void FullFunctionWidget::insertClassificationBtn(QString category)
{
SplitBarFrame *classificationbtn = new SplitBarFrame(this, category, m_scrollArea->width() - 16, 30, 2);
SplitBarFrame* classificationbtn=new SplitBarFrame(this,category,m_scrollArea->width()-12,30,2);
m_scrollAreaWidLayout->addWidget(classificationbtn);
m_classificationList.append(category);
}
void FullFunctionWidget::insertAppList(QStringList desktopfplist)
@ -194,9 +189,6 @@ void FullFunctionWidget::insertAppList(QStringList desktopfplist)
FullListView* listview=new FullListView(this,2);
//修复异常黑框问题
connect(m_scrollArea, &ScrollArea::requestUpdate, listview->viewport(), [=](){
QEventLoop loop;
QTimer::singleShot(1, &loop, SLOT(quit()));
loop.exec();
listview->repaint(listview->rect());
});
connect(listview, &FullListView::sendSetslidebar, this, &FullFunctionWidget::onSetSlider);
@ -204,11 +196,8 @@ void FullFunctionWidget::insertAppList(QStringList desktopfplist)
listview->installEventFilter(this);
m_scrollAreaWidLayout->addWidget(listview);
m_data.clear();
for (int i = 0; i < desktopfplist.count(); i++) {
for(int i=0;i<desktopfplist.count();i++)
m_data.append(desktopfplist.at(i));
}
listview->addData(m_data);
connect(listview,&FullListView::sendItemClickedSignal,this,&FullFunctionWidget::execApplication);
connect(listview,&FullListView::sendHideMainWindowSignal,this,&FullFunctionWidget::sendHideMainWindowSignal);
@ -231,7 +220,6 @@ void FullFunctionWidget::updateAppListView()
//刷新应用列表界面
QLayoutItem *child;
m_scrollAreaWidLayout->removeItem(m_appListBottomSpacer);
while ((child = m_scrollAreaWidLayout->takeAt(0)) != 0) {
QWidget* wid=child->widget();
m_scrollAreaWidLayout->removeWidget(wid);
@ -239,18 +227,15 @@ void FullFunctionWidget::updateAppListView()
delete wid;
delete child;
}
fillAppList();
//刷新图标列表界面
Q_FOREACH (QAbstractButton* button, m_buttonList){
m_btnGroup->removeButton(button);
}
m_buttonList.clear();
m_iconListScrollAreaWidLayout->removeItem(m_topSpacerItem);
m_iconListScrollAreaWidLayout->removeItem(m_bottomSpacerItem);
while ((child = m_iconListScrollAreaWidLayout->takeAt(0)) != 0) {
QWidget* wid=child->widget();
m_iconListScrollAreaWidLayout->removeWidget(wid);
@ -258,7 +243,6 @@ void FullFunctionWidget::updateAppListView()
delete wid;
delete child;
}
initIconListScrollArea();
}
@ -268,8 +252,8 @@ void FullFunctionWidget::updateAppListView()
void FullFunctionWidget::resizeScrollAreaControls()
{
int row=0;
while (row < m_scrollAreaWidLayout->count() / 2) {
while(row<m_scrollAreaWidLayout->count()/2)
{
//应用界面
QLayoutItem* widItem=m_scrollAreaWidLayout->itemAt(row*2+1);
QWidget* wid=widItem->widget();
@ -277,17 +261,19 @@ void FullFunctionWidget::resizeScrollAreaControls()
listview->adjustSize();
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
int rowcount=0;
if (listview->model()->rowCount() % dividend > 0) {
if(listview->model()->rowCount()%dividend>0)
{
rowcount=listview->model()->rowCount()/dividend+1;
} else {
}
else
{
rowcount=listview->model()->rowCount()/dividend;
}
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
row++;
}
m_scrollArea->widget()->adjustSize();
}
@ -307,14 +293,18 @@ void FullFunctionWidget::initIconListWidget()
m_iconListScrollAreaWidLayout->setSpacing(Style::LeftSpaceBetweenItem);
m_iconListScrollAreaWid->setLayout(m_iconListScrollAreaWidLayout);
m_iconListScrollArea->setWidget(m_iconListScrollAreaWid);
m_topSpacerItem=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
m_bottomSpacerItem=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
m_btnGroup=new QButtonGroup(m_iconListScrollAreaWid);
m_animation = new QPropertyAnimation(m_iconListScrollArea, "geometry");
m_scrollAnimation = new QPropertyAnimation(m_scrollArea->verticalScrollBar(), "value");
m_scrollAnimation->setEasingCurve(QEasingCurve::OutQuad);
connect(m_scrollAnimation, &QPropertyAnimation::finished, this, &FullFunctionWidget::animationFinishSlot);
connect(m_scrollAnimation, &QPropertyAnimation::valueChanged, this, &FullFunctionWidget::animationValueChangedSlot);
initIconListScrollArea();
}
@ -324,8 +314,8 @@ void FullFunctionWidget::initIconListWidget()
void FullFunctionWidget::initIconListScrollArea()
{
m_iconListScrollAreaWidLayout->addItem(m_topSpacerItem);
for (int i = 0; i < m_classificationList.size(); i++) {
for(int i=0;i<m_classificationList.size();i++)
{
FunctionClassifyButton* iconbtn=new FunctionClassifyButton(
Style::LeftBtnWidth,
Style::LeftBtnHeight,
@ -337,29 +327,25 @@ void FullFunctionWidget::initIconListScrollArea()
m_buttonList.append(iconbtn);
m_iconListScrollAreaWidLayout->addWidget(iconbtn);
}
m_iconListScrollAreaWidLayout->addItem(m_bottomSpacerItem);
int id = 0;
int id=0;
Q_FOREACH (QAbstractButton* btn, m_buttonList) {
m_btnGroup->addButton(btn,id++);
}
connect(m_btnGroup,static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),this,&FullFunctionWidget::btnGroupClickedSlot);
// m_iconListScrollArea->widget()->adjustSize();
if (m_btnGroup->button(0) != nullptr) {
if(m_btnGroup->button(0)!=nullptr)
m_btnGroup->button(0)->click();
}
}
void FullFunctionWidget::btnGroupClickedSlot(QAbstractButton *btn)
{
disconnect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
this,&FullFunctionWidget::valueChangedSlot);
Q_FOREACH (QAbstractButton* button, m_buttonList) {
if (m_btnGroup->id(btn) == m_buttonList.indexOf(button)) {
if(m_btnGroup->id(btn)==m_buttonList.indexOf(button))
{
m_beginPos=m_scrollArea->verticalScrollBar()->sliderPosition();
m_endPos=m_scrollAreaWidLayout->itemAt(m_btnGroup->id(btn)*2)->widget()->y();
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -368,7 +354,8 @@ void FullFunctionWidget::btnGroupClickedSlot(QAbstractButton *btn)
m_scrollAnimation->setEndValue(m_endPos);
m_scrollAnimation->start();
button->setChecked(true);
} else {
}
else{
button->setChecked(false);
}
}
@ -377,7 +364,8 @@ void FullFunctionWidget::btnGroupClickedSlot(QAbstractButton *btn)
void FullFunctionWidget::animationFinishSlot()
{
if(m_scrollArea->verticalScrollBar()->value()==m_endPos ||
m_scrollArea->verticalScrollBar()->value() == m_scrollArea->verticalScrollBar()->maximum()) {
m_scrollArea->verticalScrollBar()->value()==m_scrollArea->verticalScrollBar()->maximum())
{
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
this,&FullFunctionWidget::valueChangedSlot);
@ -387,47 +375,42 @@ void FullFunctionWidget::animationFinishSlot()
void FullFunctionWidget::animationValueChangedSlot(const QVariant &value)
{
Q_UNUSED(value);
if (sender() != m_scrollAnimation) {
if (sender() != m_scrollAnimation)
return;
}
QPropertyAnimation *ani = qobject_cast<QPropertyAnimation *>(sender());
if (m_endPos != ani->endValue()) {
if (m_endPos != ani->endValue())
ani->setEndValue(m_endPos);
}
}
void FullFunctionWidget::valueChangedSlot(int value)
{
int index=0;
while (index <= m_classificationList.count() - 1) {
while(index<=m_classificationList.count()-1)
{
int min=m_scrollAreaWidLayout->itemAt(2*index)->widget()->y();
int max=0;
if (index == m_classificationList.count() - 1) {
if(index==m_classificationList.count()-1)
max=m_scrollAreaWid->height();
} else {
else
max=m_scrollAreaWidLayout->itemAt(2*(index+1))->widget()->y();
}
if (value >= min && value < max) {
if(value>=min && value<max)
{
Q_FOREACH (QAbstractButton* button, m_buttonList) {
FunctionClassifyButton* fcbutton=qobject_cast<FunctionClassifyButton*>(button);
if (index == m_buttonList.indexOf(button)) {
if(index==m_buttonList.indexOf(button))
{
fcbutton->setChecked(true);
} else {
}
else{
fcbutton->setChecked(false);
}
}
break;
} else {
index++;
}
else
index++;
}
}
@ -459,6 +442,7 @@ void FullFunctionWidget::setFunctionBtnGeometry()
Style::LeftBtnWidth,
m_iconListWid->height()));
m_iconListScrollArea->show();
}
void FullFunctionWidget::repaintWidget()
@ -467,6 +451,7 @@ void FullFunctionWidget::repaintWidget()
Style::AppListWidHeight);
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
m_scrollArea->setFixedSize(m_applistWid->width(),m_applistWid->height());
m_scrollAreaWid->setFixedWidth(m_scrollArea->width() - Style::SliderSize);
m_iconListWid->setFixedSize(Style::LeftWidWidth,this->height());
m_iconListScrollAreaWid->setFixedSize(Style::LeftBtnWidth,
m_iconListWid->height());
@ -475,23 +460,19 @@ void FullFunctionWidget::repaintWidget()
void FullFunctionWidget::widgetMakeZero()
{
if (m_btnGroup->button(0) != nullptr) {
if(m_btnGroup->button(0)!=nullptr)
m_btnGroup->button(0)->click();
}
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
void FullFunctionWidget::moveScrollBar(int type)
{
int height=Style::primaryScreenHeight;
if (type == 0) {
if(type==0)
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()-height*100/1080);
} else {
else
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()+height*100/1080);
}
}
void FullFunctionWidget::onSetSlider(int value)
{
@ -507,19 +488,21 @@ void FullFunctionWidget::onSetSlider(int value)
bool FullFunctionWidget::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
if( event->type() == QEvent::KeyPress )
{
QLayoutItem* widItem = m_scrollAreaWidLayout->itemAt(2 * m_buttonList.size() - 1);
QWidget* wid = widItem->widget();
FullListView* m_listview = qobject_cast<FullListView*>(wid);
QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
QWidget* widTop = widItemTop->widget();
FullListView* m_listviewTop = qobject_cast<FullListView*>(widTop);
QKeyEvent *ke = (QKeyEvent *)event;
if (ke->key() == Qt::Key_Tab) {
QKeyEvent *ke = (QKeyEvent *)event;
if( ke->key() == Qt::Key_Tab )
{
Q_EMIT setFocusToSideWin();
}
// if(ke->key() == Qt::Key_Up)
// {
// QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
@ -548,49 +531,51 @@ bool FullFunctionWidget::eventFilter(QObject *watched, QEvent *event)
// }
// }
if (ke->key() == Qt::Key_Up) {
if (!m_listviewTop->hasFocus()) {
if(ke->key() == Qt::Key_Up)
{
if(!m_listviewTop->hasFocus())
{
QAbstractButton* buttonTop = getCurLetterButton(( --m_index) % m_buttonList.size());
btnGroupClickedSlot(buttonTop);
this->m_scrollArea->setFocusToPreChild();
} else {
}
else
{
m_listview->setFocus();
QAbstractButton* button = getCurLetterButton(m_buttonList.size() - 1);
btnGroupClickedSlot(button);
m_index = m_buttonList.size() - 1;
}
Q_EMIT selectFirstItem();
return true;
}
if (ke->key() == Qt::Key_Down) {
if (!m_listview->hasFocus()) {
if(ke->key() == Qt::Key_Down)
{
if(!m_listview->hasFocus())
{
QAbstractButton* button = getCurLetterButton(( ++m_index) % m_buttonList.size());
btnGroupClickedSlot(button);
this->m_scrollArea->setFocusToNextChild();
} else {
}
else
{
m_listviewTop->setFocus();
QAbstractButton* buttonTop = getCurLetterButton(0);
btnGroupClickedSlot(buttonTop);
m_listviewTop->setCurrentIndex(m_listviewTop->model()->index(0,0));
m_index = 0;
}
Q_EMIT selectFirstItem();
return true;
}
}
return QWidget::eventFilter(watched,event);
}
void FullFunctionWidget::functionButtonClick()
{
if (m_btnGroup->button(0) != nullptr) {
if(m_btnGroup->button(0)!=nullptr)
m_btnGroup->button(0)->click();
}
m_index = 0;
}

View File

@ -28,10 +28,7 @@ FunctionWidget::FunctionWidget(QWidget *parent) :
FunctionWidget::~FunctionWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
/**
@ -43,12 +40,15 @@ void FunctionWidget::initUi()
this->setAttribute(Qt::WA_StyledBackground,true);
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
m_ukuiMenuInterface=new UkuiMenuInterface;
initAppListWidget();
m_functionBtnWid=new FunctionButtonWidget(this);
m_functionBtnWid->hide();
connect(this,&FunctionWidget::sendClassificationbtnList,m_functionBtnWid,&FunctionButtonWidget::recvClassificationBtnList);
connect(m_functionBtnWid, &FunctionButtonWidget::sendFunctionBtnSignal,this,&FunctionWidget::recvFunctionBtnSignal);
m_enterAnimation=new QPropertyAnimation;
m_enterAnimation->setPropertyName(QString("geometry").toLocal8Bit());
m_leaveAnimation=new QPropertyAnimation;
@ -68,7 +68,6 @@ void FunctionWidget::initAppListWidget()
fillAppListView(0);
connect(m_appListView,&ListView::sendItemClickedSignal,this,&FunctionWidget::recvItemClickedSlot);
connect(m_appListView,&ListView::sendHideMainWindowSignal,this,&FunctionWidget::sendHideMainWindowSignal);
connect(m_appListView, &ListView::sendMainWinActiveSignal, this, &FunctionWidget::sendMainWinActiveSignal);
}
@ -83,88 +82,78 @@ void FunctionWidget::fillAppListView(int type)
m_classificationBtnRowList.clear();
QVector<QStringList> vector=UkuiMenuInterface::functionalVector;
QStringList androidlist=vector.at(0);
if (!androidlist.isEmpty()) {
if(!androidlist.isEmpty())
{
insertClassificationBtn(tr("Mobile"));
insertAppList(androidlist);
}
QStringList netlist=vector.at(1);
if (!netlist.isEmpty()) {
if(!netlist.isEmpty())
{
insertClassificationBtn(tr("Internet"));
insertAppList(netlist);
}
QStringList sociallist=vector.at(2);
if (!sociallist.isEmpty()) {
if(!sociallist.isEmpty())
{
insertClassificationBtn(tr("Social"));
insertAppList(sociallist);
}
QStringList avlist=vector.at(3);
if (!avlist.isEmpty()) {
if(!avlist.isEmpty())
{
insertClassificationBtn(tr("Video"));
insertAppList(avlist);
}
QStringList developlist=vector.at(4);
if (!developlist.isEmpty()) {
if(!developlist.isEmpty())
{
insertClassificationBtn(tr("Development"));
insertAppList(developlist);
}
QStringList graphicslist=vector.at(5);
if (!graphicslist.isEmpty()) {
if(!graphicslist.isEmpty())
{
insertClassificationBtn(tr("Image"));
insertAppList(graphicslist);
}
QStringList gamelist=vector.at(6);
if (!gamelist.isEmpty()) {
if(!gamelist.isEmpty())
{
insertClassificationBtn(tr("Game"));
insertAppList(gamelist);
}
QStringList officelist=vector.at(7);
if (!officelist.isEmpty()) {
if(!officelist.isEmpty())
{
insertClassificationBtn(tr("Office"));
insertAppList(officelist);
}
QStringList educationlist=vector.at(8);
if (!educationlist.isEmpty()) {
if(!educationlist.isEmpty())
{
insertClassificationBtn(tr("Education"));
insertAppList(educationlist);
}
QStringList systemadminlist=vector.at(9);
if (!systemadminlist.isEmpty()) {
if(!systemadminlist.isEmpty())
{
insertClassificationBtn(tr("System"));
insertAppList(systemadminlist);
}
QStringList otherlist=vector.at(10);
if (!otherlist.isEmpty()) {
if(!otherlist.isEmpty())
{
insertClassificationBtn(tr("Others"));
insertAppList(otherlist);
}
if (type == 0) {
if(type==0)
m_appListView->addData(m_data);
} else {
else
m_appListView->updateData(m_data);
}
}
void FunctionWidget::insertClassificationBtn(QString btnname)
{
@ -176,20 +165,17 @@ void FunctionWidget::insertClassificationBtn(QString btnname)
void FunctionWidget::insertAppList(QStringList appnamelist)
{
row+=(appnamelist.count()+1);
for (int i = 0; i < appnamelist.count(); i++) {
for(int i=0;i<appnamelist.count();i++)
m_data.append(QStringList()<<appnamelist.at(i)<<"1");
}
}
void FunctionWidget::recvItemClickedSlot(QStringList arg)
{
if (arg.at(1).toInt() == 0) {
if(arg.at(1).toInt()==0)
appClassificationBtnClickedSlot();
} else {
else
execApplication(arg.at(0));
}
}
/**
*
@ -223,6 +209,7 @@ void FunctionWidget::appClassificationBtnClickedSlot()
Style::LeftBtnHeight*6+25));
m_leaveAnimation->setDuration(10);
m_enterAnimation->setDuration(100);
//加载FunctionButtonWidget界面
Q_EMIT sendClassificationbtnList();
m_leaveAnimation->setTargetObject(m_appListView);
@ -238,8 +225,8 @@ void FunctionWidget::recvFunctionBtnSignal(QString btnname)
{
//此处需实现将功能为btnname的应用列表移动到applistWid界面最顶端
int index=m_classificationList.indexOf(btnname);
if (index != -1) {
if(index!=-1)
{
int row=m_classificationBtnRowList.at(index).toInt();
m_appListView->verticalScrollBar()->setValue(row);
}
@ -254,6 +241,7 @@ void FunctionWidget::recvFunctionBtnSignal(QString btnname)
m_enterAnimation->setEndValue(QRect(6,0,this->width()-6,this->height()-6));
m_leaveAnimation->setDuration(100);
m_enterAnimation->setDuration(10);
m_leaveAnimation->setTargetObject(m_functionBtnWid);
m_enterAnimation->setTargetObject(m_appListView);
m_leaveAnimation->start();
@ -262,14 +250,15 @@ void FunctionWidget::recvFunctionBtnSignal(QString btnname)
void FunctionWidget::animationFinishedSLot()
{
if (m_widgetState == 1) {
if(m_widgetState==1)
{
m_appListView->hide();
m_enterAnimation->start();
m_widgetState=-1;
m_functionBtnWid->show();
}
if (m_widgetState == 0) {
if(m_widgetState==0)
{
m_functionBtnWid->hide();
m_enterAnimation->start();
m_widgetState=-1;
@ -287,12 +276,11 @@ void FunctionWidget::widgetMakeZero()
void FunctionWidget::moveScrollBar(int type)
{
if (type == 0) {
if(type==0)
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()-100);
} else {
else
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()+100);
}
}
void FunctionWidget::repaintWidget()
{

View File

@ -132,8 +132,6 @@ Q_SIGNALS:
* @brief Send a hidden main window signal to the MainViewWidget
*/
void sendHideMainWindowSignal();
void sendMainWinActiveSignal(bool flag);
};
#endif // FUNCTIONWIDGET_H

View File

@ -144,7 +144,7 @@ void UkuiMenuInterface::recursiveSearchFile(const QString& _filePath)
} while(i < list.size());
}
//获取系统desktop文件路径
//获取系统deskyop文件路径
QStringList UkuiMenuInterface::getDesktopFilePath()
{
filePathList.clear();
@ -176,6 +176,7 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
{
getAndroidApp();
recursiveSearchFile("/usr/share/applications/");
recursiveSearchFile(QDir::homePath()+"/.local/share/applications/");
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
QJsonArray blArray=obj.value("blacklist").toArray();
@ -191,6 +192,7 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
{
getAndroidApp();
recursiveSearchFile("/usr/share/applications/");
recursiveSearchFile(QDir::homePath()+"/.local/share/applications/");
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
}
@ -203,6 +205,7 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
{
getAndroidApp();
recursiveSearchFile("/usr/share/applications/");
recursiveSearchFile(QDir::homePath()+"/.local/share/applications/");
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
}
@ -247,21 +250,6 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
filePathList.removeAll("/usr/share/applications/wps-office-uninstall.desktop");
filePathList.removeAll("/usr/share/applications/wps-office-misc.desktop");
QStringList desktopList;
for(int i = 0; i < filePathList.count(); ++i)
{
QString filepath = filePathList.at(i);
int list_index = filepath.lastIndexOf('/');
QString desktopName = filepath.right(filepath.length() - list_index - 1);
if(desktopList.contains(desktopName)){
filePathList.removeAll(filepath);
i--;
}
else
{
desktopList.append(desktopName);
}
}
return filePathList;
}
@ -289,7 +277,6 @@ QVector<QStringList> UkuiMenuInterface::createAppInfoVector()
QStringList appInfoList;
QString desktopfp=desktopfpList.at(i);
QString name=getAppName(desktopfpList.at(i));
if(!name.isEmpty())
{
QString englishName=getAppEnglishName(desktopfpList.at(i));
@ -847,21 +834,21 @@ void UkuiMenuInterface::getAndroidApp()
QByteArray fpbyte=filePathStr.toLocal8Bit();
char* filepath=fpbyte.data();
g_key_file_load_from_file(keyfile,filepath,flags,error);
// char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","Categories", nullptr, nullptr);
// if(ret_1!=nullptr)
// {
// QString str=QString::fromLocal8Bit(ret_1);
// if(!str.contains("Android"))
// {
// i++;
// continue;
// }
// else
// {
char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","Categories", nullptr, nullptr);
if(ret_1!=nullptr)
{
QString str=QString::fromLocal8Bit(ret_1);
if(!str.contains("Android"))
{
i++;
continue;
}
else
{
filePathList.append(filePathStr);
androidDesktopfnList.append(fileInfo.fileName());
// }
// }
}
}
i++;
}while(i < list.size());

View File

@ -28,10 +28,9 @@ FullLetterWidget::FullLetterWidget(QWidget *parent) :
FullLetterWidget::~FullLetterWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
delete m_letterListBottomSpacer;
delete m_appListBottomSpacer;
}
/**
@ -42,12 +41,14 @@ void FullLetterWidget::initUi()
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
this->setAttribute(Qt::WA_TranslucentBackground);
m_applistWid=new QWidget(this);
m_letterListWid=new QWidget(this);
this->setFixedSize(Style::MainViewWidWidth,
Style::AppListWidHeight);
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
m_letterListWid->setFixedSize(Style::LeftWidWidth,this->height());
QHBoxLayout* mainLayout=new QHBoxLayout;
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->setSpacing(0);
@ -55,13 +56,16 @@ void FullLetterWidget::initUi()
mainLayout->addWidget(m_applistWid);
this->setLayout(mainLayout);
m_ukuiMenuInterface=new UkuiMenuInterface;
initAppListWidget();
initLetterListWidget();
flag = true;
//翻页灵敏度时间调节
time = new QTimer(this);
connect(time,&QTimer::timeout,[=](){
if (flag == false) {
if(flag == false)
{
flag = true;
time->stop();
}
@ -76,6 +80,7 @@ void FullLetterWidget::initAppListWidget()
QHBoxLayout* layout=new QHBoxLayout(m_applistWid);
layout->setContentsMargins(0,0,0,0);
m_applistWid->setLayout(layout);
m_scrollArea=new ScrollArea;
m_scrollAreaWid=new ScrollAreaWid;
m_scrollArea->setWidget(m_scrollAreaWid);
@ -89,6 +94,7 @@ void FullLetterWidget::initAppListWidget()
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
this,&FullLetterWidget::valueChangedSlot);
m_appListBottomSpacer=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
fillAppList();
}
@ -106,25 +112,23 @@ void FullLetterWidget::fillAppList()
{
m_letterList.clear();
QVector<QStringList> vector=UkuiMenuInterface::alphabeticVector;
for (int i = 0; i < vector.size(); i++) {
for(int i=0;i<vector.size();i++)
{
QStringList appList=vector.at(i);
if (!appList.isEmpty()) {
if(!appList.isEmpty())
{
QString letterstr;
if (i < 26) {
if(i<26)
letterstr=QString(QChar(static_cast<char>(i+65)));
} else if (i == 26) {
else if(i==26)
letterstr="&";
} else {
else
letterstr="#";
}
m_letterList.append(letterstr);//存储分类字符
//插入字母分类按钮
SplitBarFrame *letterbtn = new SplitBarFrame(this, letterstr, m_scrollArea->width() - 16, 30, 1);
SplitBarFrame* letterbtn=new SplitBarFrame(this,letterstr,m_scrollArea->width()-12,30,1);
m_scrollAreaWidLayout->addWidget(letterbtn);
//插入应用列表
FullListView* listview=new FullListView(this,1);
connect(listview, &FullListView::sendSetslidebar,this,&FullLetterWidget::onSetSlider);
@ -132,25 +136,22 @@ void FullLetterWidget::fillAppList()
listview->installEventFilter(this);
//修复异常黑框问题
connect(m_scrollArea, &ScrollArea::requestUpdate, listview->viewport(), [=](){
QEventLoop loop;
QTimer::singleShot(1, &loop, SLOT(quit()));
loop.exec();
listview->repaint(listview->rect());
});
m_scrollAreaWidLayout->addWidget(listview);
m_data.clear();
for (int i = 0; i < appList.count(); i++) {
for(int i=0;i<appList.count();i++)
m_data.append(appList.at(i));
}
listview->addData(m_data);
connect(listview,&FullListView::sendItemClickedSignal,this,&FullLetterWidget::execApplication);
connect(listview,&FullListView::sendHideMainWindowSignal,this,&FullLetterWidget::sendHideMainWindowSignal);
}
}
m_scrollAreaWidLayout->addItem(m_appListBottomSpacer);
resizeScrollAreaControls();
}
@ -171,7 +172,6 @@ void FullLetterWidget::updateAppListView()
//刷新应用列表界面
QLayoutItem *child;
m_scrollAreaWidLayout->removeItem(m_appListBottomSpacer);
while ((child = m_scrollAreaWidLayout->takeAt(0)) != 0) {
QWidget* wid=child->widget();
m_scrollAreaWidLayout->removeWidget(wid);
@ -179,17 +179,14 @@ void FullLetterWidget::updateAppListView()
delete wid;
delete child;
}
fillAppList();
//刷新字母列表界面
Q_FOREACH (QAbstractButton* button, m_buttonList) {
m_btnGroup->removeButton(button);
}
m_buttonList.clear();
m_letterListScrollAreaWidLayout->removeItem(m_letterListBottomSpacer);
while ((child = m_letterListScrollAreaWidLayout->takeAt(0)) != 0) {
QWidget* wid=child->widget();
m_letterListScrollAreaWidLayout->removeWidget(wid);
@ -208,26 +205,29 @@ void FullLetterWidget::updateAppListView()
void FullLetterWidget::resizeScrollAreaControls()
{
int row=0;
while (row < m_scrollAreaWidLayout->count() / 2) {
while(row<m_scrollAreaWidLayout->count()/2)
{
//应用界面
QLayoutItem* widItem=m_scrollAreaWidLayout->itemAt(row*2+1);
QWidget* wid=widItem->widget();
FullListView* listview=qobject_cast<FullListView*>(wid);
listview->adjustSize();
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
int rowcount = 0;
if (listview->model()->rowCount() % dividend > 0) {
int rowcount=0;
if(listview->model()->rowCount()%dividend>0)
{
rowcount=listview->model()->rowCount()/dividend+1;
} else {
}
else
{
rowcount=listview->model()->rowCount()/dividend;
}
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
row++;
}
m_scrollArea->widget()->adjustSize();
}
@ -244,13 +244,16 @@ void FullLetterWidget::initLetterListWidget()
m_letterListScrollAreaWid->setLayout(m_letterListScrollAreaWidLayout);
m_letterListScrollArea->setWidget(m_letterListScrollAreaWid);
m_letterListScrollArea->setWidgetResizable(true);
m_letterListBottomSpacer=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
m_btnGroup=new QButtonGroup(m_letterListScrollAreaWid);
m_animation = new QPropertyAnimation(m_letterListScrollArea, "geometry");
m_scrollAnimation = new QPropertyAnimation(m_scrollArea->verticalScrollBar(), "value");
m_scrollAnimation->setEasingCurve(QEasingCurve::OutQuad);
connect(m_scrollAnimation, &QPropertyAnimation::finished, this, &FullLetterWidget::animationFinishSlot);
connect(m_scrollAnimation, &QPropertyAnimation::valueChanged, this, &FullLetterWidget::animationValueChangedSlot);
initLetterListScrollArea();
}
@ -259,11 +262,10 @@ void FullLetterWidget::initLetterListWidget()
*/
void FullLetterWidget::initLetterListScrollArea()
{
if (m_letterList.contains("&")) {
if(m_letterList.contains("&"))
m_letterList.replace(m_letterList.indexOf("&"),"&&");
}
for (int i = 0; i < m_letterList.size(); i++) {
for(int i=0;i<m_letterList.size();i++)
{
LetterClassifyButton* letterbtn=new LetterClassifyButton(m_letterListScrollAreaWid,
true,
m_letterList.at(i));
@ -273,37 +275,33 @@ void FullLetterWidget::initLetterListScrollArea()
m_letterListScrollAreaWidLayout->setAlignment(letterbtn,Qt::AlignHCenter);
connect(letterbtn,&LetterClassifyButton::buttonClicked,m_btnGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked));
}
m_letterListScrollAreaWidLayout->addItem(m_letterListBottomSpacer);
int id = 0;
int id=0;
Q_FOREACH (QAbstractButton* btn, m_buttonList) {
m_btnGroup->addButton(btn,id++);
}
connect(m_btnGroup,static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),this,&FullLetterWidget::btnGroupClickedSlot);
m_letterListScrollArea->widget()->adjustSize();
if (m_btnGroup->button(0) != nullptr) {
if(m_btnGroup->button(0)!=nullptr)
m_btnGroup->button(0)->click();
}
}
void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn)
{
disconnect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
this,&FullLetterWidget::valueChangedSlot);
Q_FOREACH (QAbstractButton* button, m_buttonList) {
LetterClassifyButton* letterbtn=qobject_cast<LetterClassifyButton*>(button);
if (m_btnGroup->id(btn) == m_buttonList.indexOf(button)) {
if(m_btnGroup->id(btn)==m_buttonList.indexOf(button))
{
letterbtn->setChecked(true);
//此处需实现将被选定的字母包含的应用列表移动到applistWid界面最顶端
QString letterstr=letterbtn->text();
int num=m_letterList.indexOf(letterstr);
if (num != -1) {
if(num!=-1)
{
m_beginPos=m_scrollArea->verticalScrollBar()->sliderPosition();
m_endPos=m_scrollAreaWidLayout->itemAt(m_btnGroup->id(btn)*2)->widget()->y();
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -312,7 +310,8 @@ void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn)
m_scrollAnimation->setEndValue(m_endPos);
m_scrollAnimation->start();
}
} else {
}
else{
letterbtn->setChecked(false);
}
}
@ -321,7 +320,8 @@ void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn)
void FullLetterWidget::animationFinishSlot()
{
if(m_scrollArea->verticalScrollBar()->value()==m_endPos ||
m_scrollArea->verticalScrollBar()->value() == m_scrollArea->verticalScrollBar()->maximum()) {
m_scrollArea->verticalScrollBar()->value()==m_scrollArea->verticalScrollBar()->maximum())
{
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
this,&FullLetterWidget::valueChangedSlot);
@ -331,47 +331,44 @@ void FullLetterWidget::animationFinishSlot()
void FullLetterWidget::animationValueChangedSlot(const QVariant &value)
{
Q_UNUSED(value);
if (sender() != m_scrollAnimation) {
if (sender() != m_scrollAnimation)
return;
}
QPropertyAnimation *ani = qobject_cast<QPropertyAnimation *>(sender());
if (m_endPos != ani->endValue()) {
if (m_endPos != ani->endValue())
ani->setEndValue(m_endPos);
}
}
void FullLetterWidget::valueChangedSlot(int value)
{
int index=0;
while (index <= m_letterList.count() - 1) {
while(index<=m_letterList.count()-1)
{
int min=m_scrollAreaWidLayout->itemAt(2*index)->widget()->y();
int max=0;
if (index == m_letterList.count() - 1) {
if(index==m_letterList.count()-1)
max=m_scrollAreaWid->height();
} else {
else
max=m_scrollAreaWidLayout->itemAt(2*(index+1))->widget()->y();
}
if (value >= min && value < max) {
if(value>=min && value <max)
{
Q_FOREACH (QAbstractButton* button, m_buttonList) {
LetterClassifyButton* letterbtn=qobject_cast<LetterClassifyButton*>(button);
if (index == m_buttonList.indexOf(button)) {
if(index==m_buttonList.indexOf(button))
{
letterbtn->setChecked(true);
} else {
}
else
{
letterbtn->setChecked(false);
}
}
break;
} else {
index++;
}
else
index++;
}
// //向下滚动
@ -380,12 +377,15 @@ void FullLetterWidget::valueChangedSlot(int value)
// int val=m_letterListScrollArea->verticalScrollBar()->sliderPosition()+m_buttonList.at(index)->height();
// m_letterListScrollArea->verticalScrollBar()->setSliderPosition(val);
// }
// //向上滚动
// if((m_buttonList.at(index)->pos().y()+m_letterListScrollArea->widget()->pos().y()) <= 0)
// {
// int val=m_letterListScrollArea->verticalScrollBar()->value()-m_buttonList.at(index)->height();
// m_letterListScrollArea->verticalScrollBar()->setSliderPosition(val);
// }
}
void FullLetterWidget::enterAnimation()
@ -417,6 +417,7 @@ void FullLetterWidget::repaintWidget()
Style::AppListWidHeight);
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
m_scrollArea->setFixedSize(m_applistWid->width(),m_applistWid->height());
m_scrollAreaWid->setFixedWidth(m_scrollArea->width() - Style::SliderSize);
m_letterListWid->setFixedSize(Style::LeftWidWidth,this->height());
updateAppListView();
}
@ -426,27 +427,24 @@ void FullLetterWidget::widgetMakeZero()
Q_FOREACH (QAbstractButton* button, m_buttonList) {
QString letterstr=button->text().at(0);
int num=m_letterList.indexOf(letterstr);
if (num != -1) {
if(num!=-1)
{
m_btnGroup->button(num)->click();
m_letterListScrollArea->verticalScrollBar()->setSliderPosition(0);
break;
}
}
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
void FullLetterWidget::moveScrollBar(int type)
{
int height=Style::primaryScreenHeight;
if (type == 0) {
if(type==0)
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()-height*100/1080);
} else {
else
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()+height*100/1080);
}
}
void FullLetterWidget::onSetSlider(int value)
{
@ -466,63 +464,67 @@ QAbstractButton *FullLetterWidget::getCurLetterButton(int value)
bool FullLetterWidget::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
if( event->type() == QEvent::KeyPress )
{
QLayoutItem* widItem = m_scrollAreaWidLayout->itemAt(2 * m_buttonList.size() - 1);
QWidget* wid = widItem->widget();
FullListView* m_listview = qobject_cast<FullListView*>(wid);
QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
QWidget* widTop = widItemTop->widget();
FullListView* m_listviewTop = qobject_cast<FullListView*>(widTop);
QKeyEvent *ke = (QKeyEvent *)event;
if (ke->key() == Qt::Key_Tab) {
QKeyEvent *ke = (QKeyEvent *)event;
if( ke->key() == Qt::Key_Tab )
{
// m_letterListScrollAreaWid->setFocus();
// m_letterListScrollArea->setFocus();
// return true;
Q_EMIT setFocusToSideWin();
}
if (ke->key() == Qt::Key_Up) {
if (!m_listviewTop->hasFocus()) {
if(ke->key() == Qt::Key_Up)
{
if(!m_listviewTop->hasFocus())
{
QAbstractButton* buttonTop = getCurLetterButton(( --m_index) % m_buttonList.size());
btnGroupClickedSlot(buttonTop);
this->m_scrollArea->setFocusToPreChild();
} else {
}
else
{
m_listview->setFocus();
QAbstractButton* button = getCurLetterButton(m_buttonList.size() - 1);
btnGroupClickedSlot(button);
m_index = m_buttonList.size() - 1;
}
Q_EMIT selectFirstItem();
return true;
}
if (ke->key() == Qt::Key_Down) {
if (!m_listview->hasFocus()) {
if(ke->key() == Qt::Key_Down)
{
if(!m_listview->hasFocus())
{
QAbstractButton* button = getCurLetterButton(( ++m_index) % m_buttonList.size());
btnGroupClickedSlot(button);
this->m_scrollArea->setFocusToNextChild();
} else {
}
else
{
m_listviewTop->setFocus();
QAbstractButton* buttonTop = getCurLetterButton(0);
btnGroupClickedSlot(buttonTop);
m_index = 0;
}
Q_EMIT selectFirstItem();
return true;
}
}
return QWidget::eventFilter(watched,event);
}
void FullLetterWidget::letterButtonClick()
{
if (m_btnGroup->button(0) != nullptr) {
if(m_btnGroup->button(0)!=nullptr)
m_btnGroup->button(0)->click();
}
m_index = 0;
}

View File

@ -38,10 +38,7 @@ LetterWidget::LetterWidget(QWidget *parent) :
LetterWidget::~LetterWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
/**
@ -53,12 +50,15 @@ void LetterWidget::initUi()
this->setAttribute(Qt::WA_StyledBackground,true);
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
m_ukuiMenuInterface=new UkuiMenuInterface;
initAppListWidget();
m_letterBtnWid=new LetterButtonWidget(this);
m_letterBtnWid->hide();
connect(this,&LetterWidget::sendLetterBtnList,m_letterBtnWid,&LetterButtonWidget::recvLetterBtnList);
connect(m_letterBtnWid, &LetterButtonWidget::sendLetterBtnSignal,this,&LetterWidget::recvLetterBtnSlot);
m_enterAnimation=new QPropertyAnimation;
m_enterAnimation->setPropertyName(QString("geometry").toLocal8Bit());
m_leaveAnimation=new QPropertyAnimation;
@ -78,7 +78,6 @@ void LetterWidget::initAppListWidget()
fillAppListView();
connect(m_appListView,&ListView::sendItemClickedSignal,this,&LetterWidget::recvItemClickedSlot);
connect(m_appListView,&ListView::sendHideMainWindowSignal,this,&LetterWidget::sendHideMainWindowSignal);
connect(m_appListView, &ListView::sendMainWinActiveSignal, this, &LetterWidget::sendMainWinActiveSignal);
}
@ -90,30 +89,25 @@ void LetterWidget::fillAppListView()
m_data.clear();
int row=0;
QVector<QStringList> vector=UkuiMenuInterface::alphabeticVector;
for (int i = 0; i < vector.size(); i++) {
for(int i=0;i<vector.size();i++)
{
QStringList appList=vector.at(i);
if (!appList.isEmpty()) {
if(!appList.isEmpty())
{
QString letterstr;
if (i < 26) {
if(i<26)
letterstr=QString(QChar(static_cast<char>(i+65)));
} else if (i == 26) {
else if(i==26)
letterstr="&";
} else {
else
letterstr="#";
}
m_letterList.append(letterstr);//存储分类字符
m_letterBtnRowList.append(QString::number(row));//存储分类字符所在行
m_data.append(QStringList()<<letterstr<<"0");
for (int i = 0; i < appList.count(); i++) {
for(int i=0;i<appList.count();i++)
m_data.append(QStringList()<<appList.at(i)<<"1");
}
row+=(appList.count()+1);
}
}
@ -122,12 +116,11 @@ void LetterWidget::fillAppListView()
void LetterWidget::recvItemClickedSlot(QStringList arg)
{
if (arg.at(1).toInt() == 0) {
if(arg.at(1).toInt()==0)
appClassificationBtnClickedSlot();
} else {
else
execApplication(arg.at(0));
}
}
/**
*
@ -148,33 +141,27 @@ void LetterWidget::updateAppListView()
m_letterList.clear();
m_letterBtnRowList.clear();
QVector<QStringList> vector=UkuiMenuInterface::alphabeticVector;
for (int i = 0; i < vector.size(); i++) {
for(int i=0;i<vector.size();i++)
{
QStringList appList=vector.at(i);
if (!appList.isEmpty()) {
if(!appList.isEmpty())
{
QString letterstr;
if (i < 26) {
if(i<26)
letterstr=QString(QChar(static_cast<char>(i+65)));
} else if (i == 26) {
else if(i==26)
letterstr="&";
} else {
else
letterstr="#";
}
m_letterList.append(letterstr);//存储分类字符
m_letterBtnRowList.append(QString::number(row));//存储分类字符所在行
m_data.append(QStringList()<<letterstr<<"0");
for (int i = 0; i < appList.count(); i++) {
for(int i=0;i<appList.count();i++)
m_data.append(QStringList()<<appList.at(i)<<"1");
}
row+=(appList.count()+1);
}
}
}
}
m_appListView->updateData(m_data);
}
@ -188,6 +175,7 @@ void LetterWidget::appClassificationBtnClickedSlot()
// m_leaveAnimation->setEndValue(QRect(20,20,this->width()-40,this->height()-40));
m_enterAnimation->setStartValue(QRect(-40,-40,this->width()+80,this->height()+80));
m_enterAnimation->setEndValue(QRect((this->width()-235)/2,(this->height()-366)/2,235,366));
//加载LetterBUttonWidget界面
m_enterAnimation->setDuration(100);
m_leaveAnimation->setDuration(10);
@ -205,8 +193,8 @@ void LetterWidget::recvLetterBtnSlot(QString btnname)
{
//此处需实现将字母为btnname的应用列表移动到applistWid界面最顶端
int num=m_letterList.indexOf(QString(QChar(btnname.at(0))));
if (num != -1) {
if(num!=-1)
{
int row=m_letterBtnRowList.at(num).toInt();
m_appListView->verticalScrollBar()->setValue(row);
}
@ -216,6 +204,7 @@ void LetterWidget::recvLetterBtnSlot(QString btnname)
// m_enterAnimation->setStartValue(QRect(16,10,this->width()-20,this->height()-20));
m_enterAnimation->setStartValue(QRect(6,0,this->width()-6,this->height()-6));
m_enterAnimation->setEndValue(QRect(6,0,this->width()-6,this->height()-6));
m_enterAnimation->setDuration(10);
m_leaveAnimation->setDuration(100);
m_leaveAnimation->setTargetObject(m_letterBtnWid);
@ -226,14 +215,15 @@ void LetterWidget::recvLetterBtnSlot(QString btnname)
void LetterWidget::animationFinishedSLot()
{
if (m_widgetState == 1) {
if(m_widgetState==1)
{
m_enterAnimation->start();
m_widgetState=-1;
m_appListView->hide();
m_letterBtnWid->show();
}
if (m_widgetState == 0) {
if(m_widgetState==0)
{
m_enterAnimation->start();
m_widgetState=-1;
m_letterBtnWid->hide();
@ -251,12 +241,11 @@ void LetterWidget::widgetMakeZero()
void LetterWidget::moveScrollBar(int type)
{
if (type == 0) {
if(type==0)
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()-100);
} else {
else
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()+100);
}
}
void LetterWidget::repaintWidget()
{

View File

@ -122,7 +122,6 @@ Q_SIGNALS:
* @brief Send a hidden main window signal to the MainViewWidget
*/
void sendHideMainWindowSignal();
void sendMainWinActiveSignal(bool flag);
};
#endif // LETTERWIDGET_H

View File

@ -28,10 +28,7 @@ DirectoryChangedThread::DirectoryChangedThread()
DirectoryChangedThread::~DirectoryChangedThread()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void DirectoryChangedThread::run()
@ -39,19 +36,26 @@ void DirectoryChangedThread::run()
closeDataBase("DirectoryChangedThread");
openDataBase("DirectoryChangedThread");
QStringList desktopfpList=m_ukuiMenuInterface->getDesktopFilePath();
if (desktopfpList.size() >= UkuiMenuInterface::desktopfpVector.size()) { //有新的应用安装
for (int i = 0; i < desktopfpList.count(); i++) {
if (!UkuiMenuInterface::desktopfpVector.contains(desktopfpList.at(i))) {
if(desktopfpList.size() >= UkuiMenuInterface::desktopfpVector.size())//有新的应用安装
{
for(int i=0;i<desktopfpList.count();i++)
{
if(!UkuiMenuInterface::desktopfpVector.contains(desktopfpList.at(i)))
{
QFileInfo fileInfo(desktopfpList.at(i));
QString desktopfn=fileInfo.fileName();
updateDataBaseTableRecent(desktopfn);
//break;
}
}
} else { //软件卸载
for (int i = 0; i < UkuiMenuInterface::desktopfpVector.size(); i++) {
if (!desktopfpList.contains(UkuiMenuInterface::desktopfpVector.at(i))) {
}
else//软件卸载
{
for(int i=0;i<UkuiMenuInterface::desktopfpVector.size();i++)
{
if(!desktopfpList.contains(UkuiMenuInterface::desktopfpVector.at(i)))
{
QString desktopfp=UkuiMenuInterface::appInfoVector.at(i).at(0);
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();

View File

@ -34,10 +34,12 @@ MainViewWidget::MainViewWidget(QWidget *parent) :
MainViewWidget::~MainViewWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
delete m_fileWatcher;
delete m_directoryChangedThread;
delete m_animation;
delete m_searchAppThread;
}
void MainViewWidget::initUi()
@ -50,10 +52,13 @@ void MainViewWidget::initUi()
mainLayout->setSpacing(0);
m_topWidget=new QWidget;
m_contentWid=new QWidget;
mainLayout->addWidget(m_topWidget);
mainLayout->addWidget(m_contentWid);
this->setLayout(mainLayout);
this->setFocusPolicy(Qt::NoFocus);
m_commonUseWid=new CommonUseWidget(m_contentWid);
m_fullCommonUseWid=new FullCommonUseWidget(m_contentWid);
m_letterWid=new LetterWidget(m_contentWid);
@ -63,16 +68,17 @@ void MainViewWidget::initUi()
m_fullSearchResultWid=new FullSearchResultWidget(m_contentWid);
m_searchResultWid=new SearchResultWidget(m_contentWid);
hideWidget();
m_ukuiMenuInterface=new UkuiMenuInterface;
//监控.desktop文件目录
m_fileWatcher = new QFileSystemWatcher(this);
m_fileWatcher=new QFileSystemWatcher;
m_fileWatcher->addPaths(QStringList()<<QString("/usr/share/applications")
<<QString(QDir::homePath()+"/.local/share/applications/")
<<QString("/var/lib/snapd/desktop/applications/")
<<QString("/var/lib/flatpak/exports/share/applications/"));
connect(m_fileWatcher,&QFileSystemWatcher::directoryChanged,this,&MainViewWidget::directoryChangedSlot);
m_directoryChangedThread=new DirectoryChangedThread;
m_directoryChangedThread->setParent(this);
connect(m_directoryChangedThread,&DirectoryChangedThread::requestUpdateSignal,this,&MainViewWidget::requestUpdateSlot);
connect(this,&MainViewWidget::directoryChangedSignal,m_letterWid,&LetterWidget::updateAppListView);
connect(this,&MainViewWidget::directoryChangedSignal,m_fullLetterWid,&FullLetterWidget::updateAppListView);
@ -88,6 +94,8 @@ void MainViewWidget::initUi()
connect(this, &MainViewWidget::selectFirstItemTab, m_fullCommonUseWid, &FullCommonUseWidget::selectFirstItemTab);
connect(this, &MainViewWidget::selectFirstItemTab, m_fullLetterWid, &FullLetterWidget::setFocusToThis);
connect(this, &MainViewWidget::selectFirstItemTab, m_fullFunctionWid, &FullFunctionWidget::setFocusToThis);
connect(this, &MainViewWidget::setSlideBar, m_fullCommonUseWid, &FullCommonUseWidget::onSetSlider);
connect(m_fullLetterWid,&FullLetterWidget::setFocusToSideWin,this,&MainViewWidget::setFocusToSideWin);
connect(m_fullFunctionWid,&FullFunctionWidget::setFocusToSideWin,this,&MainViewWidget::setFocusToSideWin);
@ -100,10 +108,7 @@ void MainViewWidget::initUi()
connect(m_fullFunctionWid,&FullFunctionWidget::sendHideMainWindowSignal,this,&MainViewWidget::sendHideMainWindowSignal);
connect(m_searchResultWid,&SearchResultWidget::sendHideMainWindowSignal,this,&MainViewWidget::sendHideMainWindowSignal);
connect(m_fullSearchResultWid,&FullSearchResultWidget::sendHideMainWindowSignal,this,&MainViewWidget::sendHideMainWindowSignal);
connect(m_commonUseWid, &CommonUseWidget::sendMainWinActiveSignal, this, &MainViewWidget::sendMainWinActiveSignal);
connect(m_functionWid, &FunctionWidget::sendMainWinActiveSignal, this, &MainViewWidget::sendMainWinActiveSignal);
connect(m_letterWid, &LetterWidget::sendMainWinActiveSignal, this, &MainViewWidget::sendMainWinActiveSignal);
connect(m_searchResultWid, &SearchResultWidget::sendMainWinActiveSignal, this, &MainViewWidget::sendMainWinActiveSignal);
addTopControl();
//加载默认视图
//搜索区
@ -122,18 +127,67 @@ void MainViewWidget::initUi()
m_commonUseWid->show();
m_widgetState=1;
m_saveCurrentWidState=1;
//监控应用进程开启
connect(KWindowSystem::self(), &KWindowSystem::windowAdded, [ = ](WId id) {
ConvertDesktopToWinId reply;
QString desktopfp = reply.tranIdToDesktop(id);
if (!desktopfp.isEmpty()) {
//监控应用进程开启
connect(KWindowSystem::self(),&KWindowSystem::windowAdded,[=](WId id)
{
KWindowInfo info(id,NET::WMPid);
int pid=info.pid();
QString desktopfp=getEnvOverriddenDesktopFile(pid);
if(!desktopfp.isEmpty())
ViewOpenedSlot(desktopfp);
else
{
//获取软件名(2种方式)
//法1
QStringList nameList;
KWindowInfo info(id,NET::WMName);
nameList.append(info.name());
//法2
QString path=QString("/proc/%1/status").arg(pid);
QFile file(path);
if(file.open(QIODevice::ReadOnly))
{
char buf[1024];
qint64 len=file.readLine(buf,sizeof(buf));
if(len!=-1)
{
QString name=QString::fromLocal8Bit(buf).remove("Name:").remove("\t").remove("\n");
nameList.append(name);
}
}
QVector<QStringList> appInfoVector=UkuiMenuInterface::appInfoVector;
Q_FOREACH(QStringList list , appInfoVector)
{
if(list.at(1).contains(nameList.at(0),Qt::CaseInsensitive) ||
list.at(2).contains(nameList.at(0),Qt::CaseInsensitive) ||
list.at(5).contains(nameList.at(0),Qt::CaseInsensitive) ||
nameList.at(0).contains(list.at(1),Qt::CaseInsensitive) ||
nameList.at(0).contains(list.at(2),Qt::CaseInsensitive))
{
ViewOpenedSlot(list.at(0));
break;
}
else if(nameList.size()==2 &&
(
list.at(1).contains(nameList.at(1),Qt::CaseInsensitive) ||
list.at(2).contains(nameList.at(1),Qt::CaseInsensitive) ||
list.at(5).contains(nameList.at(1),Qt::CaseInsensitive) ||
nameList.at(0).contains(list.at(1),Qt::CaseInsensitive) ||
nameList.at(0).contains(list.at(2),Qt::CaseInsensitive))
)
{
ViewOpenedSlot(list.at(0));
break;
}
}
}
});
//监控图标主题
if (QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit())) {
if(QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit()))
{
m_gsetting=new QGSettings(QString("org.ukui.style").toLocal8Bit());
connect(m_gsetting,&QGSettings::changed,this,&MainViewWidget::iconThemeChangeSlot);
}
@ -146,21 +200,21 @@ void MainViewWidget::addTopControl()
{
m_topLayout=new QHBoxLayout;
m_topLayout->setSpacing(0);
m_queryLineEdit = new MyLineEdit;
m_queryLineEdit=new QLineEdit;
m_topLayout->addWidget(m_queryLineEdit);
m_topWidget->setLayout(m_topLayout);
char style[200];
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if(gsetting.get("style-name").toString()=="ukui-light")
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
QueryLineEditClickedBorderDefault,QueryLineEditDefaultBackground);
else
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
m_queryLineEdit->setStyleSheet(style);
initQueryLineEdit();
}
//void MainViewWidget::focusInEvent(QFocusEvent *event)
@ -187,13 +241,10 @@ void MainViewWidget::initQueryLineEdit()
m_queryWid->setLayout(queryWidLayout);
QPixmap pixmap=loadSvg(QString(":/data/img/mainviewwidget/search.svg"),16);
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if (gsetting.get("style-name").toString() == "ukui-light") { //反黑
if(gsetting.get("style-name").toString()=="ukui-light")//反黑
pixmap=drawSymbolicBlackColoredPixmap(pixmap);
} else {
else
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
}
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
m_queryIcon=new QLabel;
m_queryIcon->setFixedSize(pixmap.size());
@ -208,51 +259,47 @@ void MainViewWidget::initQueryLineEdit()
m_queryLineEdit->setFocusPolicy(Qt::ClickFocus);
m_queryLineEdit->installEventFilter(this);
m_queryLineEdit->setContextMenuPolicy(Qt::NoContextMenu);
m_animation = new QPropertyAnimation(m_queryWid, "geometry", m_queryWid);
m_animation= new QPropertyAnimation(m_queryWid,"geometry");
m_animation->setDuration(100);
connect(m_animation,&QPropertyAnimation::finished,this,&MainViewWidget::animationFinishedSlot);
m_searchAppThread=new SearchAppThread;
m_searchAppThread->setParent(this);
connect(this,&MainViewWidget::sendSearchKeyword,
m_searchAppThread,&SearchAppThread::recvSearchKeyword);
connect(m_searchAppThread,&SearchAppThread::sendSearchResult,
this,&MainViewWidget::recvSearchResult);
connect(m_queryLineEdit, &MyLineEdit::textChanged, this, &MainViewWidget::searchAppSlot);
connect(m_queryLineEdit, &QLineEdit::textChanged, this, &MainViewWidget::searchAppSlot);
}
bool MainViewWidget::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_queryLineEdit) {
if ((m_queryIcon->x() == 0) && (event->type() == QEvent::KeyPress || event->type() == QEvent::MouseButtonPress || event->type() == QEvent::InputMethod)) {
if (m_queryLineEdit->text().isEmpty() || (m_queryWid->layout()->count() != 2)) {
QApplication::postEvent(m_queryLineEdit, new QEvent(QEvent::FocusIn));
return false;
}
}
if(watched==m_queryLineEdit)
{
char style[200];
if (event->type() == QEvent::FocusIn && m_queryLineEdit->hasFocus()) {
if (!m_isFullScreen) {
if(event->type()==QEvent::FocusIn)
{
if(!m_isFullScreen)
{
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if(gsetting.get("style-name").toString()=="ukui-light")
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
QueryLineEditClickedBorderDefault,QueryLineEditClickedDefaultBackground);
else
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditClickedBackground);
} else
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
}
else
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditClickedBackground);
m_queryLineEdit->setStyleSheet(style);
if (!m_queryLineEdit->text().isEmpty() && (m_queryLineEdit->text().size() >= 1)) {
if (m_searchKeyWords.isEmpty()) {
if(!m_queryLineEdit->text().isEmpty())
{
if(m_searchKeyWords.isEmpty())
searchAppSlot(m_queryLineEdit->text());
}
} else {
else
{
m_queryWid->layout()->removeWidget(m_queryText);
m_queryText->setParent(nullptr);
m_animation->stop();
@ -264,26 +311,28 @@ bool MainViewWidget::eventFilter(QObject *watched, QEvent *event)
m_animation->start();
m_queryLineEdit->setTextMargins(-5,0,0,0);
}
m_isSearching=true;
} else if (event->type() == QEvent::FocusOut) {
}
else if(event->type()==QEvent::FocusOut)
{
m_searchKeyWords.clear();
if (m_queryLineEdit->text().isEmpty()) {
if (m_isSearching || m_queryLineEdit->hasFocus()) {
if (!m_isFullScreen) {
if(m_queryLineEdit->text().isEmpty())
{
if(m_isSearching)
{
if(!m_isFullScreen)
{
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if(gsetting.get("style-name").toString()=="ukui-light")
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
QueryLineEditClickedBorderDefault,QueryLineEditDefaultBackground);
else
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
} else
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
}
else
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
m_queryLineEdit->setStyleSheet(style);
m_animation->stop();
m_queryText->adjustSize();
@ -294,23 +343,24 @@ bool MainViewWidget::eventFilter(QObject *watched, QEvent *event)
m_animation->setEasingCurve(QEasingCurve::InQuad);
m_animation->start();
}
} else {
if (!m_isFullScreen) {
}
else
{
if(!m_isFullScreen)
{
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if(gsetting.get("style-name").toString()=="ukui-light")
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
QueryLineEditClickedDefaultBackground,QueryLineEditDefaultBackground);
else
sprintf(style, "MyLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder, QueryLineEditBackground);
} else
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
}
else
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
m_queryLineEdit->setStyleSheet(style);
}
m_isSearching=false;
}
}
@ -320,81 +370,60 @@ bool MainViewWidget::eventFilter(QObject *watched, QEvent *event)
void MainViewWidget::setLineEditFocus(QString arg)
{
if (!m_queryLineEdit->hasFocus()) {
if(!m_queryLineEdit->hasFocus())
{
m_searchKeyWords=arg;
m_queryLineEdit->setFocus();
if (!m_queryLineEdit->text().isEmpty()) {
if(!m_queryLineEdit->text().isEmpty())
m_queryLineEdit->setText(arg);
}
}
}
/**
*
*/
void MainViewWidget::searchAppSlot(QString arg)
{
if (!arg.isEmpty()) { //切换至搜索模块
if (m_widgetState != 0) {
if(!arg.isEmpty())//切换至搜索模块
{
if(m_widgetState!=0)
{
m_widgetState=0;
if (!m_isFullScreen) {
if(!m_isFullScreen)
loadSearchResultWidget();
} else {
else
loadFullSearchResultWidget();
}
}
// 如果搜索时依然还有搜索框和搜索的文字描述两个组件,则进行处理;置为搜索状态
if (m_queryWid->layout()->count() == 2) {
QApplication::postEvent(m_queryLineEdit, new QEvent(QEvent::FocusIn));
m_queryWid->layout()->removeWidget(m_queryText);
m_queryText->setParent(nullptr);
m_animation->stop();
m_animation->setStartValue(QRect((m_queryLineEdit->width() - (m_queryIcon->width() + m_queryText->width() + 10)) / 2, 0,
m_queryIcon->width() + m_queryText->width() + 10, Style::QueryLineEditHeight));
m_animation->setEndValue(QRect(0, 0,
m_queryIcon->width() + 5, Style::QueryLineEditHeight));
m_animation->setEasingCurve(QEasingCurve::OutQuad);
m_animation->start();
m_queryLineEdit->setTextMargins(-5, 0, 0, 0);
}
qDebug() << QTime::currentTime() << "m_queryWid(x, y) = (" << m_queryWid->x() << "," << m_queryWid->y() << ")";
Q_EMIT sendSearchKeyword(arg);
m_searchAppThread->start();
} else { //搜索模块显示所有的软件
if (m_isFullScreen) {
}
else{//搜索模块显示所有的软件
if(m_isFullScreen)
{
switch (m_saveCurrentWidState) {
case 1:
loadFullCommonUseWidget();
break;
case 2:
loadFullLetterWidget();
break;
case 3:
loadFullFunctionWidget();
default:
break;
}
} else {
}
else {
switch (m_saveCurrentWidState) {
case 1:
loadCommonUseWidget();
break;
case 2:
loadLetterWidget();
break;
case 3:
loadFunctionWidget();
break;
default:
break;
}
@ -412,32 +441,37 @@ void MainViewWidget::recvSearchResult(QVector<QStringList> arg)
void MainViewWidget::animationFinishedSlot()
{
if (m_isSearching) { //进入搜索状态
if(m_isSearching)//进入搜索状态
{
// m_queryWid->layout()->removeWidget(m_queryText);
// m_queryText->setParent(nullptr);
m_queryLineEdit->setTextMargins(20,0,0,0);
if (!m_searchKeyWords.isEmpty()) {
if(!m_searchKeyWords.isEmpty())
{
m_queryLineEdit->setText(m_searchKeyWords);
m_searchKeyWords.clear();
}
} else { //退出搜索状态
}
else//退出搜索状态
{
m_queryWid->layout()->addWidget(m_queryText);
m_queryWid->layout()->setAlignment(m_queryIcon,Qt::AlignVCenter);
m_queryWid->layout()->setAlignment(m_queryText,Qt::AlignVCenter);
QPalette pe = m_queryText->palette();
if (!m_isFullScreen) {
if(!m_isFullScreen)
{
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if (gsetting.get("style-name").toString() == "ukui-light") { //反黑
if(gsetting.get("style-name").toString()=="ukui-light")//反黑
{
pe.setColor(QPalette::Text,QColor(Qt::black));
} else {
}
else
{
pe.setColor(QPalette::Text,QColor(Qt::white));
}
} else {
pe.setColor(QPalette::Text, QColor(Qt::white));
}
else
pe.setColor(QPalette::Text,QColor(Qt::white));
m_queryText->setPalette(pe);
}
@ -454,14 +488,14 @@ void MainViewWidget::loadMinMainView()
m_topLayout->setContentsMargins(0,0,0,0);
m_topLayout->setAlignment(m_queryLineEdit,Qt::AlignCenter);
m_queryLineEdit->setFixedSize(Style::defaultQueryLineEditWidth,Style::defaultQueryLineEditHeight);
if (m_queryLineEdit->text().isEmpty()) {
if (m_queryWid->layout()->count() == 1) {
if(m_queryLineEdit->text().isEmpty())
{
if(m_queryWid->layout()->count()==1)
{
m_queryWid->layout()->addWidget(m_queryText);
m_queryWid->layout()->setAlignment(m_queryIcon,Qt::AlignVCenter);
m_queryWid->layout()->setAlignment(m_queryText,Qt::AlignVCenter);
}
m_queryText->adjustSize();
m_queryWid->setGeometry(QRect((m_queryLineEdit->width()-(m_queryIcon->width()+m_queryText->width()+10))/2,0,
m_queryIcon->width()+m_queryText->width()+10,Style::QueryLineEditHeight));
@ -470,39 +504,39 @@ void MainViewWidget::loadMinMainView()
char style[200];
QPalette pe = m_queryText->palette();
const auto ratio = devicePixelRatioF();
QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/search.svg"), 16 * ratio);
QPixmap pixmap=loadSvg(QString(":/data/img/mainviewwidget/search.svg"),16);
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if (gsetting.get("style-name").toString() == "ukui-light") {
if(gsetting.get("style-name").toString()=="ukui-light")
{
pixmap=drawSymbolicBlackColoredPixmap(pixmap);//反黑
pe.setColor(QPalette::Text,QColor(Qt::black));
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
QueryLineEditClickedBorderDefault,QueryLineEditDefaultBackground);
} else {
}
else
{
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
pe.setColor(QPalette::Text,QColor(Qt::white));
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
}
m_queryLineEdit->setStyleSheet(style);
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
m_queryIcon->setPixmap(pixmap);
m_queryText->setPalette(pe);
//内容区
m_contentWid->setFixedSize(this->width(),this->height()-m_topWidget->height());
if (m_widgetState == 0) {
if(m_widgetState==0)
{
loadSearchResultWidget();
} else if (m_widgetState == 1) {
loadCommonUseWidget();
} else if (m_widgetState == 2) {
loadLetterWidget();
} else if (m_widgetState == 3) {
loadFunctionWidget();
}
else if(m_widgetState==1)
loadCommonUseWidget();
else if(m_widgetState==2)
loadLetterWidget();
else if(m_widgetState==3)
loadFunctionWidget();
m_isFullScreen=false;
}
@ -516,18 +550,20 @@ void MainViewWidget::loadMaxMainView()
//搜索区
m_topWidget->setFixedSize(this->width(),Style::TopWidgetHeight);
m_queryLineEdit->setFixedSize(Style::QueryLineEditWidth,Style::QueryLineEditHeight);
m_topLayout->setContentsMargins((m_topWidget->width()-Style::LeftWidWidth-m_queryLineEdit->width())/2+Style::LeftWidWidth,
0,
(m_topWidget->width()-Style::LeftWidWidth-m_queryLineEdit->width())/2,
0);
if (m_queryLineEdit->text().isEmpty()) {
if (m_queryWid->layout()->count() == 1) {
if(m_queryLineEdit->text().isEmpty())
{
if(m_queryWid->layout()->count()==1)
{
m_queryWid->layout()->addWidget(m_queryText);
m_queryWid->layout()->setAlignment(m_queryIcon,Qt::AlignVCenter);
m_queryWid->layout()->setAlignment(m_queryText,Qt::AlignVCenter);
}
m_queryText->adjustSize();
m_queryWid->setGeometry(QRect((m_queryLineEdit->width()-(m_queryIcon->width()+m_queryText->width()+10))/2,0,
m_queryIcon->width()+m_queryText->width()+10,Style::QueryLineEditHeight));
@ -538,110 +574,114 @@ void MainViewWidget::loadMaxMainView()
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
m_queryLineEdit->setStyleSheet(style);
const auto ratio = devicePixelRatioF();
QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/search.svg"), 16 * ratio);
QPixmap pixmap=loadSvg(QString(":/data/img/mainviewwidget/search.svg"),16);
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
QPalette pe = m_queryText->palette();
pe.setColor(QPalette::Text,QColor(Qt::white));
m_queryText->setPalette(pe);
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
m_queryIcon->setPixmap(pixmap);
//内容区
m_contentWid->setFixedSize(this->width(),this->height()-m_topWidget->height());
if (m_widgetState == 0) {
if(m_widgetState==0)
{
loadFullSearchResultWidget();
} else if (m_widgetState == 1) {
loadFullCommonUseWidget();
} else if (m_widgetState == 2) {
loadFullLetterWidget();
} else if (m_widgetState == 3) {
loadFullFunctionWidget();
}
else if(m_widgetState==1)
loadFullCommonUseWidget();
else if(m_widgetState==2)
loadFullLetterWidget();
else if(m_widgetState==3)
loadFullFunctionWidget();
m_isFullScreen=true;
}
void MainViewWidget::resizeControl()
{
if (m_isFullScreen) {
if (m_widgetState == 2) {
if(m_isFullScreen)
{
if(m_widgetState==2)
m_fullLetterWid->setLetterBtnGeometry();
}
if (m_widgetState == 3) {
if(m_widgetState==3)
m_fullFunctionWid->setFunctionBtnGeometry();
}
this->setFixedSize(Style::MainViewWidWidth,
Style::heightavailable);
m_topWidget->setFixedSize(this->width(),Style::TopWidgetHeight);
m_queryLineEdit->setFixedSize(Style::QueryLineEditWidth,Style::QueryLineEditHeight);
m_topLayout->setContentsMargins((m_topWidget->width()-Style::LeftWidWidth-m_queryLineEdit->width())/2+Style::LeftWidWidth,
0,
(m_topWidget->width()-Style::LeftWidWidth-m_queryLineEdit->width())/2,
0);
m_contentWid->setFixedSize(this->width(),this->height()-m_topWidget->height());
} else {
}
else
{
this->setFixedSize(Style::defaultMainViewWidWidth,Style::minh);
m_topWidget->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultTopWidHeight);
m_topLayout->setContentsMargins(0,0,0,0);
m_topLayout->setAlignment(m_queryLineEdit,Qt::AlignCenter);
m_contentWid->setFixedSize(this->width(),this->height()-m_topWidget->height());
}
}
void MainViewWidget::resetQueryLine()
{
if (!m_queryLineEdit->text().isEmpty()) {
if(!m_queryLineEdit->text().isEmpty())
{
m_queryLineEdit->clearFocus();
m_queryLineEdit->clear();
m_isSearching = false;
if (m_queryWid->layout()->count() == 1) {
if(m_queryWid->layout()->count()==1)
{
m_queryWid->layout()->addWidget(m_queryText);
m_queryWid->layout()->setAlignment(m_queryIcon,Qt::AlignVCenter);
m_queryWid->layout()->setAlignment(m_queryText,Qt::AlignVCenter);
}
m_queryText->adjustSize();
m_queryWid->setGeometry(QRect((m_queryLineEdit->width()-(m_queryIcon->width()+m_queryText->width()+10))/2,0,
m_queryIcon->width()+m_queryText->width()+10,Style::QueryLineEditHeight));
char style[200];
const auto ratio = devicePixelRatioF();
QPalette pe = m_queryText->palette();
QPixmap pixmap = loadSvg(QString(":/data/img/mainviewwidget/search.svg"), 16 * ratio);
QPixmap pixmap=loadSvg(QString(":/data/img/mainviewwidget/search.svg"),16);
if(!m_isFullScreen)
{
if (!m_isFullScreen) {
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if (gsetting.get("style-name").toString() == "ukui-light") {
if(gsetting.get("style-name").toString()=="ukui-light")
{
pixmap=drawSymbolicBlackColoredPixmap(pixmap);//反黑
pe.setColor(QPalette::Text,QColor(Qt::black));
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#000000;}",
QueryLineEditClickedBorderDefault,QueryLineEditDefaultBackground);
} else {
}
else
{
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
pe.setColor(QPalette::Text,QColor(Qt::white));
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
}
} else {
}
else
{
sprintf(style, "QLineEdit{border:1px solid %s;background-color:%s;border-radius:4px;color:#ffffff;}",
QueryLineEditClickedBorder,QueryLineEditBackground);
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
pe.setColor(QPalette::Text,QColor(Qt::white));
}
m_queryLineEdit->setStyleSheet(style);
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
m_queryIcon->setPixmap(pixmap);
m_queryText->setPalette(pe);
}
m_queryLineEdit->setFocus();
QTimer::singleShot(1, this, [ = ]() {
m_queryLineEdit->simulateFocusOutEvent(nullptr);
});
}
/**
@ -800,15 +840,17 @@ void MainViewWidget::changeFocuDown()
*/
void MainViewWidget::ViewOpenedSlot(QString desktopfp)
{
qDebug()<<"open software:"<<desktopfp;
QVector<QString> desktopfpVec=UkuiMenuInterface::desktopfpVector;
if (desktopfpVec.contains(desktopfp)) {
if(desktopfpVec.contains(desktopfp))
{
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
QString dateTimeKey;
dateTimeKey.clear();
if (!desktopfn.isEmpty()) {
if(!desktopfn.isEmpty())
{
updateDataBaseTableTimes(desktopfn);
}
}
@ -833,10 +875,9 @@ void MainViewWidget::requestUpdateSlot()
void MainViewWidget::iconThemeChangeSlot(QString key)
{
if (key == "iconThemeName" || key == "icon-theme-name") {
if(key=="iconThemeName" || key=="icon-theme-name")
Q_EMIT directoryChangedSignal();
}
}
void MainViewWidget::reloadUkuiMenu()
{
@ -856,6 +897,14 @@ void MainViewWidget::repaintWidget()
m_fullSearchResultWid->repaintWidget();
}
void MainViewWidget::repaintFullWidget()
{
m_fullCommonUseWid->repaintWidget();
m_fullLetterWid->repaintWidget();
m_fullFunctionWid->repaintWidget();
m_fullSearchResultWid->repaintWidget();
}
void MainViewWidget::widgetMakeZero()
{
m_isSearching=false;
@ -875,60 +924,59 @@ void MainViewWidget::widgetMakeZero()
void MainViewWidget::moveScrollBar(int type)
{
if (m_widgetState == 0) {
if (m_isFullScreen) {
if(m_widgetState==0)
{
if(m_isFullScreen)
m_fullSearchResultWid->moveScrollBar(type);
} else {
else
m_searchResultWid->moveScrollBar(type);
}
}
if (m_widgetState == 1) {
if (m_isFullScreen) {
if(m_widgetState==1)
{
if(m_isFullScreen)
m_fullCommonUseWid->moveScrollBar(type);
} else {
else
m_commonUseWid->moveScrollBar(type);
}
}
if (m_widgetState == 2) {
if (m_isFullScreen) {
if(m_widgetState==2)
{
if(m_isFullScreen)
m_fullLetterWid->moveScrollBar(type);
} else {
else
m_letterWid->moveScrollBar(type);
}
}
if (m_widgetState == 3) {
if (m_isFullScreen) {
if(m_widgetState==3)
{
if(m_isFullScreen)
m_fullFunctionWid->moveScrollBar(type);
} else {
else
m_functionWid->moveScrollBar(type);
}
}
}
void MainViewWidget::keyPressEvent(QKeyEvent *e)
{
if (e->type() == QEvent::KeyPress) {
if (e->key() == Qt::Key_Escape) {
Q_EMIT setMainWinHideSignal();
}
switch (e->key()) {
if(e->type()==QEvent::KeyPress)
{
switch(e->key())
{
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Down: {
if (m_queryLineEdit->hasFocus() && !m_queryLineEdit->text().isEmpty()) {
if (m_isFullScreen) {
case Qt::Key_Down:
{
if(m_queryLineEdit->hasFocus() && !m_queryLineEdit->text().isEmpty())
{
if(m_isFullScreen)
{
m_fullSearchResultWid->setViewFocus();
} else {
}
else
{
m_searchResultWid->setViewFocus();
}
}
}
break;
default:
break;
}

View File

@ -40,23 +40,9 @@
#include "src/SearchResultWidget/fullsearchresultwidget.h"
#include "src/SearchResultWidget/searchresultwidget.h"
#include "src/SearchResultWidget/searchappthread.h"
#include "src/UtilityFunction/convertdesktoptowinid.h"
#include "directorychangedthread.h"
#include "src/Style/style.h"
class MyLineEdit : public QLineEdit{
Q_OBJECT
public:
explicit MyLineEdit(QLineEdit *parent = nullptr){unsetCursor();}
~MyLineEdit(){}
void simulateFocusOutEvent(QKeyEvent *e){
QApplication::postEvent(this, new QEvent(QEvent::FocusOut));
this->focusOutEvent(new QFocusEvent(QEvent::FocusOut));
}
};
class MainViewWidget : public QWidget
{
Q_OBJECT
@ -88,6 +74,7 @@ public:
/**
* @brief changeFocuUp
*/
void repaintFullWidget();
void changeFocuUp();
/**
@ -105,8 +92,6 @@ public:
void resetQueryLine();
MyLineEdit* getQueryLineEditer() {return m_queryLineEdit;}
private:
UkuiMenuInterface *m_ukuiMenuInterface=nullptr;
QWidget *m_topWidget=nullptr;
@ -114,7 +99,7 @@ private:
QWidget *m_contentWid=nullptr;
MyLineEdit *m_queryLineEdit=nullptr;
QLineEdit *m_queryLineEdit=nullptr;
QWidget *m_queryWid=nullptr;
QLabel *m_queryIcon=nullptr;
QLabel *m_queryText=nullptr;
@ -251,8 +236,6 @@ Q_SIGNALS:
*/
void sendHideMainWindowSignal();
void sendMainWinActiveSignal(bool flag);
void setFocusToSideWin();
void selectFirstItem();
@ -260,8 +243,6 @@ Q_SIGNALS:
void selectFirstItemTab();
void setSlideBar(int value);
void setMainWinHideSignal();
};
#endif // MAINVIEWWIDGET_H

View File

@ -29,14 +29,11 @@
#include <QJsonParseError>
#include <QJsonValue>
#include "src/Style/style.h"
#include "src/UtilityFunction/utility.h"
#include <QPalette>
#include <QEvent>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
getCurrentCPU();
openDataBase("MainThread");
m_ukuiMenuInterface=new UkuiMenuInterface;
UkuiMenuInterface::appInfoVector=m_ukuiMenuInterface->createAppInfoVector();
@ -44,18 +41,21 @@ MainWindow::MainWindow(QWidget *parent) :
UkuiMenuInterface::alphabeticVector=m_ukuiMenuInterface->getAlphabeticClassification();
UkuiMenuInterface::functionalVector=m_ukuiMenuInterface->getFunctionalClassification();
UkuiMenuInterface::allAppVector=m_ukuiMenuInterface->getAllClassification();
Style::initWidStyle();
initUi();
m_dbus=new DBus;
new MenuAdaptor(m_dbus);
QDBusConnection con=QDBusConnection::sessionBus();
if(!con.registerService("org.ukui.menu") ||
!con.registerObject("/org/ukui/menu", m_dbus)) {
!con.registerObject("/org/ukui/menu",m_dbus))
{
qDebug()<<"error:"<<con.lastError().message();
}
connect(m_dbus, &DBus::sendReloadSignal, this, [ = ] {
connect(m_dbus,&DBus::sendReloadSignal,this,[=]
{
UkuiMenuInterface::appInfoVector.clear();
UkuiMenuInterface::alphabeticVector.clear();
UkuiMenuInterface::functionalVector.clear();
@ -64,34 +64,28 @@ MainWindow::MainWindow(QWidget *parent) :
UkuiMenuInterface::functionalVector=m_ukuiMenuInterface->getFunctionalClassification();
Q_EMIT m_mainViewWid->reloadUkuiMenu();
});
connect(m_dbus,&DBus::winKeyResponseSignal,this,[=]{
if(QGSettings::isSchemaInstalled(QString("org.ukui.session").toLocal8Bit()))
{
QGSettings gsetting(QString("org.ukui.session").toLocal8Bit());
// if(gsetting.keys().contains("win-key-release"))
// if(gsetting.get("win-key-release").toBool())
// return;
if (gsetting.keys().contains("winKeyRelease"))
if (gsetting.get("winKeyRelease").toBool()) {
if(gsetting.keys().contains("win-key-release"))
if(gsetting.get("win-key-release").toBool())
return;
}
}
if(QGSettings::isSchemaInstalled(QString("org.ukui.screenshot").toLocal8Bit()))
{
QGSettings gsetting(QString("org.ukui.screenshot").toLocal8Bit());
if(gsetting.keys().contains("isrunning"))
if (gsetting.get("isrunning").toBool()) {
if(gsetting.get("isrunning").toBool())
return;
}
}
if(this->isVisible())
{
this->hide();
} else
{
}
else{
this->loadMainWindow();
this->show();
this->raise();
@ -104,11 +98,7 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
closeDataBase("MainThread");
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void MainWindow::initUi()
@ -117,23 +107,20 @@ void MainWindow::initUi()
this->setAttribute(Qt::WA_TranslucentBackground, true);
this->setAutoFillBackground(false);
this->setFocusPolicy(Qt::NoFocus);
this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
this->setMinimumSize(Style::minw,Style::minh);
this->setContentsMargins(0,0,0,0);
// this->setFocus();
m_frame=new QFrame;
m_mainViewWid=new MainViewWidget;
m_sideBarWid=new SideBarWidget;
// m_frame->installEventFilter(this);
// m_mainViewWid->installEventFilter(this);
// m_sideBarWid->installEventFilter(this);
// setTabOrder(m_mainViewWid , m_sideBarWid);
// setTabOrder(m_sideBarWid , m_mainViewWid);
this->setCentralWidget(m_frame);
QHBoxLayout *mainlayout=new QHBoxLayout;
mainlayout->setContentsMargins(0,0,0,0);
mainlayout->setSpacing(0);
m_frame->setLayout(mainlayout);
mainlayout->addWidget(m_mainViewWid);
m_line=new QFrame;
m_line->installEventFilter(this);
@ -144,87 +131,76 @@ void MainWindow::initUi()
mainlayout->addWidget(m_sideBarWid);
m_sideBarWid->loadMinSidebar();
m_mainViewWid->loadMinMainView();
m_animation = new QPropertyAnimation(this, "geometry");
connect(m_animation,&QPropertyAnimation::finished,this,&MainWindow::animationValueFinishedSlot);
connect(m_sideBarWid, &SideBarWidget::setFocusToMainWin, m_mainViewWid, &MainViewWidget::selectFirstItemTab);
connect(m_sideBarWid, &SideBarWidget::sendCommonUseBtnSignal, m_mainViewWid, &MainViewWidget::loadCommonUseWidget);
connect(m_sideBarWid,&SideBarWidget::sendLetterBtnSignal, m_mainViewWid, &MainViewWidget::loadLetterWidget);
connect(m_sideBarWid, &SideBarWidget::sendFunctionBtnSignal, m_mainViewWid, &MainViewWidget::loadFunctionWidget);
connect(m_sideBarWid,&SideBarWidget::sendFullScreenCommonUseBtnSignal,
m_mainViewWid,&MainViewWidget::loadFullCommonUseWidget);
connect(m_sideBarWid,&SideBarWidget::sendFullScreenLetterBtnSignal,
m_mainViewWid,&MainViewWidget::loadFullLetterWidget);
connect(m_sideBarWid,&SideBarWidget::sendFullScreenFunctionBtnSignal,
m_mainViewWid,&MainViewWidget::loadFullFunctionWidget);
connect(m_sideBarWid, &SideBarWidget::setSlideBar, m_mainViewWid, &MainViewWidget::setSlideBar);
connect(m_sideBarWid,&SideBarWidget::sendFullScreenBtnSignal,this,&MainWindow::showFullScreenWidget);
connect(m_sideBarWid,&SideBarWidget::sendDefaultBtnSignal,this,&MainWindow::showDefaultWidget);
connect(m_sideBarWid, &SideBarWidget::sendShowMainWindowSignal, this, &MainWindow::activeWindowSolt);
connect(m_mainViewWid,&MainViewWidget::sendHideMainWindowSignal,this,&MainWindow::recvHideMainWindowSlot);
connect(m_sideBarWid,&SideBarWidget::sendHideMainWindowSignal,this,&MainWindow::recvHideMainWindowSlot);
connect(m_mainViewWid,&MainViewWidget::setFocusToSideWin,m_sideBarWid,&SideBarWidget::setFocusToThis);
connect(this, &MainWindow::setFocusSignal, m_mainViewWid, &MainViewWidget::selectFirstItem);
connect(m_mainViewWid, &MainViewWidget::sendMainWinActiveSignal, this, &MainWindow::activeWindowSolt);
connect(m_mainViewWid, &MainViewWidget::setMainWinHideSignal, this, &MainWindow::mainWinHideSlot);
connect(QApplication::desktop(),&QDesktopWidget::resized,this, [=]{
repaintWidget();
primaryScreenChangeSlot();
});
connect(QApplication::desktop(),&QDesktopWidget::primaryScreenChanged,this,[=]{
repaintWidget();
primaryScreenChangeSlot();
});
connect(QApplication::desktop(),&QDesktopWidget::screenCountChanged,this,[=]{
repaintWidget();
primaryScreenChangeSlot();
});
QDBusConnection::sessionBus().connect(DBUS_NAME,DBUS_PATH,DBUS_INTERFACE,QString("PanelGeometryRefresh"),this,SLOT(primaryScreenChangeSlot()));
//监听屏幕缩放
if (QGSettings::isSchemaInstalled(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit())) {
if(QGSettings::isSchemaInstalled(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit()))
{
QGSettings* m_gsetting=new QGSettings(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit());
connect(m_gsetting, &QGSettings::changed, this, [ = ](const QString & key) {
if (key == "scalingFactor") {
connect(m_gsetting,&QGSettings::changed,this,[=](const QString &key)
{
if(key=="scalingFactor")
repaintWidget();
}
});
}
if (QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit())) {
QGSettings *gsetting = new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
connect(gsetting, &QGSettings::changed,
QGSettings *psetting = new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit(), QByteArray(), this);
connect(psetting, &QGSettings::changed,
this, &MainWindow::panelChangedSlot);
}
}
void MainWindow::getCurrentCPU()
{
QProcess *processCpuInfo = new QProcess(this);
processCpuInfo->start(QString("cat /proc/cpuinfo"));
connect(processCpuInfo, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
processCpuInfo->deleteLater();
});
processCpuInfo->waitForFinished();
QString ctrCpuInfo = processCpuInfo->readAll();
if (ctrCpuInfo.contains("HUAWEI") || ctrCpuInfo.contains("Kirin")) {
isHuaWeiPC = true;
}
if (ctrCpuInfo.contains("PANGU")) {
isPANGU = true;
}
}
void MainWindow::paintEvent(QPaintEvent *event)
{
double transparency=getTransparency();
QRect rect = this->rect();
QPainterPath path;
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
painter.setPen(Qt::transparent);
if (!m_isFullScreen) {
if(!m_isFullScreen)
{
qreal radius=6;
path.moveTo(rect.topRight() - QPointF(radius, 0));
path.lineTo(rect.topLeft() + QPointF(radius, 0));
@ -235,13 +211,17 @@ void MainWindow::paintEvent(QPaintEvent *event)
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
path.lineTo(rect.topRight() + QPointF(0, radius));
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
painter.setBrush(this->palette().base());
painter.setPen(Qt::transparent);
painter.setOpacity(transparency);
painter.drawPath(path);
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
} else { //全屏固定背景色(黑底白字)
}
else//全屏固定背景色(黑底白字)
{
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
// {
// QGSettings gsetting(QString("org.ukui.control-center.personalise").toLocal8Bit());
@ -277,11 +257,11 @@ void MainWindow::paintEvent(QPaintEvent *event)
painter.setOpacity(transparency);
painter.drawRect(this->rect());
// }
QPainterPath path;
path.addRect(this->rect());
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
}
QMainWindow::paintEvent(event);
}
@ -290,31 +270,24 @@ void MainWindow::paintEvent(QPaintEvent *event)
*/
void MainWindow::showFullScreenWidget()
{
QRect availableGeometry = getScreenAvailableGeometry();
m_isFullScreen = true;
this->setContentsMargins(0, 0, 0, 0);
int position = Style::panelPosition;
int panelSize = Style::panelSize;
int x = Style::primaryScreenX;
int y = Style::primaryScreenY;
// int width = Style::primaryScreenWidth;
// int height = Style::primaryScreenHeight;
int width = Style::widthavailable;
int height = Style::heightavailable;
QRect startRect;
QRect endRect;
if (position == 0) {
startRect.setRect(x + 4, y + availableGeometry.height() - Style::minh - 3, Style::minw, Style::minh);
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
} else if (position == 1) {
startRect.setRect(x + 4, y + panelSize + 4, Style::minw, Style::minh);
endRect.setRect(x, y + panelSize, availableGeometry.width(), availableGeometry.height());
} else if (position == 2) {
startRect.setRect(x + panelSize + 4, y + 4, Style::minw, Style::minh);
endRect.setRect(x + panelSize, y, availableGeometry.width(), availableGeometry.height());
if (position == BOTTOM) {
startRect.setRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh);
} else if (position == RIGHT) {
startRect.setRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh);
} else {
startRect.setRect(x + availableGeometry.width() - Style::minw - 4, y + 4, Style::minw, Style::minh);
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
startRect.setRect(x + 4, y + 4, Style::minw, Style::minh);
}
endRect.setRect(x, y, width, height);
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
m_mainViewWid->setParent(nullptr);
@ -323,32 +296,17 @@ void MainWindow::showFullScreenWidget()
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
m_sideBarWid->setParent(nullptr);
if (isPANGU || isHuaWeiPC) {
is_repaint = false;
this->hide();
QEventLoop loop;
QTimer::singleShot(150, &loop, SLOT(quit()));
loop.exec();
m_animation->setDuration(1);//动画总时间
m_animation->setStartValue(startRect);
m_animation->setEndValue(endRect);
m_animation->setEasingCurve(QEasingCurve::Linear);
m_animation->start();
this->show();
this->activateWindow();
is_repaint = true;
} else {
m_animation->setDuration(100);//动画总时间
m_animation->setStartValue(startRect);
m_animation->setEndValue(endRect);
m_animation->setEasingCurve(QEasingCurve::Linear);
m_animation->start();
}
}
void MainWindow::mouseReleaseEvent(QMouseEvent *event)
{
if (m_isFullScreen && event->button() == Qt::LeftButton) {
if(m_isFullScreen && event->button()==Qt::LeftButton)
{
this->hide();
}
}
@ -358,30 +316,23 @@ void MainWindow::mouseReleaseEvent(QMouseEvent *event)
*/
void MainWindow::showDefaultWidget()
{
QRect availableGeometry = getScreenAvailableGeometry();
m_isFullScreen = false;
this->setContentsMargins(0, 0, 0, 0);
int position = Style::panelPosition;
int panelSize = Style::panelSize;
int x = Style::primaryScreenX;
int y = Style::primaryScreenY;
int width = Style::primaryScreenWidth;
int height = Style::primaryScreenHeight;
int width = Style::widthavailable;
int height = Style::heightavailable;
QRect startRect;
QRect endRect;
if (position == 0) {
endRect.setRect(x + 4, y + availableGeometry.height() - Style::minh - 3, Style::minw, Style::minh);
startRect.setRect(x, y, width, height - panelSize);
} else if (position == 1) {
endRect.setRect(x + 4, y + panelSize + 4, Style::minw, Style::minh);
startRect.setRect(x, y + panelSize, width, height - panelSize);
} else if (position == 2) {
endRect.setRect(x + panelSize + 4, y + 4, Style::minw, Style::minh);
startRect.setRect(x + panelSize, y, width - panelSize, height);
startRect.setRect(x, y, width, height);
if (position == BOTTOM) {
endRect.setRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh);
} else if (position == RIGHT) {
endRect.setRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh);
} else {
endRect.setRect(x + availableGeometry.width() - Style::minw - 4, y + 4, Style::minw, Style::minh);
startRect.setRect(x, y, width - panelSize, height);
endRect.setRect(x + 4, y + 4, Style::minw, Style::minh);
}
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
@ -389,21 +340,17 @@ void MainWindow::showDefaultWidget()
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
m_sideBarWid->setParent(nullptr);
if (isPANGU || isHuaWeiPC) {
this->setGeometry(endRect);
animationValueFinishedSlot();
} else {
m_animation->setDuration(100);//动画总时间
m_animation->setStartValue(startRect);
m_animation->setEndValue(endRect);
m_animation->setEasingCurve(QEasingCurve::Linear);
m_animation->start();
}
}
void MainWindow::animationValueChangedSlot(const QVariant &value)
{
if (m_isFullScreen) {
if(m_isFullScreen)
{
QPainterPath path;
path.addRect(this->rect());
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
@ -413,46 +360,33 @@ void MainWindow::animationValueChangedSlot(const QVariant &value)
void MainWindow::animationValueFinishedSlot()
{
if (m_isFullScreen) {
if(m_isFullScreen)
{
this->centralWidget()->layout()->addWidget(m_mainViewWid);
this->centralWidget()->layout()->addWidget(m_sideBarWid);
m_sideBarWid->loadMaxSidebar();
m_mainViewWid->loadMaxMainView();
m_sideBarWid->enterAnimation();
} else {
}
else
{
this->centralWidget()->layout()->addWidget(m_mainViewWid);
this->centralWidget()->layout()->addWidget(m_line);
this->centralWidget()->layout()->addWidget(m_sideBarWid);
m_sideBarWid->loadMinSidebar();
m_mainViewWid->loadMinMainView();
}
m_mainViewWid->getQueryLineEditer()->setFocus();
if (m_mainViewWid->getQueryLineEditer()->text().isEmpty()) {
qDebug() << "there is no letter in search lineEditer";
QTimer::singleShot(1, this, [ = ]() {
m_mainViewWid->getQueryLineEditer()->simulateFocusOutEvent(nullptr);
});
}
}
void MainWindow::activeWindowSolt(bool flag)
{
// qDebug() << "void MainWindow::activeWindowSolt(bool flag)";
if (isPANGU || isHuaWeiPC) {
QTimer::singleShot(50, this, SLOT(mainWinShowSlot()));
}
QTimer::singleShot(30,this, SLOT(mainWinShowSlot()));
}
void MainWindow::mainWinShowSlot()
{
this->activateWindow();
if (!this->geometry().contains(QCursor::pos())) {
this->hide();
}
qDebug() << "void MainWindow::activeWindowSolt()";
}
@ -461,20 +395,20 @@ void MainWindow::mainWinShowSlot()
*/
bool MainWindow::event ( QEvent * event )
{
if (event->type() == QEvent::ActivationChange && is_repaint)
if (event->type() == QEvent::ActivationChange)
// if(QEvent::WindowDeactivate == event->type() && m_canHide)//窗口停用
{
qDebug() << " * 鼠标点击窗口外部事件";
if (QApplication::activeWindow() != this) {
if(QApplication::activeWindow() != this)
{
this->hide();
m_mainViewWid->widgetMakeZero();
}
}
if (event->type() == QEvent::KeyPress) {
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = (QKeyEvent *) event;
// if (keyEvent->key() == Qt::Key_Tab)
// {
// m_mainViewWid->setFocus();
@ -483,20 +417,13 @@ bool MainWindow::event(QEvent *event)
// }
if(keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down ||
keyEvent->key() == Qt::Key_Left || keyEvent->key() == Qt::Key_Right ||
keyEvent->key() == Qt::Key_Tab) {
keyEvent->key() == Qt::Key_Tab)
{
m_mainViewWid->setFocus();
Q_EMIT setFocusSignal();
// return true;
}
}
if (event->type() == QEvent::FocusIn) {
m_mainViewWid->getQueryLineEditer()->setFocus();
QTimer::singleShot(1, this, [ = ]() {
m_mainViewWid->getQueryLineEditer()->simulateFocusOutEvent(nullptr);
});
}
return QWidget::event(event);
}
@ -513,13 +440,12 @@ void MainWindow::recvHideMainWindowSlot()
void MainWindow::loadMainWindow()
{
cleanTimeoutApp();
QRect availableGeometry = getScreenAvailableGeometry();
int position = Style::panelPosition;
int panelSize = Style::panelSize;
int x = Style::primaryScreenX;
int y = Style::primaryScreenY;
int width = Style::primaryScreenWidth;
int height = Style::primaryScreenHeight;
int width = Style::widthavailable;
int height = Style::heightavailable;
this->setFocus();
if (m_isFullScreen) {
@ -527,19 +453,14 @@ void MainWindow::loadMainWindow()
QRect startRect;
QRect endRect;
if (position == 0) {
startRect.setRect(x + 4, y + availableGeometry.height() - Style::minh - 3, Style::minw, Style::minh);
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
} else if (position == 1) {
startRect.setRect(x + 4, y + panelSize + 4, Style::minw, Style::minh);
endRect.setRect(x, y + panelSize, availableGeometry.width(), availableGeometry.height());
} else if (position == 2) {
startRect.setRect(x + panelSize + 4, y + 4, Style::minw, Style::minh);
endRect.setRect(x + panelSize, y, availableGeometry.width(), availableGeometry.height());
if (position == BOTTOM) {
startRect.setRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh);
} else if (position == RIGHT) {
startRect.setRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh);
} else {
startRect.setRect(x + availableGeometry.width() - Style::minw - 4, y + 4, Style::minw, Style::minh);
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
startRect.setRect(x + 4, y + 4, Style::minw, Style::minh);
}
endRect.setRect(x, y, width, height);
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
m_mainViewWid->setParent(nullptr);
@ -547,156 +468,92 @@ void MainWindow::loadMainWindow()
m_line->setParent(nullptr);
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
m_sideBarWid->setParent(nullptr);
// m_sideBarWid->clearFocus();
// m_mainViewWid->clearFocus();
m_animation->setDuration(1);//动画总时间
m_animation->setStartValue(startRect);
m_animation->setEndValue(endRect);
m_animation->setEasingCurve(QEasingCurve::Linear);
m_animation->start();
} else {
// QGSettings* setting1 = new QGSettings(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit());
// QString value1 = setting1->get("scaling-factor").toString();
// double scaling = value1.toDouble();
qDebug() << "availableGeometry.height();" << availableGeometry.height();
if (position == 0)
this->setGeometry(QRect(x + 4, y + availableGeometry.height() - Style::minh - 3,
Style::minw, Style::minh));
else if (position == 1) {
this->setGeometry(QRect(x + 4, y + panelSize + 4, Style::minw, Style::minh));
} else if (position == 2) {
this->setGeometry(QRect(x + panelSize + 4, y + 4, Style::minw, Style::minh));
} else
this->setGeometry(QRect(x + availableGeometry.width() - Style::minw - 4, y + 4,
Style::minw, Style::minh));
if (position == BOTTOM) {
this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh));
} else if (position == RIGHT) {
this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh));
} else {
this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh));
}
m_sideBarWid->loadMinSidebar();
m_mainViewWid->loadMinMainView();
m_mainViewWid->getQueryLineEditer()->setFocus();
QTimer::singleShot(1, this, [ = ]() {
m_mainViewWid->getQueryLineEditer()->simulateFocusOutEvent(nullptr);
});
}
}
void MainWindow::panelChangedSlot(QString key)
{
Q_UNUSED(key);
Style::initWidStyle();
m_mainViewWid->repaintFullWidget();
repaintWidget();
}
void MainWindow::primaryScreenChangeSlot()
{
repaintWidget();
Style::initWidStyle();
m_mainViewWid->repaintFullWidget();
resizeWidget();
}
void MainWindow::repaintWidget()
{
Style::initWidStyle();
QRect availableGeometry = getScreenAvailableGeometry();/*qApp->primaryScreen()->availableGeometry();*/
this->setMinimumSize(Style::minw, Style::minh);
m_line->setFixedSize(1, this->height() - 1);
m_line->setStyleSheet("border : 1px solid rgb(255,255,255,25)");
m_mainViewWid->repaintWidget();
resizeWidget();
}
void MainWindow::resizeWidget()
{
QRect availableGeometry = getScreenAvailableGeometry();
if (QApplication::activeWindow() == this) {
int position = Style::panelPosition;
int panelSize = Style::panelSize;
int x = Style::primaryScreenX;
int y = Style::primaryScreenY;
int width = Style::primaryScreenWidth;
int height = Style::primaryScreenHeight;
int width = Style::widthavailable;
int height = Style::heightavailable;
if (m_isFullScreen) {
if (position == 0) {
this->setGeometry(QRect(x, y, availableGeometry.width(), availableGeometry.height()));
} else if (position == 1) {
this->setGeometry(QRect(x, y + panelSize, availableGeometry.width(), availableGeometry.height()));
} else if (position == 2) {
this->setGeometry(QRect(x + panelSize, y, availableGeometry.width(), availableGeometry.height()));
} else {
this->setGeometry(QRect(x, y, availableGeometry.width(), availableGeometry.height()));
}
this->setGeometry(x, y, width, height);
m_sideBarWid->loadMaxSidebar();
m_sideBarWid->setSideBarBtnGeometry();
m_mainViewWid->resizeControl();
} else {
if (position == 0)
this->setGeometry(QRect(x + 4, y + availableGeometry.height() - Style::minh - 3,
Style::minw, Style::minh));
else if (position == 1) {
this->setGeometry(QRect(x + 4, y + panelSize + 4, Style::minw, Style::minh));
} else if (position == 2) {
this->setGeometry(QRect(x + panelSize + 4, y + 4, Style::minw, Style::minh));
} else
this->setGeometry(QRect(x + availableGeometry.width() - Style::minw - 4, y + 4,
Style::minw, Style::minh));
if (position == BOTTOM) {
this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh));
} else if (position == RIGHT) {
this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh));
} else {
this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh));
}
m_sideBarWid->loadMinSidebar();
}
m_mainViewWid->resizeControl();
}
}
void MainWindow::keyPressEvent(QKeyEvent *e)
{
if(e->type() == QEvent::KeyPress)
{
if((e->key() >= 0x30 && e->key() <= 0x39) || (e->key() >= 0x41 && e->key() <= 0x5a))
{
m_mainViewWid->setLineEditFocus(e->text());
}
//void MainWindow::setFrameStyle()
//{
// int position=0;
// int panelSize=0;
// if(QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit()))
// {
// QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
// if(gsetting->keys().contains(QString("panelposition")))
// position=gsetting->get("panelposition").toInt();
// else
// position=0;
// if(gsetting->keys().contains(QString("panelsize")))
// panelSize=gsetting->get("panelsize").toInt();
// else
// panelSize=46;
// }
// else
// {
// position=0;
// panelSize=46;
// }
// QRectF rect;
// rect.setX(this->rect().x()+1);
// rect.setY(this->rect().y()+1);
// rect.setWidth(this->rect().width()-2);
// rect.setHeight(this->rect().height()-2);
// qreal radius = 0;
// QPainterPath path;
// if(!m_isFullScreen)
// {
// radius=12;
// }
// else
// {
// radius=0;
// }
// path.moveTo(rect.topRight() - QPointF(radius, 0));
// path.lineTo(rect.topLeft() + QPointF(radius, 0));
// path.quadTo(rect.topLeft(), rect.topLeft() + QPointF(0, radius));
// path.lineTo(rect.bottomLeft() + QPointF(0, -radius));
// path.quadTo(rect.bottomLeft(), rect.bottomLeft() + QPointF(radius, 0));
// path.lineTo(rect.bottomRight() - QPointF(radius, 0));
// path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
// path.lineTo(rect.topRight() + QPointF(0, radius));
// path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
//}
void MainWindow::mainWinHideSlot()
if(e->key() == Qt::Key_Backspace)
{
m_mainViewWid->setLineEditFocus("");
}
if(e->key() == Qt::Key_Escape)
{
this->hide();
m_mainViewWid->widgetMakeZero();
}
}
}

View File

@ -56,7 +56,6 @@ public:
* @brief Load the main window
*/
void loadMainWindow();
void getCurrentCPU();
private:
@ -70,7 +69,6 @@ private:
QPropertyAnimation *m_animation=nullptr;
bool m_winFlag = false;
bool is_repaint = true;
DBus *m_dbus=nullptr;
protected:
@ -83,7 +81,10 @@ protected:
/**
* @brief The query box responds to keyboard events
*/
void keyPressEvent(QKeyEvent* e);
/**
* @brief Repaint window
*/
void repaintWidget();
void resizeWidget();
@ -109,7 +110,6 @@ public Q_SLOTS:
void primaryScreenChangeSlot();
void activeWindowSolt(bool flag);
void mainWinShowSlot();
void mainWinHideSlot();
public:
Q_SIGNALS:

View File

@ -0,0 +1,109 @@
#include "fulllistdelegate.h"
#include "src/Style/style.h"
#include "src/UtilityFunction/utility.h"
#include <QPainter>
#include <QToolTip>
FullListDelegate::FullListDelegate(QObject *parent, int page): QStyledItemDelegate(parent)
{
m_page = page;
}
void FullListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QRectF rect;
rect.setX(option.rect.x());
rect.setY(option.rect.y());
rect.setWidth(option.rect.width());
rect.setHeight(option.rect.height());
//QPainterPath画圆角矩形
const qreal radius = 4;
QPainterPath path;
path.moveTo(rect.topRight() - QPointF(radius, 0));
path.lineTo(rect.topLeft() + QPointF(radius, 0));
path.quadTo(rect.topLeft(), rect.topLeft() + QPointF(0, radius));
path.lineTo(rect.bottomLeft() + QPointF(0, -radius));
path.quadTo(rect.bottomLeft(), rect.bottomLeft() + QPointF(radius, 0));
path.lineTo(rect.bottomRight() - QPointF(radius, 0));
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
path.lineTo(rect.topRight() + QPointF(0, radius));
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
painter->setRenderHint(QPainter::Antialiasing);
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
painter->save();
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(Qt::white);
painter->setOpacity(0.15);
painter->drawPath(path);
painter->restore();
}
//绘制应用图标
painter->save();
painter->setOpacity(1);
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
QRect iconRect;
iconRect = QRect(rect.x() + Style::AppLeftSpace,
rect.y() + Style::AppTopSpace,
Style::AppListIconSize,
Style::AppListIconSize);
icon.paint(painter, iconRect);
//绘制是否存在固定标志
QString desktopfp = index.data(Qt::AccessibleDescriptionRole).value<QString>();
QFileInfo fileInfo(desktopfp);
QString desktopfn = fileInfo.fileName();
bool isLocked = false;
if (m_page == COMMON_PAGE) {
if (checkIfLocked(desktopfn)) {
isLocked = true;
QIcon icon(QString(":/data/img/mainviewwidget/lock-fs.svg"));
icon.paint(painter, QRect(iconRect.topRight().x() - 14, iconRect.topRight().y() - 2, 16, 16));
}
}
//绘制应用名
QString appName = index.data(Qt::DisplayRole).value<QString>();
QFontMetrics fm = painter->fontMetrics();
QString appnameElidedText = fm.elidedText(appName, Qt::ElideRight, rect.width() - 10, Qt::TextShowMnemonic);
QRect textRect;
textRect = QRect(rect.x() + 5,
iconRect.bottom() + Style::AppSpaceBetweenIconText,
rect.width() - 10,
rect.height() - iconRect.height() - Style::AppSpaceBetweenIconText);
//添加最近安装蓝色标签
bool isRecentapp = false;
if (checkIfRecent(desktopfn) && !checkIfLocked(desktopfn)) {
isRecentapp = true;
appnameElidedText = fm.elidedText(appName, Qt::ElideRight, rect.width() - 23, Qt::TextShowMnemonic);
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(QColor("#4d94ff"));
int x = 0;
if (rect.width() < (10 + fm.boundingRect(appName).width())) {
x = rect.x() + 9;
} else {
x = rect.x() + (rect.width() - fm.boundingRect(appName).width()) / 2 - 8;
}
painter->drawEllipse(QPoint(x, textRect.y() + (fm.boundingRect(appName).height() - 8) / 2 + 4),
4, 4);
}
painter->restore();
painter->save();
painter->drawText(textRect, Qt::AlignHCenter | Qt::AlignTop, appnameElidedText);
painter->restore();
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
int len = fm.boundingRect(appName).width() + 10;
if (len > rect.width()) {
QToolTip::showText(QCursor::pos(), appName);
} else {
QToolTip::hideText();
}
}
}
QSize FullListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
return QSize(Style::AppListItemSizeWidth, Style::AppListItemSizeWidth);
}

View File

@ -0,0 +1,19 @@
#ifndef FULLLISTDELEGATE_H
#define FULLLISTDELEGATE_H
#include <QObject>
#include <QStyledItemDelegate>
#include "src/Interface/ukuimenuinterface.h"
class FullListDelegate: public QStyledItemDelegate
{
Q_OBJECT
public:
FullListDelegate(QObject *parent, int page);
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
private:
int m_page;
};
#endif // FULLLISTDELEGATE_H

View File

@ -0,0 +1,71 @@
#include "fulllistitem.h"
#include <QIcon>
#include <QFileInfo>
#include <qt5xdg/XdgIcon>
#include <qt5xdg/XdgDesktopFile>
FullListItem::FullListItem(QWidget *parent) : QWidget(parent)
{
}
void FullListItem::setAppList(QStringList list)
{
m_appList.clear();
m_appList = list;
}
QIcon FullListItem::getAppIcon(QString list)
{
XdgDesktopFile desktopfile;
desktopfile.load(list);
QString iconName = desktopfile.iconName();
QIcon icon = XdgIcon::fromTheme(iconName);
if (icon.isNull()) {
if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconName).arg("png"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconName).arg("svg"))) {
icon = QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconName).arg("svg"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconName).arg("xpm"))) {
icon = QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconName).arg("xpm"));
} else if (QFile::exists(QString("/usr/share/icons/%1.%2").arg(iconName).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/%1.%2").arg(iconName).arg("png"));
} else {
icon = QIcon::fromTheme(QString("application-x-desktop"));
}
}
return icon;
}
QString FullListItem::getAppName(QString list)
{
XdgDesktopFile desktopfile;
desktopfile.load(list);
QString name = desktopfile.localizedValue("Name").toString();
return name;
}

View File

@ -0,0 +1,20 @@
#ifndef FULLLISTITEM_H
#define FULLLISTITEM_H
#include <QObject>
#include <QWidget>
class FullListItem: public QWidget
{
friend class FullListModel;
Q_OBJECT
public:
explicit FullListItem(QWidget *parent = nullptr);
void setAppList(QStringList list);
QIcon getAppIcon(QString list);
QString getAppName(QString list);
private:
QStringList m_appList;
};
#endif // FULLLISTITEM_H

View File

@ -0,0 +1,74 @@
#include "fulllistmodel.h"
#include "src/UtilityFunction/utility.h"
#include <QIcon>
#include <QDebug>
FullListModel::FullListModel(QObject *parent) : QAbstractItemModel(parent)
{
m_item = new FullListItem;
}
QModelIndex FullListModel::index(int row, int column, const QModelIndex &parent) const
{
return createIndex(row, column, m_item);
}
QModelIndex FullListModel::parent(const QModelIndex &child) const
{
return QModelIndex();
}
int FullListModel::rowCount(const QModelIndex &parent) const
{
return m_item->m_appList.count();
}
int FullListModel::columnCount(const QModelIndex &parent) const
{
return 1;
}
QVariant FullListModel::data(const QModelIndex &index, int role) const
{
if (m_item->m_appList.size() <= (index.row())) {
return QVariant();
}
switch (role) {
case Qt::DecorationRole: {
return m_item->getAppIcon(m_item->m_appList.at(index.row()));
}
case Qt::DisplayRole: {
return m_item->getAppName(m_item->m_appList.at(index.row()));
}
case Qt::AccessibleDescriptionRole:{
return m_item->m_appList.at(index.row());
}
default:
break;
}
return QVariant();
}
void FullListModel::setAppList(QStringList list)
{
m_item->setAppList(list);
}
void FullListModel::execAppDesktop(QModelIndex index)
{
execApp(m_item->m_appList.at(index.row()));
}
int FullListModel::showRightClickMenu(const QPoint &pos, QModelIndex index)
{
RightClickMenu menu;
return menu.showAppBtnMenu(pos, m_item->m_appList.at(index.row()));
}
void FullListModel::startChangeModel(QStringList list)
{
beginResetModel();
m_item->m_appList.clear();
m_item->m_appList = list;
endResetModel();
}

View File

@ -0,0 +1,30 @@
#ifndef FULLLISTMODEL_H
#define FULLLISTMODEL_H
#include <QObject>
#include <QAbstractItemModel>
#include "fulllistitem.h"
#include "src/RightClickMenu/rightclickmenu.h"
class FullListModel: public QAbstractItemModel
{
Q_OBJECT
public:
explicit FullListModel(QObject *parent = nullptr);
QModelIndex index(int row, int column, const QModelIndex &parent) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
void setAppList(QStringList list);
void execAppDesktop(QModelIndex index);
void startChangeModel(QStringList list);
int showRightClickMenu(const QPoint &pos, QModelIndex index);
private:
FullListItem * m_item = nullptr;
Q_SIGNALS:
void sendItemClickedSignal(QString desktopfp);
};
#endif // FULLLISTMODEL_H

View File

@ -0,0 +1,141 @@
#include "fulllistview.h"
#include "src/Style/style.h"
#include <QScrollBar>
#include <QKeyEvent>
FullListView::FullListView(QWidget *parent, int page) : QListView(parent)
{
m_page = page;
initWidget();
}
void FullListView::initWidget()
{
m_model = new FullListModel(this);
this->setModel(m_model);
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
this->setViewMode(QListView::IconMode);
this->setResizeMode(QListView::Adjust);
this->setGridSize(QSize(Style::AppListGridSizeWidth, Style::AppListGridSizeWidth));
this->setFrameShape(QFrame::NoFrame);//移除边框,若不添加会存在晃动
this->setContextMenuPolicy(Qt::CustomContextMenu);
m_delegate = new FullListDelegate(this, m_page);
this->setItemDelegate(m_delegate);
connect(this, &FullListView::customContextMenuRequested, this, &FullListView::rightClickedSlot);
connect(this, &FullListView::clicked, this, &FullListView::onClicked);
}
void FullListView::setAppList(QStringList appList)
{
m_model->setAppList(appList);
}
void FullListView::startChangeModel(QStringList appList)
{
m_model->startChangeModel(appList);
}
void FullListView::selectFirstItem()
{
if (this->currentIndex().row() == -1) {
this->setCurrentIndex(this->model()->index(0, 0));
}
}
void FullListView::onClicked(QModelIndex index)
{
Q_EMIT sendHideMainWindowSignal();
m_model->execAppDesktop(index);
}
void FullListView::rightClickedSlot(const QPoint &pos)
{
Q_UNUSED(pos)
if (!(this->selectionModel()->selectedIndexes().isEmpty())) {
QModelIndex index = this->currentIndex();
int ret = m_model->showRightClickMenu(this->mapToGlobal(pos), index);
switch (ret) {
case 1:
Q_EMIT sendUpdateAppListSignal();
break;
case 2:
Q_EMIT sendUpdateAppListSignal();
break;
case 6:
Q_EMIT sendHideMainWindowSignal();
break;
case 7:
Q_EMIT sendHideMainWindowSignal();
break;
default:
break;
}
}
}
void FullListView::keyPressEvent(QKeyEvent *e)
{
QRect center = visualRect(currentIndex());
if (e->type() == QEvent::KeyPress) {
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return: {
QModelIndex index = this->currentIndex();
Q_EMIT clicked(index);
break;
}
case Qt::Key_Left: {
if (mapToGlobal(center.topRight()).y() < Style::QueryLineEditHeight + Style::AppListGridSizeWidth) {
Q_EMIT sendSetslidebar(-Style::AppListGridSizeWidth);
}
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Right: {
if (mapToGlobal(center.bottomRight()).y() > (1080 - Style::AppListGridSizeWidth)) {
Q_EMIT sendSetslidebar(Style::AppListGridSizeWidth);
}
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Up: {
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Down: {
return QListView::keyPressEvent(e);
break;
}
default:
return QListView::keyPressEvent(e);
break;
}
}
}
void FullListView::mouseReleaseEvent(QMouseEvent *event)
{
if (!(this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
Q_EMIT sendHideMainWindowSignal();
} else {
return QListView::mouseReleaseEvent(event);
}
}

View File

@ -0,0 +1,37 @@
#ifndef FULLLISTVIEW_H
#define FULLLISTVIEW_H
#include <QObject>
#include <QListView>
#include "fulllistdelegate.h"
#include "src/UtilityFunction/utility.h"
#include "src/RightClickMenu/rightclickmenu.h"
#include "fulllistmodel.h"
class FullListView : public QListView
{
Q_OBJECT
public:
FullListView(QWidget *parent = nullptr, int page = 0);
void setAppList(QStringList appList);
void startChangeModel(QStringList appList);
protected:
void initWidget();
void keyPressEvent(QKeyEvent *e);
void mouseReleaseEvent(QMouseEvent *event);
private:
FullListDelegate* m_delegate = nullptr;
FullListModel* m_model = nullptr;
int m_page;
public Q_SLOTS:
void selectFirstItem();
void onClicked(QModelIndex index);//点击item
void rightClickedSlot(const QPoint &pos);
Q_SIGNALS:
void sendSetslidebar(int value);
void sendHideMainWindowSignal();
void sendUpdateAppListSignal();
};
#endif // FULLLISTVIEW_H

View File

@ -1,19 +1 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#include "qtlockedfile.h"

View File

@ -1,19 +1 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#include "qtsingleapplication.h"

View File

@ -1,20 +1,3 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#include "menubox.h"
#include <QDebug>
#include <QMouseEvent>

View File

@ -1,20 +1,3 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#ifndef MENUBOX_H
#define MENUBOX_H
#include <QMenu>

View File

@ -24,6 +24,7 @@ RightClickMenu::RightClickMenu(QWidget *parent):
QWidget(parent)
{
m_cmdProc=new QProcess;
m_whiteList.append("kylin-screenshot.desktop");
m_whiteList.append("ukui-notebook.desktop");
m_whiteList.append("ukui-clock.desktop");
@ -43,23 +44,14 @@ RightClickMenu::RightClickMenu(QWidget *parent):
m_whiteList.append("peony.desktop");
m_whiteList.append("engrampa.desktop");
if (isPANGU || isHuaWeiPC) {
m_whiteList.append("org.gnome.FileRoller.desktop");
m_whiteList.append("mate-terminal.desktop");
m_whiteList.append("hwaudioui.desktop");
}
m_ukuiMenuInterface=new UkuiMenuInterface;
}
RightClickMenu::~RightClickMenu()
{
delete m_cmdProc;
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
QPixmap RightClickMenu::getIconPixmap(QString iconstr, int type)
@ -67,15 +59,17 @@ QPixmap RightClickMenu::getIconPixmap(QString iconstr, int type)
const auto ratio=devicePixelRatioF();
QPixmap pixmap;
if (type == 0) {
if(type==0)
{
pixmap=loadSvg(iconstr,16*ratio);
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
} else {
}
else
{
QIcon icon=QIcon::fromTheme(iconstr);
QPixmap pixmap_1=icon.pixmap(QSize(16*ratio,16*ratio));
pixmap=drawSymbolicColoredPixmap(pixmap_1);
}
return pixmap;
}
@ -97,14 +91,11 @@ void RightClickMenu::unfixedFromAllActionTriggerSlot()
void RightClickMenu::fixToTaskbarActionTriggerSlot()
{
// QDBusInterface iface("com.ukui.panel.desktop",
// "/",
// "com.ukui.panel.desktop",
// QDBusConnection::sessionBus());
// QDBusReply<QVariant> ret=iface.call("AddToTaskbar",m_desktopfp);
QDBusMessage message = QDBusMessage::createSignal("/taskbar/quicklaunch", "org.ukui.panel.taskbar", "AddToTaskbar");
message << m_desktopfp;
QDBusConnection::sessionBus().send(message);
QDBusInterface iface("com.ukui.panel.desktop",
"/",
"com.ukui.panel.desktop",
QDBusConnection::sessionBus());
QDBusReply<QVariant> ret=iface.call("AddToTaskbar",m_desktopfp);
m_actionNumber=3;
}
@ -126,40 +117,40 @@ void RightClickMenu::addToDesktopActionTriggerSlot()
QFile file(m_desktopfp);
QString newname=QString(path+"/"+desktopfn);
bool ret=file.copy(QString(path+"/"+desktopfn));
if (ret) {
if(ret)
{
char command[200];
sprintf(command,"chmod a+x %s",newname.toLocal8Bit().data());
QProcess::startDetached(QString::fromLocal8Bit(command));
}
m_actionNumber=5;
}
void RightClickMenu::uninstallActionTriggerSlot()
{
// if(!checkOsRelease())
// {
if(!checkOsRelease())
{
QString cmd=QString("kylin-uninstaller %1")
.arg(m_desktopfp.toLocal8Bit().data());
bool ret=QProcess::startDetached(cmd);
qDebug()<<"卸载:"<<cmd<<ret;
qDebug() << "kylin-uninstaller";
// }
// else
// {
// QString cmd=QString("dpkg -S "+m_desktopfp);
// m_cmdProc->start("sh",QStringList()<<"-c"<<cmd);
// m_cmdProc->waitForFinished();
// QString output=m_cmdProc->readAllStandardOutput().trimmed();
// QString packageName=output.split(":").at(0);
// cmd.clear();
// cmd=QString("kylin-installer -remove %1")
// .arg(packageName.toLocal8Bit().data());
// bool ret=QProcess::startDetached(cmd);
// qDebug()<<"卸载:"<<cmd<<ret;
// qDebug() << "dpkg -S";
// }
}
else
{
QString cmd=QString("dpkg -S "+m_desktopfp);
m_cmdProc->start("sh",QStringList()<<"-c"<<cmd);
m_cmdProc->waitForFinished();
QString output=m_cmdProc->readAllStandardOutput().trimmed();
QString packageName=output.split(":").at(0);
cmd.clear();
cmd=QString("kylin-installer -remove %1")
.arg(packageName.toLocal8Bit().data());
bool ret=QProcess::startDetached(cmd);
qDebug()<<"卸载:"<<cmd<<ret;
qDebug() << "dpkg -S";
}
m_actionNumber=6;
}
@ -216,26 +207,26 @@ int RightClickMenu::showAppBtnMenu(const QPoint &pos, QString desktopfp)
m_actionNumber=0;
this->m_desktopfp.clear();
this->m_desktopfp=desktopfp;
MenuBox m_showAppMenu;
connect(&m_showAppMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
m_showAppMenu.setWindowFlag(Qt::Popup);
//添加菜单项,指定图标、名称、响应函数
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
if(!checkIfLocked(desktopfn))
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/fixed.svg",0)),tr("Pin to all"),
this,SLOT(fixToAllActionTriggerSlot()));
else
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/unfixed.svg",0)),tr("Unpin from all"),
this,SLOT(unfixedFromAllActionTriggerSlot()));
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",desktopfp);
if(!ret)
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/fixed.svg",0)),tr("Pin to taskbar"),
this,SLOT(fixToTaskbarActionTriggerSlot()));
@ -248,13 +239,9 @@ int RightClickMenu::showAppBtnMenu(const QPoint &pos, QString desktopfp)
//检查桌面快捷方式是否存在
QString desktopPath=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
QString path=QString(desktopPath+"/"+QFileInfo(m_desktopfp).fileName());
if (QFile(path).exists()) {
if(QFile(path).exists())
m_showAppMenu.actions().at(2)->setEnabled(false);//存在时禁用
}
m_showAppMenu.addSeparator();
if(!m_whiteList.contains(desktopfn))
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/uninstall.svg",0)),tr("Uninstall"),
this,SLOT(uninstallActionTriggerSlot()));
@ -272,6 +259,7 @@ int RightClickMenu::showShutdownMenu(const QPoint &pos)
MenuBox m_showShutMenu;
connect(&m_showShutMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
m_showShutMenu.setWindowFlag(Qt::Popup);
m_showShutMenu.addAction(QIcon(getIconPixmap("kylin-hebernate-symbolic",1)),tr("Sleep"),
this,SLOT(hibernateActionTriggerSlot()));//休眠睡眠相同
m_showShutMenu.addAction(QIcon(getIconPixmap("system-logout-symbolic",1)),tr("Log Out"),
@ -300,6 +288,7 @@ int RightClickMenu::showOtherMenu(const QPoint &pos, QString desktopfp)
// "/",
// "com.ukui.panel.desktop",
// QDBusConnection::sessionBus());
// QDBusReply<bool> ret=iface.call("CheckIfExist",this->m_desktopfp);
// if(!ret)
// menu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/fixed.svg",0)),tr("Pin to taskbar"),
@ -313,5 +302,6 @@ int RightClickMenu::showOtherMenu(const QPoint &pos, QString desktopfp)
m_showOtherMenu.setAttribute(Qt::WA_DeleteOnClose);
m_showOtherMenu.exec(pos);
qDebug() << "RightClickMenu::showOtherMenu(QString desktopfp)";
return m_actionNumber;
}

View File

@ -37,7 +37,6 @@
#include "src/Interface/ukuimenuinterface.h"
#include "src/Style/style.h"
#include "menubox.h"
#include <QWidget>
class RightClickMenu : public QWidget
{

View File

@ -0,0 +1,84 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#include "uninstallwhitelist.h"
#include "src/UtilityFunction/utility.h"
#include <QProcess>
UninstallWhitelist *UninstallWhitelist::instance = nullptr;
UninstallWhitelist::UninstallWhitelist()
{
m_whiteList.append("kylin-screenshot.desktop");
m_whiteList.append("ukui-notebook.desktop");
m_whiteList.append("ukui-clock.desktop");
m_whiteList.append("kylin-calculator.desktop");
m_whiteList.append("kylin-recorder.desktop");
m_whiteList.append("kylin-software-center.desktop");
m_whiteList.append("kylin-camera.desktop");
m_whiteList.append("biometric-manager.desktop");
m_whiteList.append("yhkylin-backup-tools.desktop");
m_whiteList.append("box-manager.desktop");
m_whiteList.append("ukui-system-monitor.desktop");
m_whiteList.append("ksc-defender.desktop");
m_whiteList.append("logview.desktop");
m_whiteList.append("kylin-service-support.desktop");
m_whiteList.append("kylin-user-guide.desktop");
m_whiteList.append("ukui-control-center.desktop");
m_whiteList.append("peony.desktop");
m_whiteList.append("engrampa.desktop");
if (isHuaWei9006C || isHuaWeiPC) {
m_whiteList.append("org.gnome.FileRoller.desktop");
m_whiteList.append("mate-terminal.desktop");
m_whiteList.append("hwaudioui.desktop");
}
}
UninstallWhitelist *UninstallWhitelist::getInstance()
{
if (instance == nullptr) {
instance = new UninstallWhitelist();
}
return instance;
}
QStringList UninstallWhitelist::getPkgNameWhiteList()
{
QStringList pkgNameList;
Q_FOREACH (QString desktop, m_whiteList) {
QProcess *processPkgName = new QProcess();
processPkgName->start(QString("dpkg -S /usr/share/applications/%1").arg(desktop));
connect(processPkgName, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
processPkgName->deleteLater();
});
processPkgName->waitForFinished();
QString pkgName = processPkgName->readAll();
pkgName = pkgName.left(pkgName.indexOf(":"));
pkgNameList.append(pkgName);
}
return pkgNameList;
}
QStringList UninstallWhitelist::getWhiteList()
{
return m_whiteList;
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#ifndef UNINSTALLWHITELIST_H
#define UNINSTALLWHITELIST_H
#include <QObject>
class UninstallWhitelist : public QObject
{
Q_OBJECT
public:
static UninstallWhitelist *getInstance();
/**
* @brief
* @return
*/
QStringList getPkgNameWhiteList();
/**
* @brief desktop列表
* @return
*/
QStringList getWhiteList();
private:
UninstallWhitelist();
private:
static UninstallWhitelist *instance;
QStringList m_whiteList;
};
#endif // UNINSTALLWHITELIST_H

View File

@ -30,10 +30,7 @@ FullSearchResultWidget::FullSearchResultWidget(QWidget *parent) :
FullSearchResultWidget::~FullSearchResultWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void FullSearchResultWidget::initUi()
@ -43,12 +40,14 @@ void FullSearchResultWidget::initUi()
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
this->setFixedSize(Style::MainViewWidWidth,
Style::AppListWidHeight);
QHBoxLayout* mainLayout=new QHBoxLayout;
mainLayout->setContentsMargins(0,0,0,0);
m_spaceItem=new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed);
mainLayout->addItem(m_spaceItem);
m_listView=new FullListView(this,3);
this->setLayout(mainLayout);
m_scrollArea=new ScrollArea;
m_scrollAreaWid=new ScrollAreaWid;
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
@ -62,9 +61,11 @@ void FullSearchResultWidget::initUi()
mainLayout->addWidget(m_scrollArea);
m_scrollAreaWidLayout->addWidget(m_listView);
m_scrollAreaWidLayout->addItem(new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding));
m_data.clear();
m_listView->addData(m_data);
m_ukuiMenuInterface=new UkuiMenuInterface;
connect(m_listView,&FullListView::sendItemClickedSignal,this,&FullSearchResultWidget::execApplication);
connect(m_listView,&FullListView::sendHideMainWindowSignal,this,&FullSearchResultWidget::sendHideMainWindowSignal);
}
@ -81,11 +82,8 @@ void FullSearchResultWidget::execApplication(QString desktopfp)
void FullSearchResultWidget::updateAppListView(QVector<QStringList> arg)
{
m_data.clear();
Q_FOREACH (QStringList appinfo, arg) {
Q_FOREACH(QStringList appinfo,arg)
m_data.append(appinfo.at(0));
}
m_listView->updateData(m_data);
resizeScrollAreaControls();
}
@ -98,11 +96,14 @@ void FullSearchResultWidget::resizeScrollAreaControls()
listview->adjustSize();
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
int rowcount=0;
if (listview->model()->rowCount() % dividend > 0) {
if(listview->model()->rowCount()%dividend>0)
{
rowcount=listview->model()->rowCount()/dividend+1;
} else {
}
else
{
rowcount=listview->model()->rowCount()/dividend;
}
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
@ -114,12 +115,12 @@ void FullSearchResultWidget::repaintWidget()
this->setFixedSize(Style::MainViewWidWidth,
Style::AppListWidHeight);
m_scrollArea->setFixedSize(Style::AppListWidWidth,this->height());
// this->layout()->setContentsMargins(Style::LeftWidWidth,0,0,0);
m_scrollAreaWidLayout->removeWidget(m_listView);
m_listView->setParent(nullptr);
delete m_listView;
m_listView=new FullListView(this,3);
m_scrollAreaWidLayout->insertWidget(0,m_listView);
m_data.clear();
m_listView->addData(m_data);
resizeScrollAreaControls();
@ -130,13 +131,11 @@ void FullSearchResultWidget::repaintWidget()
void FullSearchResultWidget::moveScrollBar(int type)
{
int height=Style::primaryScreenHeight;
if (type == 0) {
if(type==0)
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-height*100/1080);
} else {
else
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+height*100/1080);
}
}
void FullSearchResultWidget::setViewFocus()
{

View File

@ -6669,7 +6669,7 @@ gāng 冈
rǎn,nán,dān 冉
cè 冊
jiōng,jiǒng 冋
cè 册
,zhà
zài 再
guǎ 冎
jiǒng,jiōng 冏

View File

@ -6669,7 +6669,7 @@ gang 冈
dan,nan,ran 冉
ce 冊
jiong 冋
ce 册
zha,ce 册
zai 再
gua 冎
jiong 冏

View File

@ -27,10 +27,7 @@ SearchAppThread::SearchAppThread()
SearchAppThread::~SearchAppThread()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void SearchAppThread::run()
@ -38,59 +35,58 @@ void SearchAppThread::run()
m_appInfoVector.clear();
m_appInfoVector=UkuiMenuInterface::appInfoVector;
m_searchResultVector.clear();
m_searchFirstVector.clear();
m_searchRestVector.clear();
if (!this->m_keyWord.isEmpty()) {
if(!this->m_keyWord.isEmpty())
{
QString str=m_ukuiMenuInterface->getAppNamePinyin(m_keyWord);
int index=0;
// if(str.size()==1)
// {
// int num=static_cast<int>(str.toLocal8Bit().at(0));
// QStringList searchDesktopList;
// searchDesktopList.clear();
// if(num>=65 && num<=90)
// {
// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(num-65).size();i++)
// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(num-65).at(i));
// }
// else{
// while(index<m_appInfoVector.size())
// {
//// QString appNamePy=m_ukuiMenuInterface->getAppNamePinyin(m_appInfoVector.at(index).at(1));
//// QString appEnglishName=m_appInfoVector.at(index).at(2);
// QString appNameFl=m_appInfoVector.at(index).at(3);
if(str.size()==1)
{
int num=static_cast<int>(str.toLocal8Bit().at(0));
QStringList searchDesktopList;
searchDesktopList.clear();
if(num>=65 && num<=90)
{
for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(num-65).size();i++)
searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(num-65).at(i));
}
else{
while(index<m_appInfoVector.size())
{
// QString appNamePy=m_ukuiMenuInterface->getAppNamePinyin(m_appInfoVector.at(index).at(1));
// QString appEnglishName=m_appInfoVector.at(index).at(2);
QString appNameFl=m_appInfoVector.at(index).at(3);
// if(appNameFl==str)//匹配首字母
// {
// m_searchResultVector.append(m_appInfoVector.at(index));
// }
// index++;
// }
// }
//// else if(num<48 || (num>57 && num<65) || num>90)
//// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(26).size();i++)
//// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(26).at(i));
//// else
//// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(27).size();i++)
//// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(27).at(i));
// if(!searchDesktopList.isEmpty())
// {
// for(int i=0;i<searchDesktopList.size();i++)
// m_searchResultVector.append(QStringList()<<searchDesktopList.at(i)<<m_ukuiMenuInterface->getAppName(searchDesktopList.at(i)));
// }
// }
if(appNameFl==str)//匹配首字母
{
m_searchResultVector.append(m_appInfoVector.at(index));
}
index++;
}
}
// else if(num<48 || (num>57 && num<65) || num>90)
// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(26).size();i++)
// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(26).at(i));
// else
//{
while (index < m_appInfoVector.size()) {
// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(27).size();i++)
// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(27).at(i));
if(!searchDesktopList.isEmpty())
{
for(int i=0;i<searchDesktopList.size();i++)
m_searchResultVector.append(QStringList()<<searchDesktopList.at(i)<<m_ukuiMenuInterface->getAppName(searchDesktopList.at(i)));
}
}
else
{
while(index<m_appInfoVector.size())
{
// QString appNamePy=m_ukuiMenuInterface->getAppNamePinyin(m_appInfoVector.at(index).at(1));
QStringList appNameLs;
QStringList appNameFls;
QStringList appNamePyLst = Zeeker::FileUtils::findMultiToneWords(m_appInfoVector.at(index).at(1));
// QStringList appNamePyLst = Zeeker::FileUtils::findMultiToneWords("奇安信可信");
for (int i = 0; i < appNamePyLst.size() / 2; i++) {
for(int i = 0; i < appNamePyLst.size()/2; i++)
{
appNameLs.append(appNamePyLst.at(i * 2));
appNameFls.append(appNamePyLst.at(i * 2 + 1));
}
@ -99,45 +95,30 @@ void SearchAppThread::run()
QString appEnglishName=m_appInfoVector.at(index).at(2);
//QString appNameFls=m_appInfoVector.at(index).at(4);
if (m_keyWord.contains(QRegExp("[\\x4e00-\\x9fa5]+"))) { //中文正则表达式
if (appName.toUpper().contains(m_keyWord.toUpper())) {
if(m_keyWord.contains(QRegExp("[\\x4e00-\\x9fa5]+")))//中文正则表达式
{
if(appName.toUpper().contains(m_keyWord.toUpper()))
m_searchResultVector.append(m_appInfoVector.at(index));
}
} else {
for (int var = 0; var < appNameLs.size(); ++var) {
if (appNameLs[var].left(str.length()).contains(str, Qt::CaseInsensitive) ||
appNameFls[var].left(str.length()).contains(str, Qt::CaseInsensitive)) {
m_searchFirstVector.append(m_appInfoVector.at(index));
break;
} else if (appNameLs[var].contains(str, Qt::CaseInsensitive) ||
else
{
for (int var = 0; var < appNameLs.size(); ++var)
{
if(appNameLs[var].contains(str,Qt::CaseInsensitive) ||
appNameFls[var].contains(str,Qt::CaseInsensitive) ||
appEnglishName.contains(str, Qt::CaseInsensitive)) {
m_searchRestVector.append(m_appInfoVector.at(index));
appEnglishName.contains(str,Qt::CaseInsensitive))
{
m_searchResultVector.append(m_appInfoVector.at(index));
break;
}
}
}
index++;
//}
}
}
}
qSort(m_searchFirstVector.begin(), m_searchFirstVector.end(), UkuiMenuInterface::cmpApp);
qSort(m_searchRestVector.begin(), m_searchRestVector.end(), UkuiMenuInterface::cmpApp);
if (m_searchResultVector.size() != 0) {
qSort(m_searchResultVector.begin(),m_searchResultVector.end(),UkuiMenuInterface::cmpApp);
}
for (int i = 0; i < m_searchFirstVector.size(); i++) {
m_searchResultVector.append(m_searchFirstVector.at(i));
}
for (int i = 0; i < m_searchRestVector.size(); i++) {
m_searchResultVector.append(m_searchRestVector.at(i));
}
Q_EMIT sendSearchResult(m_searchResultVector);
}

View File

@ -33,8 +33,6 @@ public:
private:
QString m_keyWord;
QVector<QStringList> m_searchResultVector;
QVector<QStringList> m_searchFirstVector;
QVector<QStringList> m_searchRestVector;
UkuiMenuInterface* m_ukuiMenuInterface=nullptr;
QVector<QStringList> m_appInfoVector;

View File

@ -30,10 +30,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
SearchResultWidget::~SearchResultWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
}
void SearchResultWidget::initUi()
@ -46,12 +43,13 @@ void SearchResultWidget::initUi()
m_listView=new ListView(this,this->width()-6,this->height()-6,3);
m_listView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
m_listView->show();
m_data.clear();
m_listView->addData(m_data);
m_ukuiMenuInterface=new UkuiMenuInterface;
connect(m_listView,&ListView::sendItemClickedSignal,this,&SearchResultWidget::execApplication);
connect(m_listView,&ListView::sendHideMainWindowSignal,this,&SearchResultWidget::sendHideMainWindowSignal);
connect(m_listView, &ListView::sendMainWinActiveSignal, this, &SearchResultWidget::sendMainWinActiveSignal);
}
/**
@ -67,22 +65,18 @@ void SearchResultWidget::execApplication(QStringList arg)
void SearchResultWidget::updateAppListView(QVector<QStringList> arg)
{
m_data.clear();
Q_FOREACH (QStringList appinfo, arg) {
Q_FOREACH(QStringList appinfo,arg)
m_data.append(QStringList()<<appinfo.at(0)<<"1");
}
m_listView->updateData(m_data);
}
void SearchResultWidget::moveScrollBar(int type)
{
if (type == 0) {
if(type==0)
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-100);
} else {
else
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+100);
}
}
void SearchResultWidget::repaintWidget()
{

View File

@ -81,8 +81,6 @@ Q_SIGNALS:
* @brief Send a hidden main window signal to the MainViewWidget
*/
void sendHideMainWindowSignal();
void sendMainWinActiveSignal(bool flag);
};
#endif // SEARCHRESULTWIDGET_H

View File

@ -35,10 +35,9 @@ SideBarWidget::SideBarWidget(QWidget *parent) :
SideBarWidget::~SideBarWidget()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
// delete m_shutDownMenu;
// delete m_otherMenu;
}
/**
@ -49,6 +48,7 @@ void SideBarWidget::initUi()
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_StyledBackground,true);
this->setFocusPolicy(Qt::NoFocus);
addSidebarBtn();
loadMinSidebar();
m_minMaxBtn->installEventFilter(this);
@ -68,28 +68,31 @@ void SideBarWidget::initUi()
bool SideBarWidget::eventFilter(QObject * target , QEvent * event )
{
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = (QKeyEvent *)event;
if (ke->key() == Qt::Key_Tab) {
if( event->type() == QEvent::KeyPress )
{
QKeyEvent *ke = (QKeyEvent *)event;
if( ke->key() == Qt::Key_Tab )
{
Q_EMIT setFocusToMainWin();
// return true;
}
if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Left) {
if (m_minMaxBtn->hasFocus()) {
if(ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Left)
{
if(m_minMaxBtn->hasFocus())
{
m_shutDownBtn->setFocus();
return true;
}
}
if (ke->key() == Qt::Key_Down || ke->key() == Qt::Key_Right) {
if (m_shutDownBtn->hasFocus()) {
if(ke->key() == Qt::Key_Down || ke->key() == Qt::Key_Right)
{
if(m_shutDownBtn->hasFocus())
{
this->setFocus();
}
}
}
return QWidget::eventFilter(target , event);
}
@ -122,6 +125,7 @@ void SideBarWidget::addSidebarBtn()
// m_minMaxBtn->setFlat(true);
// m_minMaxBtn->setProperty("doNotAnimate",true);
// m_minMaxBtn->setShortcut(QKeySequence::InsertParagraphSeparator);
// m_minMaxBtn->setShortcut(Qt::Key_Enter);
// m_minMaxBtn->setShortcut(Qt::Key_Return);
// QShortcut *key_1 = new QShortcut(QKeySequence(Qt::Key_Enter),this);
@ -132,6 +136,7 @@ void SideBarWidget::addSidebarBtn()
m_minMaxWidget->setLayout(m_minMaxLayout);
// m_minMaxWidget->setAttribute(Qt::WA_StyledBackground,true);
// m_minMaxWidget->hasFocus();
//分类按钮
m_buttonList.clear();
m_allBtn=new QPushButton;
@ -141,7 +146,6 @@ void SideBarWidget::addSidebarBtn()
m_functionBtn=new QPushButton;
initBtn(m_functionBtn,QString::fromLocal8Bit(":/data/img/sidebarwidget/function.svg"),tr("Function"),2);
int id=0;
Q_FOREACH (QAbstractButton* btn, m_buttonList) {
// m_btnGroup->addButton(btn,id++);
btn->setCheckable(true);
@ -170,16 +174,20 @@ void SideBarWidget::addSidebarBtn()
connect(m_trashBtn,&QPushButton::clicked,this,&SideBarWidget::trashBtnClickedSlot);
connect(m_shutDownBtn,&QPushButton::clicked,this,&SideBarWidget::shutdownBtnClickedSlot);
connect(m_userIconBtn,&QPushButton::clicked,this,&SideBarWidget::userIconBtnClickedSlot);
// Q_FOREACH (QAbstractButton *button, m_buttonList) {
// QPushButton *btn = qobject_cast<QPushButton *>(button);
// if (m_buttonList.indexOf(button) > 3 && m_buttonList.indexOf(button) < m_buttonList.count() - 1) {
// button->setCheckable(false);
// addRightClickMenu(btn);
// }
// }
Q_FOREACH(QAbstractButton* button,m_buttonList)
{
QPushButton* btn=qobject_cast<QPushButton*>(button);
if(m_buttonList.indexOf(button)>3 && m_buttonList.indexOf(button)<m_buttonList.count()-1)
{
button->setCheckable(false);
addRightClickMenu(btn);
}
}
m_shutDownBtn->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_shutDownBtn,&QPushButton::customContextMenuRequested,this,
&SideBarWidget::shutdownBtnRightClickSlot);
//监控用户账户信息更改
qint64 uid=static_cast<qint64>(getuid());
QDBusInterface iface("org.freedesktop.Accounts",
@ -191,6 +199,7 @@ void SideBarWidget::addSidebarBtn()
objPath.value().path(),
"org.freedesktop.Accounts.User",
QString("Changed"),this,SLOT(userAccountsChanged()));
m_mainWidgetLayout->addWidget(m_minMaxWidget);
m_mainWidgetLayout->addWidget(m_buttonList.at(0));
m_mainWidgetLayout->addWidget(m_buttonList.at(1));
@ -198,33 +207,24 @@ void SideBarWidget::addSidebarBtn()
m_verticalSpacer = new QSpacerItem(20,40, QSizePolicy::Fixed, QSizePolicy::Expanding);
m_mainWidgetLayout->addItem(m_verticalSpacer);
m_mainWidgetLayout->addWidget(m_buttonList.at(3));
if (QGSettings::isSchemaInstalled(QString("org.ukui.control-center.desktop").toLocal8Bit())) {
if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.desktop").toLocal8Bit()))
{
m_gsetting=new QGSettings(QString("org.ukui.control-center.desktop").toLocal8Bit());
if (m_gsetting->keys().contains(QString("personalIconLocking")) && m_gsetting->get("personal-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("personalIconLocking")) && m_gsetting->get("personal-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(4));
}
if (m_gsetting->keys().contains(QString("trashIconLocking")) && m_gsetting->get("trash-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("trashIconLocking")) && m_gsetting->get("trash-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(5));
}
if (m_gsetting->keys().contains(QString("computerIconLocking")) && m_gsetting->get("computer-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("computerIconLocking")) && m_gsetting->get("computer-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(6));
}
if (m_gsetting->keys().contains(QString("settingsIconLocking")) && m_gsetting->get("settings-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("settingsIconLocking")) && m_gsetting->get("settings-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(7));
}
connect(m_gsetting,&QGSettings::changed,
this,&SideBarWidget::resetSidebarBtnSlot);
}
m_mainWidgetLayout->addWidget(m_buttonList.at(8));
if (QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit())) {
if(QGSettings::isSchemaInstalled(QString("org.ukui.style").toLocal8Bit()))
{
QGSettings* gsetting=new QGSettings(QString("org.ukui.style").toLocal8Bit());
connect(gsetting,&QGSettings::changed,this,&SideBarWidget::themeModeChangeSlot);
}
@ -235,7 +235,6 @@ void SideBarWidget::addSidebarBtn()
void SideBarWidget::resetSidebarBtnSlot()
{
QLayoutItem *child;
while ((child = m_mainWidgetLayout->takeAt(6)) != 0) {
QWidget* wid=child->widget();
m_mainWidgetLayout->removeWidget(wid);
@ -243,24 +242,17 @@ void SideBarWidget::resetSidebarBtnSlot()
delete child;
}
if (QGSettings::isSchemaInstalled(QString("org.ukui.control-center.desktop").toLocal8Bit())) {
if (m_gsetting->keys().contains(QString("personalIconLocking")) && m_gsetting->get("personal-icon-locking").toBool()) {
if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.desktop").toLocal8Bit()))
{
if(m_gsetting->keys().contains(QString("personalIconLocking")) && m_gsetting->get("personal-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(4));
}
if (m_gsetting->keys().contains(QString("trashIconLocking")) && m_gsetting->get("trash-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("trashIconLocking")) && m_gsetting->get("trash-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(5));
}
if (m_gsetting->keys().contains(QString("computerIconLocking")) && m_gsetting->get("computer-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("computerIconLocking")) && m_gsetting->get("computer-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(6));
}
if (m_gsetting->keys().contains(QString("settingsIconLocking")) && m_gsetting->get("settings-icon-locking").toBool()) {
if(m_gsetting->keys().contains(QString("settingsIconLocking")) && m_gsetting->get("settings-icon-locking").toBool())
m_mainWidgetLayout->addWidget(m_buttonList.at(7));
}
}
m_mainWidgetLayout->addWidget(m_buttonList.at(8));
}
@ -276,28 +268,25 @@ void SideBarWidget::initBtn(QPushButton *btn, QString btnicon, QString text, int
labelicon->setAlignment(Qt::AlignCenter);
const auto ratio=devicePixelRatioF();
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
if (num != 3) {
if(num!=3)
{
QPixmap pixmap=loadSvg(btnicon,Style::SideBarIconSize*ratio);
if (gsetting.get("style-name").toString() == "ukui-light") { //反黑
if(gsetting.get("style-name").toString()=="ukui-light")//反黑
pixmap=drawSymbolicBlackColoredPixmap(pixmap);
} else {
else
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
}
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
labelicon->setFixedSize(Style::SideBarIconSize,Style::SideBarIconSize);
labelicon->setPixmap(pixmap);
} else {
if (!QFile::exists(btnicon)) {
btnicon = QString("/usr/share/ukui/faces/default.png");
}
else {
if(!QFile::exists(btnicon))
btnicon=QString("/usr/share/ukui/faces/default.png");
labelicon->setObjectName("faceLabel");
labelicon->setFocusPolicy(Qt::NoFocus);
labelicon->setAlignment(Qt::AlignCenter);
labelicon->setFixedSize(Style::SideBarIconSize+4,Style::SideBarIconSize+4);
QPixmap facePixmap(btnicon);
facePixmap = facePixmap.scaled((Style::SideBarIconSize+4)*ratio,(Style::SideBarIconSize+4)*ratio, Qt::KeepAspectRatio, Qt::SmoothTransformation);
facePixmap = PixmapToRound(facePixmap, (Style::SideBarIconSize+4)*ratio/2);
@ -308,19 +297,20 @@ void SideBarWidget::initBtn(QPushButton *btn, QString btnicon, QString text, int
btnLayout->setSpacing(0);
btnLayout->addWidget(labelicon);
// btnLayout->addStretch();
QLabel* textLabel=new QLabel;
if (num == 3) {
if(num==3)
textLabel->setObjectName("nameLabel");
}
textLabel->setText(text);
btnLayout->addWidget(textLabel);
btnLayout->addStretch();
btn->setLayout(btnLayout);
btn->setFocusPolicy(Qt::StrongFocus);
m_buttonList.append(btn);
m_textList.append(text);
m_labelList.append(textLabel);
}
@ -348,96 +338,84 @@ QPixmap SideBarWidget::PixmapToRound(const QPixmap &src, int radius)
*/
void SideBarWidget::shutdownBtnRightClickSlot(const QPoint &pos)
{
RightClickMenu m_otherMenu(this);
int ret = m_otherMenu.showShutdownMenu(m_shutDownBtn->mapToGlobal(pos));
connect(&m_otherMenu, &RightClickMenu::sendMainWinActiveSignal, this, &SideBarWidget::sendShowMainWindowSignal);
Q_EMIT sendShowMainWindowSignal(false);
int ret = m_otherMenu.showShutdownMenu(m_shutDownBtn->mapToGlobal(pos));
qDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 开始";
if (ret >= 10 && ret <= 17) {
if(ret>=10 && ret<=17)
{
Q_EMIT sendHideMainWindowSignal();
switch (ret) {
case 10:
QProcess::startDetached(QString("ukui-screensaver-command -l"));
break;
case 11:
QProcess::startDetached(QString("ukui-session-tools --switchuser"));
break;
case 12:
QProcess::startDetached(QString("ukui-session-tools --logout"));
break;
case 13:
QProcess::startDetached(QString("ukui-session-tools --reboot"));
break;
case 14:
QProcess::startDetached(QString("ukui-session-tools --shutdown"));
break;
case 16:
QProcess::startDetached(QString("ukui-session-tools --suspend"));
break;
case 17:
QProcess::startDetached(QString("ukui-session-tools --sleep"));
break;
default:
break;
}
}
}
qDebug() << "SideBarWidget::shutdownBtnRightClickSlot() 结束";
}
//void SideBarWidget::addRightClickMenu(QPushButton *btn)
//{
// btn->setContextMenuPolicy(Qt::CustomContextMenu);
// connect(btn, &QPushButton::customContextMenuRequested, this, &SideBarWidget::otherBtnRightClickSlot);
//}
void SideBarWidget::addRightClickMenu(QPushButton *btn)
{
btn->setContextMenuPolicy(Qt::CustomContextMenu);
connect(btn,&QPushButton::customContextMenuRequested,this,&SideBarWidget::otherBtnRightClickSlot);
}
//void SideBarWidget::otherBtnRightClickSlot(const QPoint &pos)
//{
// qDebug() << "SideBarWidget::otherBtnRightClickSlot() 开始";
// QPushButton *btn = dynamic_cast<QPushButton *>(QObject::sender());
// int index = m_buttonList.indexOf(btn);
// QString desktopfp;
// switch (index) {
// case 4:
// desktopfp = QString("/usr/share/applications/peony-home.desktop");
// break;
// case 5:
// desktopfp = QString("/usr/share/applications/peony-trash.desktop");
// break;
// case 6:
// desktopfp = QString("/usr/share/applications/peony-computer.desktop");
// break;
// case 7:
// desktopfp = QString("/usr/share/applications/ukui-control-center.desktop");
// break;
// default:
// break;
// }
// RightClickMenu m_otherMenu;
// int ret = m_otherMenu.showOtherMenu(btn->mapToGlobal(pos), desktopfp);
// Q_EMIT sendShowMainWindowSignal(false);
// if (ret == 15) {
// Q_EMIT sendHideMainWindowSignal();
// QProcess::startDetached(QString("ukui-control-center -d"));
// }
// qDebug() << "SideBarWidget::otherBtnRightClickSlot() 结束";
//}
void SideBarWidget::otherBtnRightClickSlot(const QPoint &pos)
{
qDebug() << "SideBarWidget::otherBtnRightClickSlot() 开始";
QPushButton* btn=dynamic_cast<QPushButton*>(QObject::sender());
int index=m_buttonList.indexOf(btn);
QString desktopfp;
switch (index) {
case 4:
desktopfp=QString("/usr/share/applications/peony-home.desktop");
break;
case 5:
desktopfp=QString("/usr/share/applications/peony-trash.desktop");
break;
case 6:
desktopfp=QString("/usr/share/applications/peony-computer.desktop");
break;
case 7:
desktopfp=QString("/usr/share/applications/ukui-control-center.desktop");
break;
default:
break;
}
RightClickMenu m_otherMenu;
connect(&m_otherMenu, &RightClickMenu::sendMainWinActiveSignal, this, &SideBarWidget::sendShowMainWindowSignal);
int ret = m_otherMenu.showOtherMenu(btn->mapToGlobal(pos), desktopfp);
Q_EMIT sendShowMainWindowSignal(false);
if(ret==15)
{
Q_EMIT sendHideMainWindowSignal();
QProcess::startDetached(QString("ukui-control-center -d"));
}
qDebug() << "SideBarWidget::otherBtnRightClickSlot() 结束";
}
void SideBarWidget::computerBtnClickedSlot()
{
@ -455,6 +433,7 @@ void SideBarWidget::controlBtnClickedSlot()
{
Q_EMIT sendHideMainWindowSignal();
execApp("/usr/share/applications/ukui-control-center.desktop");
}
void SideBarWidget::trashBtnClickedSlot()
@ -472,21 +451,19 @@ void SideBarWidget::shutdownBtnClickedSlot()
void SideBarWidget::userIconBtnClickedSlot()
{
Q_EMIT sendHideMainWindowSignal();
QProcess::startDetached(QString("ukui-control-center -m Userinfo"));
QProcess::startDetached(QString("ukui-control-center -u"));
}
void SideBarWidget::userAccountsChanged()
{
const auto ratio=devicePixelRatioF();
QString usericon=getUserIcon();
if (!QFile::exists(usericon)) {
if(!QFile::exists(usericon))
usericon=QString("/usr/share/ukui/faces/default.png");
}
QPixmap facePixmap(usericon);
facePixmap = facePixmap.scaled((Style::SideBarIconSize + 2) * ratio, (Style::SideBarIconSize + 2) * ratio, Qt::KeepAspectRatio, Qt::SmoothTransformation);
facePixmap = PixmapToRound(facePixmap, (Style::SideBarIconSize + 2) * ratio / 2);
facePixmap = facePixmap.scaled((Style::SideBarIconSize+4)*ratio,(Style::SideBarIconSize+4)*ratio, Qt::KeepAspectRatio, Qt::SmoothTransformation);
facePixmap = PixmapToRound(facePixmap, (Style::SideBarIconSize+4)*ratio/2);
QLabel* labelicon=m_userIconBtn->findChild<QLabel*>("faceLabel");
facePixmap.setDevicePixelRatio(qApp->devicePixelRatio());
labelicon->setPixmap(facePixmap);
@ -503,21 +480,26 @@ void SideBarWidget::loadMinSidebar()
{
m_isFullScreen=false;
setMaxBtn();
m_animation->stop();
this->setFixedSize(Style::defaultSideBarWidWidth,Style::minh);
m_mainWidget->setGeometry(QRect(0,0,this->width(),this->height()));
m_mainWidget->show();
m_minMaxWidget->setFixedSize(37,70);
m_minMaxLayout->setContentsMargins(0,0,0,0);
m_mainWidgetLayout->setContentsMargins(8,0,10,6);
Q_FOREACH (QAbstractButton *button, m_buttonList) {
Q_FOREACH(QAbstractButton* button,m_buttonList)
{
QPushButton* btn=qobject_cast<QPushButton*>(button);
setMinSidebarBtn(btn);
btn->setToolTip(m_textList.at(m_buttonList.indexOf(button)));
}
changeIconColor(false);
disconnect(m_minMaxBtn,&QToolButton::clicked,this, &SideBarWidget::sendDefaultBtnSignal);
connect(m_minMaxBtn, &QToolButton::clicked,this,&SideBarWidget::sendFullScreenBtnSignal);
}
@ -530,17 +512,16 @@ void SideBarWidget::setMaxBtn()
const auto ratio=devicePixelRatioF();
QGSettings gsetting(QString("org.ukui.style").toLocal8Bit());
QPixmap pixmap=loadSvg(QString(":/data/img/sidebarwidget/max.svg"),14*ratio);
if (gsetting.get("style-name").toString() == "ukui-light") { //反黑
if(gsetting.get("style-name").toString()=="ukui-light")//反黑
pixmap=drawSymbolicBlackColoredPixmap(pixmap);
} else {
else
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
}
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
m_minMaxBtn->setFixedSize(37,37);
m_minMaxBtn->setIcon(QIcon(pixmap));
m_minMaxBtn->setToolTip(tr("Max"));
// m_minMaxBtn->setFocus();
}
@ -550,15 +531,14 @@ void SideBarWidget::setMaxBtn()
void SideBarWidget::setMinSidebarBtn(QPushButton* btn)
{
btn->setFixedSize(37,37);
if (m_buttonList.indexOf(btn) == 3) {
if(m_buttonList.indexOf(btn)==3)
btn->layout()->setContentsMargins(7,0,17,0);
} else {
else
btn->layout()->setContentsMargins(9,0,17,0);
}
btn->layout()->setSpacing(0);
m_labelList.at(m_buttonList.indexOf(btn))->setVisible(false);
//移除按钮文本
// QLayoutItem *child;
// if((child = btn->layout()->takeAt(1)) != nullptr) {
@ -580,22 +560,28 @@ void SideBarWidget::loadMaxSidebar()
{
m_isFullScreen=true;
setMinBtn();
this->setFixedSize(Style::SideBarWidWidth,Style::heightavailable);
m_minMaxWidget->setFixedSize(Style::MinMaxWidWidth,Style::MinMaxWidHeight);
m_minMaxLayout->setContentsMargins(m_minMaxWidget->width()-m_minMaxBtn->width(),0,0,0);
m_mainWidgetLayout->setContentsMargins(0,0,0,6);
Q_FOREACH (QAbstractButton *button, m_buttonList) {
Q_FOREACH(QAbstractButton* button,m_buttonList)
{
QPushButton* btn=qobject_cast<QPushButton*>(button);
setMaxSidebarBtn(btn);
}
Q_FOREACH (QAbstractButton *button, m_buttonList) {
Q_FOREACH(QAbstractButton* button,m_buttonList)
{
QPushButton* btn=qobject_cast<QPushButton*>(button);
btn->setFixedSize(m_btnWidth,Style::SideBarBtnHeight);
}
changeIconColor(true);
disconnect(m_minMaxBtn, &QToolButton::clicked,this,&SideBarWidget::sendFullScreenBtnSignal);
connect(m_minMaxBtn, &QToolButton::clicked,this,&SideBarWidget::sendDefaultBtnSignal);
}
@ -609,9 +595,11 @@ void SideBarWidget::setMinBtn()
QPixmap pixmap=loadSvg(QString(":/data/img/sidebarwidget/min.svg"),14*ratio);
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
m_minMaxBtn->setFixedSize(Style::MinMaxBtnWidth,Style::MinMaxBtnWidth);
m_minMaxBtn->setIcon(QIcon(pixmap));
m_minMaxBtn->setToolTip("");
// m_minMaxBtn->setFocus();
}
@ -621,11 +609,13 @@ void SideBarWidget::setMinBtn()
void SideBarWidget::setMaxSidebarBtn(QPushButton *btn)
{
QHBoxLayout* layout=qobject_cast<QHBoxLayout*>(btn->layout());
if (m_buttonList.indexOf(btn) == 3) {
if(m_buttonList.indexOf(btn)==3)
{
layout->setContentsMargins(13,0,0,0);
layout->setSpacing(8);
} else {
}
else
{
layout->setContentsMargins(15,0,0,0);
layout->setSpacing(10);
}
@ -648,13 +638,16 @@ void SideBarWidget::setMaxSidebarBtn(QPushButton *btn)
// }
//添加文本
// QLabel* labeltext=new QLabel;
if (m_buttonList.indexOf(btn) <= 2) {
if(m_buttonList.indexOf(btn)<=2)
{
labeltext->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
labeltext->setText(m_textList.at(m_buttonList.indexOf(btn)));
labeltext->adjustSize();
m_btnWidth=44+labeltext->width()+10;
btn->setToolTip("");
} else {
}
else
{
QFont ft;
QFontMetrics fm(ft);
QString text = fm.elidedText(m_textList.at(m_buttonList.indexOf(btn)), Qt::ElideRight, m_btnWidth-44);
@ -662,14 +655,11 @@ void SideBarWidget::setMaxSidebarBtn(QPushButton *btn)
labeltext->setText(text);
labeltext->setFixedSize(m_btnWidth-44,Style::SideBarBtnHeight);
labeltext->adjustSize();
if (fm.boundingRect(m_textList.at(m_buttonList.indexOf(btn))).width() > labeltext->width()) {
if(fm.boundingRect(m_textList.at(m_buttonList.indexOf(btn))).width()>labeltext->width())
btn->setToolTip(m_textList.at(m_buttonList.indexOf(btn)));
} else {
else
btn->setToolTip("");
}
}
QPalette pe = labeltext->palette();
pe.setColor(QPalette::ButtonText,QColor(Qt::white));
labeltext->setPalette(pe);
@ -681,11 +671,13 @@ void SideBarWidget::btnAllClickedSlot()
m_allBtn->setChecked(true);
m_letterBtn->setChecked(false);
m_functionBtn->setChecked(false);
if (m_isFullScreen) {
if(m_isFullScreen)
{
Q_EMIT sendFullScreenCommonUseBtnSignal();
Q_EMIT setSlideBar(0);
} else {
}
else
{
Q_EMIT sendCommonUseBtnSignal();
}
}
@ -695,10 +687,12 @@ void SideBarWidget::btnLetterClickedSlot()
m_allBtn->setChecked(false);
m_letterBtn->setChecked(true);
m_functionBtn->setChecked(false);
if (m_isFullScreen) {
if(m_isFullScreen)
{
Q_EMIT sendFullScreenLetterBtnSignal();
} else {
}
else
{
Q_EMIT sendLetterBtnSignal();
}
}
@ -709,75 +703,66 @@ void SideBarWidget::btnFuncClickedSlot()
m_letterBtn->setChecked(false);
m_functionBtn->setChecked(true);
if (m_isFullScreen) {
if(m_isFullScreen)
{
Q_EMIT sendFullScreenFunctionBtnSignal();
} else {
}
else
{
Q_EMIT sendFunctionBtnSignal();
}
}
void SideBarWidget::themeModeChangeSlot(QString styleName)
{
if (styleName == "styleName") {
if(styleName=="styleName")
{
QGSettings* gsetting=new QGSettings(QString("org.ukui.style").toLocal8Bit());
Q_FOREACH (QAbstractButton *button, m_buttonList) {
Q_FOREACH(QAbstractButton *button,m_buttonList)
{
QPushButton *btn=qobject_cast<QPushButton*>(button);
QLayoutItem *item=btn->layout()->itemAt(0);
QLabel *label=qobject_cast<QLabel*>(item->widget());
QString iconStr;
switch (m_buttonList.indexOf(button)) {
case 0:
iconStr=QString(":/data/img/sidebarwidget/commonuse.svg");
break;
case 1:
iconStr=QString(":/data/img/sidebarwidget/letter.svg");
break;
case 2:
iconStr=QString(":/data/img/sidebarwidget/function.svg");
break;
case 3:
userAccountsChanged();
break;
case 4:
iconStr=QString(":/data/img/sidebarwidget/personal.svg");
break;
case 5:
iconStr=QString(":/data/img/sidebarwidget/trash.svg");
break;
case 6:
iconStr=QString(":/data/img/sidebarwidget/computer.svg");
break;
case 7:
iconStr=QString(":/data/img/sidebarwidget/setting.svg");
break;
case 8:
iconStr=QString(":/data/img/sidebarwidget/shutdown.svg");
break;
default:
break;
}
if (m_buttonList.indexOf(button) != 3) {
if(m_buttonList.indexOf(button)!=3)
{
const auto ratio=devicePixelRatioF();
QPixmap pixmap=loadSvg(iconStr,19*ratio);
if (gsetting->get("style-name").toString() == "ukui-light") { //反黑
if(gsetting->get("style-name").toString()=="ukui-light")//反黑
pixmap=drawSymbolicBlackColoredPixmap(pixmap);
} else {
else
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
}
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
label->setPixmap(pixmap);
}
@ -788,64 +773,51 @@ void SideBarWidget::themeModeChangeSlot(QString styleName)
void SideBarWidget::changeIconColor(bool isFullScreen)
{
QGSettings* gsetting=new QGSettings(QString("org.ukui.style").toLocal8Bit());
Q_FOREACH (QAbstractButton *button, m_buttonList) {
Q_FOREACH(QAbstractButton *button,m_buttonList)
{
QPushButton *btn=qobject_cast<QPushButton*>(button);
QLayoutItem *item=btn->layout()->itemAt(0);
QLabel *label=qobject_cast<QLabel*>(item->widget());
QString iconStr;
switch (m_buttonList.indexOf(button)) {
case 0:
iconStr=QString(":/data/img/sidebarwidget/commonuse.svg");
break;
case 1:
iconStr=QString(":/data/img/sidebarwidget/letter.svg");
break;
case 2:
iconStr=QString(":/data/img/sidebarwidget/function.svg");
break;
case 3:
userAccountsChanged();
break;
case 4:
iconStr=QString(":/data/img/sidebarwidget/personal.svg");
break;
case 5:
iconStr=QString(":/data/img/sidebarwidget/trash.svg");
break;
case 6:
iconStr=QString(":/data/img/sidebarwidget/computer.svg");
break;
case 7:
iconStr=QString(":/data/img/sidebarwidget/setting.svg");
break;
case 8:
iconStr=QString(":/data/img/sidebarwidget/shutdown.svg");
break;
default:
break;
}
if (m_buttonList.indexOf(button) != 3) {
if(m_buttonList.indexOf(button)!=3)
{
const auto ratio=devicePixelRatioF();
QPixmap pixmap = loadSvg(iconStr, 18 * ratio);
if (gsetting->get("style-name").toString() == "ukui-light" && !isFullScreen) { //反黑
QPixmap pixmap=loadSvg(iconStr,19*ratio);
if(gsetting->get("style-name").toString()=="ukui-light" && !isFullScreen)//反黑
pixmap=drawSymbolicBlackColoredPixmap(pixmap);
} else {
else
pixmap=drawSymbolicColoredPixmap(pixmap);//反白
}
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
label->setPixmap(pixmap);
}
@ -891,17 +863,27 @@ void SideBarWidget::setSideBarBtnGeometry()
void SideBarWidget::keyPressEvent(QKeyEvent* e)
{
if (e->type() == QEvent::KeyPress) {
switch (e->key()) {
if(e->type()==QEvent::KeyPress)
{
switch(e->key())
{
case Qt::Key_Enter:
case Qt::Key_Return: {
if (m_allBtn->hasFocus()) {
case Qt::Key_Return:
{
if(m_allBtn->hasFocus())
{
m_allBtn->click();
} else if (m_letterBtn->hasFocus()) {
}
else if(m_letterBtn->hasFocus())
{
m_letterBtn->click();
} else if (m_functionBtn->hasFocus()) {
}
else if(m_functionBtn->hasFocus())
{
m_functionBtn->click();
} else {
}
else
{
QWidget *current_focus_widget;
current_focus_widget = QWidget::focusWidget();
QPushButton *le= qobject_cast<QPushButton*>(current_focus_widget);
@ -909,7 +891,6 @@ void SideBarWidget::keyPressEvent(QKeyEvent *e)
}
}
break;
case Qt::Key_Down:
qDebug() << "SideBarWidget::keyPressEvent(QKeyEvent* e) key_Down";
// focusNextChild();
@ -921,8 +902,8 @@ void SideBarWidget::keyPressEvent(QKeyEvent *e)
// {
// m_minMaxBtn->setFocus();
// }
break;
break;
case Qt::Key_Up:
qDebug() << "SideBarWidget::keyPressEvent(QKeyEvent* e) key_Up";
// /* focusPreviousChild();
@ -931,7 +912,6 @@ void SideBarWidget::keyPressEvent(QKeyEvent *e)
// m_minMaxBtn->setFocus();
// }
break;
default:
return QWidget::keyPressEvent(e);
break;

View File

@ -124,7 +124,7 @@ protected:
* @brief Add right-click menu
* @param btn: QPushButton
*/
// void addRightClickMenu(QPushButton* btn);
void addRightClickMenu(QPushButton* btn);
/**
* @brief Set the minimize button
*/
@ -160,7 +160,7 @@ private Q_SLOTS:
/**
* @brief Load other application right-click menu
*/
// void otherBtnRightClickSlot(const QPoint &pos);
void otherBtnRightClickSlot(const QPoint &pos);
/**
* @brief Respond to computer btn
*/

View File

@ -41,7 +41,6 @@ int Style::defaultQueryLineEditHeight=0;
int Style::defaultQueryLineEditIconSize=0;
int Style::defaultContentWidHeight=0;
int Style::defaultSideBarWidWidth=0;
int Style::defaultIconSize=32;
/**
*
*/
@ -101,39 +100,28 @@ int Style::SideBarSpaceBetweenItem=0;
void Style::initWidStyle()
{
getScreenAvailableGeometry();
QVariantList list=getScreenGeometry();
if(list.count()>=6)
{
primaryScreenX=list.at(0).toInt();
primaryScreenY=list.at(1).toInt();
primaryScreenWidth=list.at(2).toInt();
primaryScreenHeight=list.at(3).toInt();
panelSize=list.at(4).toInt();
panelPosition=list.at(5).toInt();
}
int fontSize = 10;
if (QGSettings::isSchemaInstalled(QString("org.mate.interface").toLocal8Bit())) {
QGSettings *setting = new QGSettings(QString("org.mate.interface").toLocal8Bit());
if (setting->keys().contains(QString("font-name"))) {
QString value = setting->get("font-name").toString();
QStringList valstr = value.split(" ");
int fontSize=valstr.at(valstr.count()-1).toInt();
if(panelPosition==0 || panelPosition==1)
{
widthavailable=primaryScreenWidth;
heightavailable=primaryScreenHeight-panelSize;
fontSize = valstr.at(valstr.count() - 1).toInt();
}
if(panelPosition==2 || panelPosition==3)
{
widthavailable=primaryScreenWidth-panelSize;
heightavailable=primaryScreenHeight;
}
int len = 0;
QString locale = QLocale::system().name();
if (locale == "zh_CN")
if (locale == "zh_CN") {
len = 0;
else
} else {
len = 10;
}
primaryScreenWidth = qApp->primaryScreen()->geometry().width();
primaryScreenHeight = qApp->primaryScreen()->geometry().height();
if(primaryScreenWidth==800 && primaryScreenHeight==600)
{
@ -175,7 +163,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=14;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=15;
@ -221,7 +209,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=14;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=15;
@ -267,7 +255,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=11;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=10;
@ -313,7 +301,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=11;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=10;
@ -359,7 +347,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=11;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=10;
@ -405,7 +393,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=11;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=10;
@ -451,7 +439,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=11;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=10;
@ -497,7 +485,7 @@ void Style::initWidStyle()
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
LeftFontSize=fontSize;
LeftLetterFontSize=11;
LeftIconSize=17;
LeftIconSize=19;
LeftSpaceIconLeft=15;
LeftSpaceIconText=14;
LeftSpaceBetweenItem=10;
@ -528,3 +516,40 @@ void Style::initWidStyle()
SideBarSpaceBetweenItem=16;
}
}
//不通过任务栏获取屏幕可用区域数据
void Style::getScreenAvailableGeometry()
{
QRect rect;
rect = qApp->primaryScreen()->geometry();
QDBusInterface iface(DBUS_NAME,
DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::sessionBus());
QDBusReply<QVariantList> reply = iface.call("GetPrimaryScreenPhysicalGeometry");
if (reply.isValid()) {
panelSize = reply.value().at(4).toInt();
panelPosition = reply.value().at(5).toInt();
}
QList<int> posIndex;
switch (panelPosition) {
case BOTTOM:
posIndex = {0, 0, 0, -1};
break;
case TOP:
posIndex = {0, 1, 0, -1};
break;
case LEFT:
posIndex = {1, 0, -1, 0};
break;
case RIGHT:
posIndex = {0, 0, -1, 0};
}
primaryScreenX = rect.x() + posIndex[0] * panelSize;
primaryScreenY = rect.y() + posIndex[1] * panelSize;
widthavailable = rect.width() + posIndex[2] * panelSize;
heightavailable = rect.height() + posIndex[3] * panelSize;
}

View File

@ -100,7 +100,6 @@ public:
static int minh;
static int defaultMainViewWidWidth;
static int defaultTopWidHeight;
static int defaultIconSize;
static int defaultQueryLineEditWidth;
static int defaultQueryLineEditHeight;
static int defaultQueryLineEditIconSize;
@ -165,6 +164,8 @@ public:
static int SideBarSpaceIconText; //按钮图标与文字内边距
static int SideBarSpaceBetweenItem; //item间距
private:
static void getScreenAvailableGeometry(); //获取屏幕可用区域
};
#endif // STYLE_H

View File

@ -32,35 +32,32 @@ QString ConvertDesktopToWinId::tranIdToDesktop(WId id)
{
KWindowInfo info(id, 0, NET::WM2AllProperties);
QString desktopName = confirmDesktopFile(info);
qDebug() << "desktopName is :" << desktopName;
myDebug() << "desktopName is :" << desktopName;
return desktopName;
}
QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
{
m_desktopfilePath = "";
m_dir = new QDir(DEKSTOP_FILE_PATH);
m_list = m_dir->entryInfoList();
QString desktopFilePath = nullptr;
QDir dir = QDir(DESKTOP_FILE_PATH);
QFileInfoList list = dir.entryInfoList();
//跳过 ./ 和 ../ 目录
m_list.removeAll(QFile(USR_SHARE_APP_CURRENT));
m_list.removeAll(QFile(USR_SHARE_APP_UPER));
list.removeAll(QFile(USR_SHARE_APP_CURRENT));
list.removeAll(QFile(USR_SHARE_APP_UPER));
//第一种方法获取点击应用时大部分desktop文件名
searchFromEnviron(info);
desktopFilePath = searchFromEnviron(info, list);
//第二种方法:比较名字一致性
if (m_desktopfilePath.isEmpty()) {
if (desktopFilePath.isEmpty()) {
m_classClass = info.windowClassClass().toLower();
m_className = info.windowClassName();
//匹配安卓兼容
if (m_className == "kylin-kmre-window") {
searchAndroidApp(info);
return m_desktopfilePath;
return searchAndroidApp(info);
}
QFile file(QString("/proc/%1/status").arg(info.pid()));
if (file.open(QIODevice::ReadOnly)) {
char buf[1024];
@ -69,11 +66,11 @@ QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
m_statusName = QString::fromLocal8Bit(buf).remove("Name:").remove("\t").remove("\n");
}
}
compareClassName();
desktopFilePath = compareClassName(list);
}
//第三种方法比较cmd命令行操作一致性
if (m_desktopfilePath.isEmpty()) {
if (desktopFilePath.isEmpty()) {
QFile file(QString("/proc/%1/cmdline").arg(info.pid()));
if (file.open(QIODevice::ReadOnly)) {
char buf[1024];
@ -82,30 +79,30 @@ QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
m_cmdLine = QString::fromLocal8Bit(buf).remove("\n");
}
}
compareCmdExec();
desktopFilePath = compareCmdExec(list);
}
//第四种方法:匹配部分字段
if (m_desktopfilePath.isEmpty()) {
compareLastStrategy();
if (desktopFilePath.isEmpty()) {
desktopFilePath = compareLastStrategy(list);
}
return m_desktopfilePath;
return desktopFilePath;
}
void ConvertDesktopToWinId::searchAndroidApp(KWindowInfo info)
QString ConvertDesktopToWinId::searchAndroidApp(KWindowInfo info)
{
m_androidDir = new QDir(QString(QDir::homePath() + ANDROID_FILE_PATH));
m_androidList = m_androidDir->entryInfoList();
m_androidList.removeAll(QDir::homePath() + ANDROID_APP_CURRENT);
m_androidList.removeAll(QDir::homePath() + ANDROID_APP_UPER);
QDir androidDir = QString(QDir::homePath() + ANDROID_FILE_PATH);
QFileInfoList androidList = androidDir.entryInfoList();
androidList.removeAll(QDir::homePath() + ANDROID_APP_CURRENT);
androidList.removeAll(QDir::homePath() + ANDROID_APP_UPER);
QFile file(QString("/proc/%1/cmdline").arg(info.pid()));
file.open(QIODevice::ReadOnly);
QByteArray cmd = file.readAll();
file.close();
QList<QByteArray> cmdList = cmd.split('\0');
for (int i = 0; i < m_androidList.size(); i++) {
QFileInfo fileInfo = m_androidList.at(i);
for (int i = 0; i < androidList.size(); i++) {
QFileInfo fileInfo = androidList.at(i);
QString desktopName = fileInfo.filePath();
if (!fileInfo.filePath().endsWith(".desktop")) {
continue;
@ -113,59 +110,65 @@ void ConvertDesktopToWinId::searchAndroidApp(KWindowInfo info)
desktopName = desktopName.mid(desktopName.lastIndexOf("/") + 1);
desktopName = desktopName.left(desktopName.lastIndexOf("."));
if(desktopName == cmdList.at(10)){
m_desktopfilePath = fileInfo.filePath();
return fileInfo.filePath();
}
}
return nullptr;
}
void ConvertDesktopToWinId::searchFromEnviron(KWindowInfo info)
QString ConvertDesktopToWinId::searchFromEnviron(KWindowInfo info, QFileInfoList list)
{
QFile file("/proc/" + QString::number(info.pid()) + "/environ");
file.open(QIODevice::ReadOnly);
QByteArray BA = file.readAll();
file.close();
QList<QByteArray> list_BA = BA.split('\0');
QString desktopFilePath = nullptr;
for (int i = 0; i < list_BA.length(); i++) {
if (list_BA.at(i).startsWith("GIO_LAUNCHED_DESKTOP_FILE=")) {
m_desktopfilePath = list_BA.at(i);
m_desktopfilePath = m_desktopfilePath.mid(m_desktopfilePath.indexOf("=") + 1);
desktopFilePath = list_BA.at(i);
desktopFilePath = desktopFilePath.mid(desktopFilePath.indexOf("=") + 1);
//desktop文件地址需要重写
m_desktopfilePath = m_desktopfilePath.mid(m_desktopfilePath.lastIndexOf("/") + 1);
desktopFilePath = desktopFilePath.mid(desktopFilePath.lastIndexOf("/") + 1);
break;
}
}
//desktop文件地址重写
if (!m_desktopfilePath.isEmpty()) {
for (int i = 0; i < m_list.size(); i++) {
QFileInfo fileInfo = m_list.at(i);;
if (fileInfo.filePath() == DEKSTOP_FILE_PATH + m_desktopfilePath) {
m_desktopfilePath = fileInfo.filePath();
if (!desktopFilePath.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
QFileInfo fileInfo = list.at(i);
if (fileInfo.filePath() == DESKTOP_FILE_PATH + desktopFilePath) {
desktopFilePath = fileInfo.filePath();
return desktopFilePath;
}
}
}
return desktopFilePath;
}
}
void ConvertDesktopToWinId::compareClassName()
QString ConvertDesktopToWinId::compareClassName(QFileInfoList list)
{
for (int i = 0; i < m_list.size(); i++) {
QFileInfo fileInfo = m_list.at(i);;
QString path_desktop_name = fileInfo.filePath();
for (int i = 0; i < list.size(); i++) {
QFileInfo fileInfo = list.at(i);;
QString pathDesktopName = fileInfo.filePath();
if (!fileInfo.filePath().endsWith(".desktop")) {
continue;
}
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
if (path_desktop_name == m_classClass || path_desktop_name == m_className || path_desktop_name == m_statusName) {
m_desktopfilePath = fileInfo.filePath();
pathDesktopName = pathDesktopName.mid(pathDesktopName.lastIndexOf("/") + 1);
pathDesktopName = pathDesktopName.left(pathDesktopName.lastIndexOf("."));
if (pathDesktopName == m_classClass || pathDesktopName == m_className || pathDesktopName == m_statusName) {
return fileInfo.filePath();
}
}
return nullptr;
}
void ConvertDesktopToWinId::compareCmdExec()
QString ConvertDesktopToWinId::compareCmdExec(QFileInfoList list)
{
for (int i = 0; i < m_list.size(); i++) {
for (int i = 0; i < list.size(); i++) {
QString cmd;
QFileInfo fileInfo = m_list.at(i);
QFileInfo fileInfo = list.at(i);
if (!fileInfo.filePath().endsWith(".desktop")) {
continue;
}
@ -177,38 +180,38 @@ void ConvertDesktopToWinId::compareCmdExec()
}
if (desktopFileExeName == m_cmdLine || desktopFileExeName.startsWith(m_cmdLine) || m_cmdLine.startsWith(desktopFileExeName)) {
m_desktopfilePath = fileInfo.filePath();
return fileInfo.filePath();
}
//仅仅是为了适配微信
if (m_desktopfilePath.isEmpty()) {
desktopFileExeName = "/usr/lib/" + desktopFileExeName;
if (desktopFileExeName == m_cmdLine || desktopFileExeName.startsWith(m_cmdLine) || m_cmdLine.startsWith(desktopFileExeName)) {
m_desktopfilePath = fileInfo.filePath();
}
return fileInfo.filePath();
}
}
return nullptr;
}
//最后的匹配策略汇总
void ConvertDesktopToWinId::compareLastStrategy()
QString ConvertDesktopToWinId::compareLastStrategy(QFileInfoList list)
{
compareCmdName();
QString desktopFilePath = compareCmdName(list);
if (m_desktopfilePath.isEmpty()) {
compareDesktopClass();
if (desktopFilePath.isEmpty()) {
desktopFilePath = compareDesktopClass(list);
}
if (m_desktopfilePath.isEmpty()) {
containsName();
if (desktopFilePath.isEmpty()) {
desktopFilePath = containsName(list);
}
return desktopFilePath;
}
void ConvertDesktopToWinId::compareCmdName()
QString ConvertDesktopToWinId::compareCmdName(QFileInfoList list)
{
for (int i = 0; i < m_list.size(); i++) {
for (int i = 0; i < list.size(); i++) {
QString cmd;
QFileInfo fileInfo = m_list.at(i);
QFileInfo fileInfo = list.at(i);
if (!fileInfo.filePath().endsWith(".desktop")) {
continue;
}
@ -220,37 +223,39 @@ void ConvertDesktopToWinId::compareCmdName()
}
if (desktopFileExeName.startsWith(m_className) || desktopFileExeName.endsWith(m_className)) {
m_desktopfilePath = fileInfo.filePath();
return fileInfo.filePath();
}
}
return nullptr;
}
void ConvertDesktopToWinId::compareDesktopClass()
QString ConvertDesktopToWinId::compareDesktopClass(QFileInfoList list)
{
for (int i = 0; i < m_list.size(); i++) {
QFileInfo fileInfo = m_list.at(i);
QString path_desktop_name = fileInfo.filePath();
for (int i = 0; i < list.size(); i++) {
QFileInfo fileInfo = list.at(i);
QString pathDesktopName = fileInfo.filePath();
if (!fileInfo.filePath().endsWith(".desktop")) {
continue;
}
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
pathDesktopName = pathDesktopName.mid(pathDesktopName.lastIndexOf("/") + 1);
pathDesktopName = pathDesktopName.left(pathDesktopName.lastIndexOf("."));
if (path_desktop_name.startsWith(m_className) || path_desktop_name.endsWith(m_className)) {
m_desktopfilePath = fileInfo.filePath();
if (pathDesktopName.startsWith(m_className) || pathDesktopName.endsWith(m_className)) {
return fileInfo.filePath();
}
else if (m_className.startsWith(path_desktop_name) || m_className.endsWith(path_desktop_name)) {
m_desktopfilePath = fileInfo.filePath();
else if (m_className.startsWith(pathDesktopName) || m_className.endsWith(pathDesktopName)) {
return fileInfo.filePath();
}
}
return nullptr;
}
void ConvertDesktopToWinId::containsName()
QString ConvertDesktopToWinId::containsName(QFileInfoList list)
{
for (int i = 0; i < m_list.size(); i++) {
for (int i = 0; i < list.size(); i++) {
QString cmd;
QFileInfo fileInfo = m_list.at(i);
QString path_desktop_name = fileInfo.filePath();
QFileInfo fileInfo = list.at(i);
QString pathDesktopName = fileInfo.filePath();
if (!fileInfo.filePath().endsWith(".desktop")) {
continue;
@ -259,13 +264,14 @@ void ConvertDesktopToWinId::containsName()
cmd.sprintf(GET_DESKTOP_EXEC_NAME_MAIN, fileInfo.filePath().toStdString().data());
QString desktopFileExeName = getDesktopFileName(cmd).remove("\n");
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
pathDesktopName = pathDesktopName.mid(pathDesktopName.lastIndexOf("/") + 1);
pathDesktopName = pathDesktopName.left(pathDesktopName.lastIndexOf("."));
if (path_desktop_name.contains(m_className) || desktopFileExeName.contains(m_className)) {
m_desktopfilePath = fileInfo.filePath();
if (pathDesktopName.contains(m_className) || desktopFileExeName.contains(m_className)) {
return fileInfo.filePath();
}
}
return nullptr;
}
//执行头文件中宏定义写好的终端指令获取对应的Exec字段
@ -284,12 +290,4 @@ QString ConvertDesktopToWinId::getDesktopFileName(QString cmd)
ConvertDesktopToWinId::~ConvertDesktopToWinId()
{
if (m_dir != nullptr) {
delete m_dir;
m_dir = nullptr;
}
if (m_androidDir) {
delete m_androidDir;
m_androidDir = nullptr;
}
}

View File

@ -23,7 +23,7 @@
#include <KWindowSystem>
#include <QDir>
#define DEKSTOP_FILE_PATH "/usr/share/applications/"
#define DESKTOP_FILE_PATH "/usr/share/applications/"
#define USR_SHARE_APP_CURRENT "/usr/share/applications/."
#define USR_SHARE_APP_UPER "/usr/share/applications/.."
#define PEONY_TRASH "/usr/share/applications/peony-trash.desktop"
@ -36,10 +36,11 @@
#define ANDROID_APP_CURRENT "/.local/share/applications/."
#define ANDROID_APP_UPER "/.local/share/applications/.."
/**
* @brief The ConvertDesktopToWinId class
* desktop文件与windowId的转换
* WindowId desktop文件路径
* desktop文件的路径(int)WindowId
*/
class ConvertDesktopToWinId: public QObject
@ -52,26 +53,20 @@ public:
QString tranIdToDesktop(WId id);
private:
QString m_desktopfilePath = nullptr;
QString m_classClass = nullptr;
QString m_className = nullptr;
QString m_statusName = nullptr;
QString m_cmdLine = nullptr;
QDir *m_dir = nullptr;
QDir *m_androidDir = nullptr;
QFileInfoList m_list;
QFileInfoList m_androidList;
QString confirmDesktopFile(KWindowInfo info);
void searchFromEnviron(KWindowInfo info);
void searchAndroidApp(KWindowInfo info);
void compareClassName();
void compareCmdExec();
void compareLastStrategy();
void compareCmdName();
void compareDesktopClass();
void containsName();
QString searchFromEnviron(KWindowInfo info, QFileInfoList list);
QString searchAndroidApp(KWindowInfo info);
QString compareClassName(QFileInfoList list);
QString compareCmdExec(QFileInfoList list);
QString compareLastStrategy(QFileInfoList list);
QString compareCmdName(QFileInfoList list);
QString compareDesktopClass(QFileInfoList list);
QString containsName(QFileInfoList list);
QString getDesktopFileName(QString cmd);
};

View File

@ -24,26 +24,26 @@ FullItemDelegate::FullItemDelegate(QObject *parent, int module):
QStyledItemDelegate(parent)
{
this->module=module;
m_ukuiMenuInterface = new UkuiMenuInterface;
pUkuiMenuInterface=new UkuiMenuInterface;
}
FullItemDelegate::~FullItemDelegate()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
delete pUkuiMenuInterface;
}
void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (index.isValid()) {
if(index.isValid())
{
QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
QRectF rect;
rect.setX(option.rect.x());
rect.setY(option.rect.y());
rect.setWidth(option.rect.width());
rect.setHeight(option.rect.height());
//QPainterPath画圆角矩形
const qreal radius = 4;
QPainterPath path;
@ -56,9 +56,10 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
path.lineTo(rect.topRight() + QPointF(0, radius));
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
painter->setRenderHint(QPainter::Antialiasing);
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
painter->setRenderHint(QPainter::Antialiasing);
if((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus))
{
// QColor color = option.palette.text().color();
// color.setAlphaF(0.15);
painter->save();
@ -72,58 +73,49 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
painter->save();
painter->setOpacity(1);
QString desktopfp=index.data(Qt::DisplayRole).value<QString>();
QString iconstr = m_ukuiMenuInterface->getAppIcon(desktopfp);
QString iconstr=pUkuiMenuInterface->getAppIcon(desktopfp);
QIcon icon;
QFileInfo iconFileInfo(iconstr);
if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) {
if(iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg")))
icon=QIcon(iconstr);
} else {
else
{
iconstr.remove(".png");
iconstr.remove(".svg");
icon=QIcon::fromTheme(iconstr);
if (icon.isNull() || icon.actualSize(QSize(Style::AppListIconSize,
Style::AppListIconSize)).width() < Style::AppListIconSize) {
if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg"))) {
if(icon.isNull())
{
if(QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconstr).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/96x96/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("xpm"))) {
icon = QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("xpm"));
} else if (QFile::exists(QString("/usr/share/icons/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/%1.%2").arg(iconstr).arg("png"));
} else {
else
icon=QIcon::fromTheme(QString("application-x-desktop"));
}
}
}
QString appname = m_ukuiMenuInterface->getAppName(desktopfp);
QString appname=pUkuiMenuInterface->getAppName(desktopfp);
QRect iconRect;
QRect textRect;
iconRect=QRect(rect.x()+Style::AppLeftSpace ,
@ -132,55 +124,58 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
Style::AppListIconSize);
icon.paint(painter,iconRect);
painter->restore();
painter->save();
bool is_locked=false;
QFileInfo fileInfo(desktopfp);
QString desktopfn=fileInfo.fileName();
//添加固定图标
if (module == 0) {
if (checkIfLocked(desktopfn)) {
if(module==0)
{
if(checkIfLocked(desktopfn))
{
is_locked=true;
QIcon icon(QString(":/data/img/mainviewwidget/lock-fs.svg"));
icon.paint(painter,QRect(iconRect.topRight().x()-14,iconRect.topRight().y()-2,16,16));
}
}
painter->restore();
textRect=QRect(rect.x()+5,
iconRect.bottom()+Style::AppSpaceBetweenIconText,
rect.width()-10,
rect.height()-iconRect.height()-Style::AppSpaceBetweenIconText);
painter->save();
//添加最近安装蓝色标签
bool is_recentapp=false;
QFontMetrics fm=painter->fontMetrics();
QString appnameElidedText=fm.elidedText(appname,Qt::ElideRight,rect.width()-10,Qt::TextShowMnemonic);
if (checkIfRecent(desktopfn) && !checkIfLocked(desktopfn)) {
if(checkIfRecent(desktopfn) && !checkIfLocked(desktopfn))
{
is_recentapp=true;
appnameElidedText=fm.elidedText(appname,Qt::ElideRight,rect.width()-23,Qt::TextShowMnemonic);
textRect=QRect(rect.x()+18,
iconRect.bottom()+Style::AppSpaceBetweenIconText,
rect.width()-23,
rect.height()-iconRect.height()-Style::AppSpaceBetweenIconText);
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(QColor("#4d94ff"));
int x=0;
if (rect.width() < (23 + fm.boundingRect(appname).width())) {
if(rect.width()<(23+fm.boundingRect(appname).width()))
x=rect.x()+9;
} else {
else
x=rect.x()+(rect.width()-13-fm.boundingRect(appname).width())/2+4;
}
painter->drawEllipse(QPoint(x,
textRect.y()+(fm.boundingRect(appname).height()-8)/2+4),
4,
4);
}
}
painter->restore();
painter->save();
// painter->setPen(QPen(option.palette.text().color()));
painter->setPen(QPen(Qt::white));
@ -189,18 +184,18 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
// painter->drawText(textRect,Qt::TextWordWrap |Qt::AlignHCenter,appname);
painter->restore();
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
if((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus))
{
int len=0;
if (!is_locked && is_recentapp) {
if(!is_locked && is_recentapp)
len=fm.boundingRect(appname).width()+23;
} else {
else
len=fm.boundingRect(appname).width()+10;
}
if (len > rect.width()) {
if(len>rect.width())
{
QToolTip::showText(QCursor::pos(),appname);
} else {
}
else {
QToolTip::hideText();
}
}

View File

@ -27,7 +27,7 @@
#include <QToolTip>
#include <QHelpEvent>
#include "src/Interface/ukuimenuinterface.h"
#include "src/Style/style.h"
class FullItemDelegate : public QStyledItemDelegate
{
@ -40,7 +40,7 @@ public:
private:
int module=0;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
protected:
// bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index);

View File

@ -29,24 +29,19 @@ FullListView::FullListView(QWidget *parent, int module):
this->module=module;
initWidget();
// inCurView = false;
m_ukuiMenuInterface = new UkuiMenuInterface;
pUkuiMenuInterface=new UkuiMenuInterface;
// menu=new RightClickMenu;
}
FullListView::~FullListView()
{
// delete menu;
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
delete pUkuiMenuInterface;
}
void FullListView::initWidget()
{
viewport()->setAttribute(Qt::WA_TranslucentBackground);
viewport()->setStyleSheet("background:transparent");//在paint中绘制滚动页面会导致透明效果绘制不及时出现黑影将paintEvent替换为样式表
this->setAutoFillBackground(false);
this->setSelectionMode(QAbstractItemView::SingleSelection);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// if(module==1 || module==2)s
@ -64,16 +59,22 @@ void FullListView::initWidget()
this->setFrameShape(QFrame::NoFrame);//移除边框
this->setStyleSheet(QString::fromUtf8("QStandardItemModel#listmodel{border:3px solid #FFFFFF; }QWidget#widget:focus{ border:5px solid #A5A6A1; } "));
connect(this,&FullListView::customContextMenuRequested,this,&FullListView::rightClickedSlot);
connect(this,&FullListView::clicked,this,&FullListView::onClicked);
flag = true;
//翻页灵敏度时间调节
time = new QTimer(this);
connect(time, &QTimer::timeout, [ = ]() {
if (flag == false) {
flag = true;
time->stop();
}
});
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
// {
// gsetting = new QGSettings(QString("org.ukui.control-center.personalise").toLocal8Bit());
// if(gsetting->keys().contains(QString("transparency")))
// transparency = gsetting->get("transparency").toDouble();
// connect(gsetting,&QGSettings::changed,[this] (const QString &key)
// {
// if (key == "transparency")
// {
// transparency = gsetting->get("transparency").toDouble();
// }
// });
// }
}
void FullListView::addData(QStringList data)
@ -81,12 +82,12 @@ void FullListView::addData(QStringList data)
listmodel=new QStandardItemModel(this);
this->setModel(listmodel);
Q_FOREACH (QString desktopfp, data) {
Q_FOREACH(QString desktopfp,data)
{
QStandardItem* item=new QStandardItem;
item->setData(QVariant::fromValue<QString>(desktopfp),Qt::DisplayRole);
listmodel->appendRow(item);
}
m_delegate= new FullItemDelegate(this,module);
this->setItemDelegate(m_delegate);
}
@ -106,8 +107,8 @@ void FullListView::focusOutEvent(QFocusEvent *event)
void FullListView::updateData(QStringList data)
{
listmodel->clear();
Q_FOREACH (QString desktopfp, data) {
Q_FOREACH(QString desktopfp,data)
{
QStandardItem* item=new QStandardItem;
item->setData(QVariant::fromValue<QString>(desktopfp),Qt::DisplayRole);
listmodel->appendRow(item);
@ -117,60 +118,55 @@ void FullListView::updateData(QStringList data)
void FullListView::onClicked(QModelIndex index)
{
QVariant var = listmodel->data(index, Qt::DisplayRole);
if (var.isValid()) {
if(var.isValid())
{
QString desktopfp=var.value<QString>();
Q_EMIT sendItemClickedSignal(desktopfp);
}
}
void FullListView::rightClickedSlot(const QPoint &pos)
{
Q_UNUSED(pos)
if (!(this->selectionModel()->selectedIndexes().isEmpty())) {
if(!(this->selectionModel()->selectedIndexes().isEmpty()))
{
QModelIndex index=this->currentIndex();
QVariant var=listmodel->data(index, Qt::DisplayRole);
QString desktopfp=var.value<QString>();
RightClickMenu menu;
int ret=menu.showAppBtnMenu(this->mapToGlobal(pos), desktopfp);
if (module > 0) {
if(module>0)
{
switch (ret) {
case 6:
Q_EMIT sendHideMainWindowSignal();
break;
case 7:
Q_EMIT sendHideMainWindowSignal();
break;
default:
break;
}
} else {
}
else{
switch (ret) {
case 1:
Q_EMIT sendUpdateAppListSignal();
break;
case 2:
Q_EMIT sendUpdateAppListSignal();
break;
case 6:
Q_EMIT sendHideMainWindowSignal();
break;
case 7:
Q_EMIT sendHideMainWindowSignal();
break;
default:
break;
}
}
//this->selectionModel()->clear();
}
}
@ -190,21 +186,22 @@ void FullListView::leaveEvent(QEvent *e)
// current_focus_widget = QApplication::focusWidget();
// current_focus_widget = QWidget::focusWidget();
// QPushButton *le= qobject_cast<QPushButton*>(current_focus_widget);
}
void FullListView::selectFirstItem()
{
qDebug() << "void FullListView::selectFirstItem()";
if (this->currentIndex().row() == -1) {
if(this->currentIndex().row() == -1)
{
this->setCurrentIndex(this->model()->index(0,0));
}
}
//void FullListView::paintEvent(QPaintEvent *e)
//{
// double transparency=getTransparency();
// QPainter painter(this->viewport());
void FullListView::paintEvent(QPaintEvent *e)
{
double transparency=getTransparency();
QPainter painter(this->viewport());
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
// {
@ -236,76 +233,72 @@ void FullListView::selectFirstItem()
// }
// else
// {
// painter.setBrush(this->palette().base());
// painter.setPen(Qt::transparent);
// painter.setOpacity(transparency);
// painter.drawRect(this->rect());
// }
// QListView::paintEvent(e);
painter.setBrush(this->palette().base());
painter.setPen(Qt::transparent);
painter.setOpacity(transparency);
painter.drawRect(this->rect());
// }
QListView::paintEvent(e);
}
void FullListView::keyPressEvent(QKeyEvent* e)
{
if (flag) { //避免长按按键界面滚动过快
flag = false;
time->start(100);
QRect center = visualRect(currentIndex());
if (e->type() == QEvent::KeyPress) {
switch (e->key()) {
if(e->type() == QEvent::KeyPress)
{
switch(e->key())
{
case Qt::Key_Enter:
case Qt::Key_Return: {
case Qt::Key_Return:
{
QModelIndex index = this->currentIndex();
Q_EMIT clicked(index);
break;
}
case Qt::Key_Left: {
case Qt::Key_Left:
{
this->clearFocus();
if (mapToGlobal(center.topRight()).y() < Style::QueryLineEditHeight + Style::AppListGridSizeWidth) {
if(mapToGlobal(center.topRight()).y() < Style::QueryLineEditHeight + Style::AppListGridSizeWidth)
{
Q_EMIT sendSetslidebar(-Style::AppListGridSizeWidth);
}
this->setFocus();
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Right:
{
case Qt::Key_Right: {
this->clearFocus();
if (mapToGlobal(center.bottomRight()).y() > (1080 - Style::AppListGridSizeWidth)) {
if(mapToGlobal(center.bottomRight()).y() > (1080 - Style::AppListGridSizeWidth))
{
Q_EMIT sendSetslidebar(Style::AppListGridSizeWidth);
}
this->setFocus();
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Up: {
if (module == 0) {
if (mapToGlobal(center.topRight()).y() < (Style::QueryLineEditHeight + Style::AppListGridSizeWidth)) {
this->clearFocus();
case Qt::Key_Up:
{
if(module == 0)
{
if(mapToGlobal(center.topRight()).y() < (Style::QueryLineEditHeight + Style::AppListGridSizeWidth))
{
Q_EMIT sendSetslidebar(-Style::AppListGridSizeWidth);
this->setFocus();
}
}
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Down: {
if (module == 0) {
if (mapToGlobal(center.bottomRight()).y() > (1080 - Style::AppListGridSizeWidth)) {
this->clearFocus();
case Qt::Key_Down:
{
if(module == 0)
{
if(mapToGlobal(center.bottomRight()).y() > (1080 - Style::AppListGridSizeWidth))
{
Q_EMIT sendSetslidebar(Style::AppListGridSizeWidth);
this->setFocus();
}
}
return QListView::keyPressEvent(e);
break;
}
@ -316,13 +309,15 @@ void FullListView::keyPressEvent(QKeyEvent *e)
}
}
}
}
void FullListView::mousePressEvent(QMouseEvent *event)
{
if (!(this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
if(!(this->indexAt(event->pos()).isValid()) && event->button()==Qt::LeftButton)
{
Q_EMIT sendHideMainWindowSignal();
} else {
}
else
{
return QListView::mousePressEvent(event);
}
}

View File

@ -44,7 +44,7 @@ protected:
void keyPressEvent(QKeyEvent* e);
void enterEvent(QEvent* e) Q_DECL_OVERRIDE;
void leaveEvent(QEvent* e) Q_DECL_OVERRIDE;
// void paintEvent(QPaintEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
void mousePressEvent(QMouseEvent *event);
@ -57,9 +57,7 @@ private:
RightClickMenu* menu=nullptr;//右键菜单
QStringList data;
QGSettings* gsetting;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
bool flag;
QTimer *time = nullptr;
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
// bool inCurView;

View File

@ -26,26 +26,26 @@ ItemDelegate::ItemDelegate(QObject *parent, int module):
QStyledItemDelegate(parent)
{
this->module=module;
m_ukuiMenuInterface = new UkuiMenuInterface;
pUkuiMenuInterface=new UkuiMenuInterface;
}
ItemDelegate::~ItemDelegate()
{
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
delete pUkuiMenuInterface;
}
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (index.isValid()) {
if(index.isValid())
{
// QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
QRectF rect;
rect.setX(option.rect.x());
rect.setY(option.rect.y());
rect.setWidth(option.rect.width());
rect.setHeight(option.rect.height()-2);
//QPainterPath画圆角矩形
const qreal radius = 4;
QPainterPath path;
@ -58,10 +58,11 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
path.lineTo(rect.topRight() + QPointF(0, radius));
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
painter->setRenderHint(QPainter::Antialiasing);
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
if((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus))
{
QColor color = option.palette.text().color();
color.setAlphaF(0.15);
painter->save();
@ -70,57 +71,44 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->drawPath(path);
painter->restore();
}
painter->setOpacity(1);
if (module > 0) {
if (strlist.at(1).toInt() == 1) {
QRect iconRect = QRect(rect.x() + 11, rect.y() + (rect.height() - 32) / 2, Style::defaultIconSize, Style::defaultIconSize);
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
if(module>0)
{
if(strlist.at(1).toInt()==1)
{
QRect iconRect=QRect(rect.x()+11,rect.y()+(rect.height()-32)/2,32,32);
QString iconstr=pUkuiMenuInterface->getAppIcon(strlist.at(0));
QIcon icon;
QFileInfo iconFileInfo(iconstr);
if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) {
if(iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg")))
icon=QIcon(iconstr);
} else {
else
{
iconstr.remove(".png");
iconstr.remove(".svg");
icon=QIcon::fromTheme(iconstr);
if (icon.isNull() || icon.actualSize(QSize(Style::defaultIconSize, Style::defaultIconSize)).width() < Style::defaultIconSize) {
if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg"))) {
if(icon.isNull())
{
if(QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("xpm"))) {
icon = QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("xpm"));
} else if (QFile::exists(QString("/usr/share/icons/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/%1.%2").arg(iconstr).arg("png"));
} else {
else
icon=QIcon::fromTheme(QString("application-x-desktop"));
}
}
}
painter->save();
icon.paint(painter, iconRect, Qt::AlignCenter);
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
icon.paint(painter,iconRect,Qt::AlignLeft);
QString appname=pUkuiMenuInterface->getAppName(strlist.at(0));
QFontMetrics fm=painter->fontMetrics();
QString appnameElidedText=fm.elidedText(appname,Qt::ElideRight,rect.width()-62,Qt::TextShowMnemonic);
painter->drawText(QRect(iconRect.right()+15,rect.y(),
@ -129,25 +117,28 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->save();
QFileInfo fileInfo(strlist.at(0));
QString desktopfn=fileInfo.fileName();
if (checkIfRecent(desktopfn)) {
if(checkIfRecent(desktopfn))
{
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(QColor("#4d94ff"));
painter->drawEllipse(QPoint(rect.topRight().x()-22,rect.y()+(rect.height()-8)/2+4),4,4);
}
painter->restore();
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
if((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus))
{
int len=fm.boundingRect(appname).width();
if (len > rect.width() - 62) {
if(len>rect.width()-62)
{
QToolTip::showText(QCursor::pos(),appname);
} else {
}
else {
QToolTip::hideText();
}
}
} else {
}
else
{
//绘制分割线
painter->save();
// QRect textRect=QRect(rect.x()+11,rect.y()+12,rect.width(),rect.height());
@ -159,67 +150,56 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
painter->drawLine(QPoint(5,rect.bottom()),QPoint(rect.right(),rect.bottom()));
painter->restore();
}
} else {
}
else
{
QRect iconRect=QRect(rect.left()+11,rect.y()+(rect.height()-32)/2,32,32);
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
QString iconstr=pUkuiMenuInterface->getAppIcon(strlist.at(0));
QIcon icon;
QFileInfo iconFileInfo(iconstr);
if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) {
if(iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg")))
icon=QIcon(iconstr);
} else {
else
{
iconstr.remove(".png");
iconstr.remove(".svg");
icon=QIcon::fromTheme(iconstr);
if (icon.isNull() || icon.actualSize(QSize(32, 32)).width() < 32) {
if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg"))) {
if(icon.isNull())
{
if(QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png"))) {
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"))) {
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png")))
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"))) {
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg")))
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"));
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("xpm"))) {
icon = QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("xpm"));
} else {
else
icon=QIcon::fromTheme(QString("application-x-desktop"));
}
}
}
icon.paint(painter, iconRect, Qt::AlignCenter);
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
icon.paint(painter,iconRect,Qt::AlignLeft);
QString appname=pUkuiMenuInterface->getAppName(strlist.at(0));
QFileInfo fileInfo(strlist.at(0));
QString desktopfn=fileInfo.fileName();
if (checkIfLocked(desktopfn)) {
if(checkIfLocked(desktopfn))
{
QIcon icon(QString(":/data/img/mainviewwidget/lock.svg"));
icon.paint(painter, QRect(rect.topRight().x() - 30, rect.y() + (rect.height() - 16) / 2, 16, 16));
icon.paint(painter,QRect(rect.topRight().x()-22,rect.y()+(rect.height()-16)/2,16,16));
}
painter->setOpacity(1);
painter->save();
if (checkIfRecent(desktopfn) && !checkIfLocked(desktopfn)) {
if(checkIfRecent(desktopfn) && !checkIfLocked(desktopfn))
{
painter->setPen(QPen(Qt::NoPen));
painter->setBrush(QColor("#4d94ff"));
painter->drawEllipse(QPoint(rect.topRight().x() - 30, rect.y() + (rect.height() - 8) / 2 + 4), 4, 4);
painter->drawEllipse(QPoint(rect.topRight().x()-22,rect.y()+(rect.height()-8)/2+4),4,4);
}
painter->restore();
painter->save();
painter->setPen(QPen(option.palette.text().color()));
@ -231,24 +211,28 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
rect.width()-62,rect.height()),Qt::AlignVCenter,appnameElidedText);
painter->restore();
if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) {
if((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus))
{
int len=fm.boundingRect(appname).width();
if (len > rect.width() - 62) {
if(len>rect.width()-62)
{
QToolTip::showText(QCursor::pos(),appname);
} else {
}
else {
QToolTip::hideText();
}
}
}
}
}
QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
// QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
// if(strlist.at(1).toInt()==1)
return QSize(298, 44);
return QSize(310,44);
// else
// return QSize(310,48);
}

View File

@ -39,7 +39,7 @@ public:
private:
int module=0;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
};

View File

@ -36,7 +36,6 @@ LetterClassifyButton::LetterClassifyButton(QWidget *parent,
this->setText(letter);
this->setFocusPolicy(Qt::NoFocus);
this->setCheckable(true);
this->setStyleSheet("padding: 0px;");
connect(this,&LetterClassifyButton::toggled,this,&LetterClassifyButton::reactToToggle);
}

View File

@ -28,17 +28,14 @@ ListView::ListView(QWidget *parent, int width, int height, int module):
this->h=height;
this->module=module;
initWidget();
m_ukuiMenuInterface = new UkuiMenuInterface;
pUkuiMenuInterface=new UkuiMenuInterface;
menu=new RightClickMenu;
}
ListView::~ListView()
{
delete menu;
if (m_ukuiMenuInterface != nullptr) {
delete m_ukuiMenuInterface;
m_ukuiMenuInterface = nullptr;
}
delete pUkuiMenuInterface;
}
void ListView::initWidget()
@ -72,13 +69,12 @@ void ListView::addData(QVector<QStringList> data)
{
listmodel=new QStandardItemModel(this);
this->setModel(listmodel);
Q_FOREACH (QStringList desktopfp, data) {
Q_FOREACH(QStringList desktopfp,data)
{
QStandardItem* item=new QStandardItem;
item->setData(QVariant::fromValue<QStringList>(desktopfp),Qt::DisplayRole);
listmodel->appendRow(item);
}
m_delegate= new ItemDelegate(this,module);
this->setItemDelegate(m_delegate);
}
@ -86,70 +82,65 @@ void ListView::addData(QVector<QStringList> data)
void ListView::updateData(QVector<QStringList> data)
{
listmodel->clear();
Q_FOREACH (QStringList desktopfp, data) {
Q_FOREACH(QStringList desktopfp,data)
{
QStandardItem* item=new QStandardItem;
item->setData(QVariant::fromValue<QStringList>(desktopfp),Qt::DisplayRole);
listmodel->appendRow(item);
}
// Q_EMIT dataChanged(createIndex(0,0), createIndex(listmodel->rowCount()-1,0));
}
void ListView::onClicked(QModelIndex index)
{
QVariant var = listmodel->data(index, Qt::DisplayRole);
if (var.isValid()) {
if(var.isValid())
{
Q_EMIT sendItemClickedSignal(var.value<QStringList>());
}
}
void ListView::rightClickedSlot(const QPoint &pos)
{
if (!this->selectionModel()->selectedIndexes().isEmpty()) {
if(!this->selectionModel()->selectedIndexes().isEmpty())
{
QModelIndex index=this->currentIndex();
// QRect center = visualRect(index);
QVariant var=listmodel->data(index, Qt::DisplayRole);
QStringList strlist=var.value<QStringList>();
if (strlist.at(1).toInt() == 1) {
if(strlist.at(1).toInt()==1)
{
int ret = menu->showAppBtnMenu(this->mapToGlobal(pos), strlist.at(0));
Q_EMIT sendMainWinActiveSignal(false);
if (module > 0) {
if (strlist.at(1).toInt() == 1) {
if(module>0)
{
if(strlist.at(1).toInt()==1)
{
switch (ret) {
case 6:
Q_EMIT sendHideMainWindowSignal();
break;
case 7:
Q_EMIT sendHideMainWindowSignal();
break;
default:
break;
}
}
} else {
}
else{
switch (ret) {
case 1:
Q_EMIT sendUpdateAppListSignal();
break;
case 2:
Q_EMIT sendUpdateAppListSignal();
break;
case 6:
Q_EMIT sendHideMainWindowSignal();
break;
case 7:
Q_EMIT sendHideMainWindowSignal();
break;
default:
break;
}
@ -191,6 +182,7 @@ void ListView::paintEvent(QPaintEvent *e)
painter.setPen(Qt::NoPen);
painter.setBrush(this->palette().base());
painter.fillRect(this->rect(), this->palette().base());
//滚动条
QPalette p=this->verticalScrollBar()->palette();
QColor color(255, 255, 255);
@ -211,8 +203,8 @@ void ListView::dragLeaveEvent(QDragLeaveEvent *e)
QFile file(m_desktopfp.at(0));
QString newname=QString(path+"/"+desktopfn);
bool ret=file.copy(QString(path+"/"+desktopfn));
if (ret) {
if(ret)
{
char command[200];
sprintf(command,"chmod a+x %s",newname.toLocal8Bit().data());
QProcess::startDetached(QString::fromLocal8Bit(command));
@ -227,35 +219,37 @@ void ListView::mousePressEvent(QMouseEvent *event)
void ListView::keyPressEvent(QKeyEvent* e)
{
if (e->type() == QEvent::KeyPress) {
switch (e->key()) {
if(e->type()==QEvent::KeyPress)
{
switch(e->key())
{
case Qt::Key_Enter:
case Qt::Key_Return: {
case Qt::Key_Return:
{
QModelIndex index=this->currentIndex();
Q_EMIT clicked(index);
}
break;
case Qt::Key_Down: {
if (currentIndex().row() == this->model()->rowCount() - 1) {
case Qt::Key_Down:
{
if(currentIndex().row() == this->model()->rowCount() - 1)
{
setCurrentIndex(this->model()->index(0,0));
break;
}
return QListView::keyPressEvent(e);
break;
}
case Qt::Key_Up: {
if (currentIndex().row() == 0) {
case Qt::Key_Up:
{
if(currentIndex().row() == 0)
{
setCurrentIndex(this->model()->index(this->model()->rowCount()-1,0));
break;
}
return QListView::keyPressEvent(e);
break;
}
default:
return QListView::keyPressEvent(e);
break;

View File

@ -57,7 +57,7 @@ private:
int w=0;
int h=0;
int module=0;
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
RightClickMenu* menu=nullptr;//右键菜单
QVector<QStringList> data;
@ -75,7 +75,6 @@ Q_SIGNALS:
void sendItemClickedSignal(QStringList arg);//发送item点击信号
void sendHideMainWindowSignal();
void sendUpdateAppListSignal();
void sendMainWinActiveSignal(bool flag);
};
#endif // LISTVIEW_H

View File

@ -1,20 +1,3 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#include "proxystyle.h"
#include <QApplication>
#include <QDebug>

View File

@ -1,20 +1,3 @@
/*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/&gt;.
*
*/
#ifndef INTERNALSTYLE_H
#define INTERNALSTYLE_H
#include <QProxyStyle>

View File

@ -0,0 +1,62 @@
#include "softwaredatabaseupdatethread.h"
#include <QDBusMessage>
#include <QDBusConnection>
#include <QGSettings>
#include <QDBusReply>
#include <QDBusInterface>
#include <QDir>
#include "src/UtilityFunction/utility.h"
#define DATABASENAME QDir::homePath()+"/.config/ukui/"+"UkuiMenu.db"
SoftwareDatabaseUpdateThread::SoftwareDatabaseUpdateThread(QObject *parent):
QThread(parent)
{
}
SoftwareDatabaseUpdateThread::~SoftwareDatabaseUpdateThread()
{
}
void SoftwareDatabaseUpdateThread::run()
{
QSqlDatabase db;
db = QSqlDatabase::addDatabase("QSQLITE", "SoftwareThreadDatabase");
db.setDatabaseName(DATABASENAME);
if (false == db.open()) {
qDebug() << db.lastError().text();
}
QSqlQuery sql(db);
QJsonDocument jsonDocument = QJsonDocument::fromJson(m_category.toLocal8Bit().data());
QJsonObject jsonObject = jsonDocument.object();
QJsonArray jsonArray = jsonObject[jsonObject.keys()[0]].toArray();
int number = 0;
db.transaction();
Q_FOREACH(QJsonValue jsonValue, jsonArray){
QJsonObject arrObject = jsonValue.toObject();
QString execline = QString("replace into appCategory values(\"%0\", \"%1\", \"%2\")")
.arg(arrObject[arrObject.keys()[0]].toString())
.arg(arrObject[arrObject.keys()[1]].toString())
.arg(arrObject[arrObject.keys()[2]].toString());
sql.exec(execline);
++number;
if (number % 5000 == 0) {
db.commit();
db.transaction();
}
}
db.commit();
myDebug() << "数据库已经更新";
Q_EMIT updateDatabaseSignal();
}
void SoftwareDatabaseUpdateThread::getDatabaseList(QString category)
{
this->m_category = category;
}

View File

@ -0,0 +1,27 @@
#ifndef SOFTWAREDATABASEUPDATETHREAD_H
#define SOFTWAREDATABASEUPDATETHREAD_H
#include <QObject>
#include <QWidget>
#include <QThread>
#include <QtCore>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
class SoftwareDatabaseUpdateThread: public QThread
{
Q_OBJECT
public:
SoftwareDatabaseUpdateThread(QObject *parent = nullptr);
~SoftwareDatabaseUpdateThread();
void run();
void getDatabaseList(QString category);
Q_SIGNALS:
void updateDatabaseSignal();
private:
QString m_category;
};
#endif // SOFTWAREDATABASEUPDATETHREAD_H

View File

@ -30,9 +30,6 @@
#define DATABASENAME QDir::homePath()+"/.config/ukui/"+"UkuiMenu.db"
bool isHuaWeiPC = false;
bool isPANGU = false;
const QPixmap loadSvg(const QString &fileName, const int size)
{
QPixmap pixmap(size, size);
@ -98,76 +95,6 @@ QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source)
return QPixmap::fromImage(img);
}
QRect getScreenAvailableGeometry()
{
QRect rect;
QVariantList list;
list.clear();
QDBusInterface iface(DBUS_NAME,
DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::sessionBus());
QDBusReply<QVariantList> reply=iface.call("GetPrimaryScreenAvailableGeometry");
if(iface.isValid() && reply.isValid())
{
list=reply.value();
rect = QRect(list.at(0).toInt(),list.at(1).toInt(),list.at(2).toInt(),list.at(3).toInt());
}
else
{
rect = qApp->primaryScreen()->availableGeometry();
}
return rect;
}
QVariantList getScreenGeometry()
{
QVariantList list;
list.clear();
QDBusInterface iface(DBUS_NAME,
DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::sessionBus());
QDBusReply<QVariantList> reply=iface.call("GetPrimaryScreenPhysicalGeometry");
if(iface.isValid() && reply.isValid())
{
list=reply.value();
}
else
{
QRect rect=QApplication::desktop()->screenGeometry(0);
list.append(QString::number(rect.x()));
list.append(QString::number(rect.y()));
list.append(QString::number(rect.width()));
list.append(QString::number(rect.height()));
int position=0;
int panelSize=0;
if(QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit()))
{
QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
if(gsetting->keys().contains(QString("panelposition")))
position=gsetting->get("panelposition").toInt();
else
position=0;
if(gsetting->keys().contains(QString("panelsize")))
panelSize=gsetting->get("panelsize").toInt();
else
panelSize=46;
delete gsetting;
}
else
{
position=0;
panelSize=46;
}
list.append(QString::number(panelSize));
list.append(QString::number(position));
}
return list;
}
double getTransparency()
{
double transparency=0.0;

View File

@ -23,7 +23,6 @@
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QScreen>
#include <gio/gdesktopappinfo.h>
#include "src/Interface/ukuimenuinterface.h"
@ -31,8 +30,12 @@
#define DBUS_PATH "/panel/position"
#define DBUS_INTERFACE "org.ukui.panel"
extern bool isHuaWeiPC;
extern bool isPANGU;
enum PanelPositon{
BOTTOM = 0,
TOP = 1,
LEFT = 2,
RIGHT = 3
};
const QPixmap loadSvg(const QString &fileName, const int size);
@ -45,8 +48,6 @@ QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source);
//调试日志
void debugLog(QString strMsg);
QVariantList getScreenGeometry();
QRect getScreenAvailableGeometry();
double getTransparency();
QString getEnvOverriddenDesktopFile(int pid);
//数据库操作

View File

@ -0,0 +1,290 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="bo_CN" sourcelanguage="en">
<context>
<name>FunctionClassifyButton</name>
<message>
<source>Mobile</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Internet</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Social</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Video</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Development</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Image</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Game</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Office</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Education</source>
<translation type="vanished"></translation>
</message>
<message>
<source>System</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Others</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>MainViewWidget</name>
<message>
<location filename="../src/MainViewWidget/mainviewwidget.cpp" line="242"/>
<source>Search</source>
<translation></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="29"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="49"/>
<source>Office</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="30"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="50"/>
<source>Development</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="31"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="51"/>
<source>Image</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="32"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="52"/>
<source>Video</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="33"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="53"/>
<source>Internet</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="34"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="54"/>
<source>Game</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="35"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="55"/>
<source>Education</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="36"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="56"/>
<source>Social</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="37"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="57"/>
<source>System</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="38"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="58"/>
<source>Safe</source>
<translation></translation>
</message>
<message>
<location filename="../src/FunctionWidget/functionbuttonwidget.cpp" line="39"/>
<location filename="../src/Interface/ukuimenuinterface.cpp" line="59"/>
<source>Others</source>
<translation></translation>
</message>
</context>
<context>
<name>RightClickMenu</name>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="217"/>
<source>Pin to all</source>
<translation> </translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="220"/>
<source>Unpin from all</source>
<translation> </translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="224"/>
<source>Pin to taskbar</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="227"/>
<source>Unpin from taskbar</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="230"/>
<source>Add to desktop shortcuts</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="243"/>
<source>Uninstall</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="258"/>
<source>Sleep</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="260"/>
<source>Log Out</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="262"/>
<source>Restart</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="264"/>
<source>Power Off</source>
<translation></translation>
</message>
<message>
<location filename="../src/RightClickMenu/rightclickmenu.cpp" line="292"/>
<source>Personalize this list</source>
<translation></translation>
</message>
</context>
<context>
<name>SideBarWidget</name>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="190"/>
<source>All</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="192"/>
<source>Letter</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="194"/>
<source>Function</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="211"/>
<source>Trash</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="213"/>
<source>Computer</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="629"/>
<source>Max</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="700"/>
<source>Min</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="209"/>
<source>Personal</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="215"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../src/SideBarWidget/sidebarwidget.cpp" line="217"/>
<source>Power</source>
<translation></translation>
</message>
</context>
<context>
<name>SplitBarFrame</name>
<message>
<source>Mobile</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Internet</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Social</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Video</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Development</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Image</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Game</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Office</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Education</source>
<translation type="vanished"></translation>
</message>
<message>
<source>System</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Safe</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Others</source>
<translation type="vanished"></translation>
</message>
</context>
</TS>

View File

@ -65,7 +65,6 @@ SOURCES += \
src/SideBarWidget/sidebarwidget.cpp \
src/Style/style.cpp \
src/UtilityFunction/classifybtnscrollarea.cpp \
src/UtilityFunction/convertdesktoptowinid.cpp \
src/UtilityFunction/fullitemdelegate.cpp \
src/UtilityFunction/fulllistview.cpp \
src/UtilityFunction/functionclassifybutton.cpp \
@ -104,7 +103,6 @@ HEADERS += \
src/SideBarWidget/sidebarwidget.h \
src/Style/style.h \
src/UtilityFunction/classifybtnscrollarea.h \
src/UtilityFunction/convertdesktoptowinid.h \
src/UtilityFunction/fullitemdelegate.h \
src/UtilityFunction/fulllistview.h \
src/UtilityFunction/functionclassifybutton.h \

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2022-05-10T09:42:06. -->
<!-- Written by QtCreator 7.0.0, 2022-04-20T17:17:54. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -8,7 +8,7 @@
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
@ -28,7 +28,7 @@
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
@ -37,6 +37,7 @@
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
@ -45,48 +46,58 @@
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{9d9f9a2c-403b-48c4-83ee-e52b4e889b83}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Debug</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ztz/ukui-menu3.0-0720/build-ukui-menu-unknown-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/ztz/ukui-menu3.0-0720/build-ukui-menu-unknown-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
@ -95,46 +106,37 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ztz/ukui-menu3.0-0720/build-ukui-menu-unknown-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/ztz/ukui-menu3.0-0720/build-ukui-menu-unknown-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
@ -143,46 +145,38 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Profile</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/ztz/ukui-menu3.0-0720/build-ukui-menu-unknown-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/ztz/ukui-menu3.0-0720/build-ukui-menu-unknown-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
@ -191,117 +185,58 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/ztz/ukui-menu9X0/ukui-menu/ukui-menu.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/ztz/ukui-menu9X0/ukui-menu/ukui-menu.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/ztz/ukui-menu3.0-0720/ukui-menu/ukui-menu.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/ztz/ukui-menu3.0-0720/ukui-menu/ukui-menu.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>