Import Upstream version 3.0.1.0720.1update1
This commit is contained in:
parent
d56635f2e8
commit
3c242b8f5a
|
@ -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 |
22
main.cpp
22
main.cpp
|
@ -36,36 +36,42 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
initUkuiLog4qt("ukui-menu");
|
initUkuiLog4qt("ukui-menu");
|
||||||
qRegisterMetaType<QVector<QStringList>>("QVector<QStringList>");
|
qRegisterMetaType<QVector<QStringList>>("QVector<QStringList>");
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
#endif
|
#endif
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QtSingleApplication app("ukui-menu", argc, argv);
|
QtSingleApplication app("ukui-menu", argc, argv);
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
if (app.isRunning()) {
|
|
||||||
|
if(app.isRunning())
|
||||||
|
{
|
||||||
app.sendMessage("raise_window_noop");
|
app.sendMessage("raise_window_noop");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto Style=new ProxyStyle;
|
// auto Style=new ProxyStyle;
|
||||||
// app.setStyle(Style);
|
// 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);
|
app.installTranslator(&translator);
|
||||||
} else {
|
else
|
||||||
qDebug() << "Load translations file" << QLocale() << "failed!";
|
qDebug() << "Load translations file" << QLocale() << "failed!";
|
||||||
}
|
|
||||||
|
|
||||||
Zeeker::FileUtils::loadHanziTable(":/src/SearchResultWidget/pinyinWithoutTone.txt");
|
Zeeker::FileUtils::loadHanziTable(":/src/SearchResultWidget/pinyinWithoutTone.txt");
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
app.setActivationWindow(&w);
|
app.setActivationWindow(&w);
|
||||||
|
|
||||||
// w.setProperty("useSystemStyleBlur", true);
|
// w.setProperty("useSystemStyleBlur", true);
|
||||||
|
|
||||||
//测试
|
//测试
|
||||||
|
|
||||||
// if(Style::panelPosition==0)
|
// if(Style::panelPosition==0)
|
||||||
// w.setGeometry(QRect(Style::primaryScreenX+4,Style::primaryScreenY+Style::primaryScreenHeight-Style::panelSize-Style::minh-3,
|
// w.setGeometry(QRect(Style::primaryScreenX+4,Style::primaryScreenY+Style::primaryScreenHeight-Style::panelSize-Style::minh-3,
|
||||||
// Style::minw,Style::minh));
|
// Style::minw,Style::minh));
|
||||||
|
@ -76,11 +82,13 @@ int main(int argc, char *argv[])
|
||||||
// else
|
// else
|
||||||
// w.setGeometry(QRect(Style::primaryScreenX+Style::primaryScreenWidth-Style::panelSize-Style::minw-4,Style::primaryScreenY+4,
|
// w.setGeometry(QRect(Style::primaryScreenX+Style::primaryScreenWidth-Style::panelSize-Style::minw-4,Style::primaryScreenY+4,
|
||||||
// Style::minw,Style::minh));
|
// Style::minw,Style::minh));
|
||||||
|
|
||||||
w.show();
|
w.show();
|
||||||
w.raise();
|
w.raise();
|
||||||
w.update();
|
w.update();
|
||||||
w.activateWindow();
|
w.activateWindow();
|
||||||
w.hide();
|
w.hide();
|
||||||
//测试
|
//测试
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,23 +27,23 @@ CommonUseWidget::CommonUseWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
initUi();
|
initUi();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonUseWidget::~CommonUseWidget()
|
CommonUseWidget::~CommonUseWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUseWidget::initUi()
|
void CommonUseWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
|
|
||||||
initAppListWidget();
|
initAppListWidget();
|
||||||
fillAppList();
|
fillAppList();
|
||||||
}
|
}
|
||||||
|
@ -53,14 +53,12 @@ void CommonUseWidget::initUi()
|
||||||
*/
|
*/
|
||||||
void CommonUseWidget::initAppListWidget()
|
void CommonUseWidget::initAppListWidget()
|
||||||
{
|
{
|
||||||
m_listView = new ListView(this, this->width(), this->height() - 6, 0);
|
m_listView=new ListView(this,this->width()-6,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->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
|
||||||
m_listView->show();
|
m_listView->show();
|
||||||
connect(m_listView, &ListView::sendItemClickedSignal, this, &CommonUseWidget::execApplication);
|
connect(m_listView,&ListView::sendItemClickedSignal,this,&CommonUseWidget::execApplication);
|
||||||
connect(m_listView, &ListView::sendUpdateAppListSignal, this, &CommonUseWidget::updateListViewSlot);
|
connect(m_listView,&ListView::sendUpdateAppListSignal,this,&CommonUseWidget::updateListViewSlot);
|
||||||
connect(m_listView, &ListView::sendHideMainWindowSignal, this, &CommonUseWidget::sendHideMainWindowSignal);
|
connect(m_listView,&ListView::sendHideMainWindowSignal,this,&CommonUseWidget::sendHideMainWindowSignal);
|
||||||
connect(m_listView, &ListView::sendMainWinActiveSignal, this, &CommonUseWidget::sendMainWinActiveSignal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,26 +67,23 @@ void CommonUseWidget::initAppListWidget()
|
||||||
void CommonUseWidget::fillAppList()
|
void CommonUseWidget::fillAppList()
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
Q_FOREACH(QString desktopfp,UkuiMenuInterface::allAppVector)
|
||||||
Q_FOREACH (QString desktopfp, UkuiMenuInterface::allAppVector) {
|
m_data.append(QStringList()<<desktopfp<<"1");
|
||||||
m_data.append(QStringList() << desktopfp << "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_listView->addData(m_data);
|
m_listView->addData(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUseWidget::selectFirstItem()
|
void CommonUseWidget::selectFirstItem()
|
||||||
{
|
{
|
||||||
this->focusNextChild();
|
this->focusNextChild();
|
||||||
m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
|
m_listView->setCurrentIndex(m_listView->model()->index(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUseWidget::selectFirstItemTab()
|
void CommonUseWidget::selectFirstItemTab()
|
||||||
{
|
{
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
|
if(m_listView->currentIndex().row() == -1)
|
||||||
if (m_listView->currentIndex().row() == -1) {
|
{
|
||||||
m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
|
m_listView->setCurrentIndex(m_listView->model()->index(0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -97,7 +92,7 @@ void CommonUseWidget::selectFirstItemTab()
|
||||||
void CommonUseWidget::execApplication(QStringList arg)
|
void CommonUseWidget::execApplication(QStringList arg)
|
||||||
{
|
{
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
QString desktopfp = arg.at(0);
|
QString desktopfp=arg.at(0);
|
||||||
execApp(desktopfp);
|
execApp(desktopfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,13 +108,10 @@ void CommonUseWidget::updateListViewSlot()
|
||||||
void CommonUseWidget::updateListView()
|
void CommonUseWidget::updateListView()
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
Q_FOREACH(QString desktopfp,m_ukuiMenuInterface->getAllClassification())
|
||||||
Q_FOREACH (QString desktopfp, m_ukuiMenuInterface->getAllClassification()) {
|
m_data.append(QStringList()<<desktopfp<<"1");
|
||||||
m_data.append(QStringList() << desktopfp << "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_listView->updateData(m_data);
|
m_listView->updateData(m_data);
|
||||||
// m_listView->setFocus();
|
// m_listView->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUseWidget::widgetMakeZero()
|
void CommonUseWidget::widgetMakeZero()
|
||||||
|
@ -129,17 +121,16 @@ void CommonUseWidget::widgetMakeZero()
|
||||||
|
|
||||||
void CommonUseWidget::moveScrollBar(int type)
|
void CommonUseWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
if (type == 0) {
|
if(type==0)
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() - 100);
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-100);
|
||||||
} else {
|
else
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() + 100);
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+100);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonUseWidget::repaintWidget()
|
void CommonUseWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_listView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_listView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_listView->show();
|
m_listView->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ Q_SIGNALS:
|
||||||
* @brief Send a hidden main window signal to the MainViewWidget
|
* @brief Send a hidden main window signal to the MainViewWidget
|
||||||
*/
|
*/
|
||||||
void sendHideMainWindowSignal();
|
void sendHideMainWindowSignal();
|
||||||
void sendMainWinActiveSignal(bool flag);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMMONUSEWIDGET_H
|
#endif // COMMONUSEWIDGET_H
|
||||||
|
|
|
@ -30,87 +30,91 @@ FullCommonUseWidget::FullCommonUseWidget(QWidget *parent) :
|
||||||
|
|
||||||
FullCommonUseWidget::~FullCommonUseWidget()
|
FullCommonUseWidget::~FullCommonUseWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullCommonUseWidget::initUi()
|
void FullCommonUseWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setAttribute(Qt::WA_StyledBackground, true);
|
this->setAttribute(Qt::WA_StyledBackground,true);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
this->setFocusPolicy(Qt::NoFocus);
|
this->setFocusPolicy(Qt::NoFocus);
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
QHBoxLayout* mainLayout=new QHBoxLayout;
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0,0,0,0);
|
||||||
this->setLayout(mainLayout);
|
this->setLayout(mainLayout);
|
||||||
m_spaceItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed);
|
m_spaceItem=new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||||
mainLayout->addItem(m_spaceItem);
|
mainLayout->addItem(m_spaceItem);
|
||||||
m_scrollArea = new ScrollArea;
|
m_scrollArea=new ScrollArea;
|
||||||
m_scrollAreaWid = new ScrollAreaWid;
|
m_scrollAreaWid=new ScrollAreaWid;
|
||||||
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_scrollArea->setFixedSize(Style::AppListWidWidth, this->height());
|
m_scrollArea->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||||
m_scrollArea->setWidgetResizable(true);
|
m_scrollArea->setWidgetResizable(true);
|
||||||
m_scrollAreaWidLayout = new QVBoxLayout;
|
m_scrollAreaWidLayout=new QVBoxLayout;
|
||||||
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
m_scrollAreaWidLayout->setContentsMargins(0,0,0,0);
|
||||||
m_scrollAreaWidLayout->setSpacing(10);
|
m_scrollAreaWidLayout->setSpacing(10);
|
||||||
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
||||||
mainLayout->addWidget(m_scrollArea);
|
mainLayout->addWidget(m_scrollArea);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
|
|
||||||
initAppListWidget();
|
initAppListWidget();
|
||||||
fillAppList();
|
fillAppList();
|
||||||
|
|
||||||
|
flag = true;
|
||||||
|
//翻页灵敏度时间调节
|
||||||
|
time = new QTimer(this);
|
||||||
|
connect(time,&QTimer::timeout,[=](){
|
||||||
|
if(flag == false)
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
time->stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullCommonUseWidget::initAppListWidget()
|
void FullCommonUseWidget::initAppListWidget()
|
||||||
{
|
{
|
||||||
m_listView = new FullListView(this, 0);
|
m_listView=new FullListView(this,0);
|
||||||
// m_listView->setFixedSize(this->width()-Style::LeftWidWidth+3,this->height());
|
// m_listView->setFixedSize(this->width()-Style::LeftWidWidth+3,this->height());
|
||||||
// QHBoxLayout *mainLayout=qobject_cast<QHBoxLayout*>(this->layout());
|
// QHBoxLayout *mainLayout=qobject_cast<QHBoxLayout*>(this->layout());
|
||||||
// mainLayout->insertWidget(1,m_listView);
|
// mainLayout->insertWidget(1,m_listView);
|
||||||
m_scrollAreaWidLayout->addWidget(m_listView);
|
m_scrollAreaWidLayout->addWidget(m_listView);
|
||||||
connect(m_scrollArea, &ScrollArea::requestUpdate, m_listView->viewport(), [ = ]() {
|
connect(m_listView,&FullListView::sendItemClickedSignal,this,&FullCommonUseWidget::execApplication);
|
||||||
QEventLoop loop;
|
connect(m_listView,&FullListView::sendUpdateAppListSignal,this,&FullCommonUseWidget::updateListViewSlot);
|
||||||
QTimer::singleShot(1, &loop, SLOT(quit()));
|
connect(m_listView,&FullListView::sendHideMainWindowSignal,this,&FullCommonUseWidget::sendHideMainWindowSignal);
|
||||||
loop.exec();
|
connect(m_listView,&FullListView::sendSetslidebar,this,&FullCommonUseWidget::onSetSlider);
|
||||||
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);
|
|
||||||
connect(m_listView, &FullListView::sendSetslidebar, this, &FullCommonUseWidget::onSetSlider);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullCommonUseWidget::resizeScrollAreaControls()
|
void FullCommonUseWidget::resizeScrollAreaControls()
|
||||||
{
|
{
|
||||||
QLayoutItem *widItem = m_scrollAreaWidLayout->itemAt(0);
|
QLayoutItem* widItem=m_scrollAreaWidLayout->itemAt(0);
|
||||||
QWidget *wid = widItem->widget();
|
QWidget* wid=widItem->widget();
|
||||||
FullListView *listview = qobject_cast<FullListView *>(wid);
|
FullListView* listview=qobject_cast<FullListView*>(wid);
|
||||||
listview->adjustSize();
|
listview->adjustSize();
|
||||||
int dividend = (m_scrollArea->width() - Style::SliderSize) / Style::AppListGridSizeWidth;
|
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
|
||||||
int rowcount = 0;
|
int rowcount=0;
|
||||||
|
if(listview->model()->rowCount()%dividend>0)
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend;
|
||||||
|
|
||||||
if (listview->model()->rowCount() % dividend > 0) {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend + 1;
|
|
||||||
} else {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listview->setFixedSize(m_scrollArea->width() - Style::SliderSize + 1, listview->gridSize().height()*rowcount);
|
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
|
||||||
m_scrollArea->widget()->adjustSize();
|
m_scrollArea->widget()->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullCommonUseWidget::fillAppList()
|
void FullCommonUseWidget::fillAppList()
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
Q_FOREACH(QString desktopfp,UkuiMenuInterface::allAppVector)
|
||||||
Q_FOREACH (QString desktopfp, UkuiMenuInterface::allAppVector) {
|
|
||||||
m_data.append(desktopfp);
|
m_data.append(desktopfp);
|
||||||
}
|
|
||||||
|
|
||||||
m_listView->addData(m_data);
|
m_listView->addData(m_data);
|
||||||
resizeScrollAreaControls();
|
resizeScrollAreaControls();
|
||||||
}
|
}
|
||||||
|
@ -126,28 +130,36 @@ void FullCommonUseWidget::execApplication(QString desktopfp)
|
||||||
|
|
||||||
void FullCommonUseWidget::selectFirstItem()
|
void FullCommonUseWidget::selectFirstItem()
|
||||||
{
|
{
|
||||||
// this->focusNextChild();
|
// this->focusNextChild();
|
||||||
qDebug() << "void FullCommonUseWidget::selectFirstItem()";
|
qDebug() << "void FullCommonUseWidget::selectFirstItem()";
|
||||||
m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
|
m_listView->setCurrentIndex(m_listView->model()->index(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullCommonUseWidget::selectFirstItemTab()
|
void FullCommonUseWidget::selectFirstItemTab()
|
||||||
{
|
{
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
|
if(m_listView->currentIndex().row() == -1)
|
||||||
if (m_listView->currentIndex().row() == -1) {
|
{
|
||||||
m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
|
m_listView->setCurrentIndex(m_listView->model()->index(0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullCommonUseWidget::onSetSlider(int value)
|
void FullCommonUseWidget::onSetSlider(int value)
|
||||||
{
|
{
|
||||||
if (value == 0) {
|
// if(flag)
|
||||||
m_scrollArea->verticalScrollBar()->setValue(0);
|
// {
|
||||||
} else {
|
// flag = false;
|
||||||
int curvalue = m_scrollArea->verticalScrollBar()->value();
|
// time->start(100);
|
||||||
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
|
if(value == 0)
|
||||||
}
|
{
|
||||||
|
m_scrollArea->verticalScrollBar()->setValue(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int curvalue = m_scrollArea->verticalScrollBar()->value();
|
||||||
|
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
|
||||||
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 更新应用列表
|
* 更新应用列表
|
||||||
|
@ -160,11 +172,8 @@ void FullCommonUseWidget::updateListViewSlot()
|
||||||
void FullCommonUseWidget::updateListView()
|
void FullCommonUseWidget::updateListView()
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
Q_FOREACH(QString desktopfp,m_ukuiMenuInterface->getAllClassification())
|
||||||
Q_FOREACH (QString desktopfp, m_ukuiMenuInterface->getAllClassification()) {
|
|
||||||
m_data.append(desktopfp);
|
m_data.append(desktopfp);
|
||||||
}
|
|
||||||
|
|
||||||
m_listView->updateData(m_data);
|
m_listView->updateData(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +181,8 @@ void FullCommonUseWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
m_scrollArea->setFixedSize(Style::AppListWidWidth, this->height());
|
m_scrollArea->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
|
m_scrollAreaWid->setFixedWidth(m_scrollArea->width() - Style::SliderSize);
|
||||||
m_scrollAreaWidLayout->removeWidget(m_listView);
|
m_scrollAreaWidLayout->removeWidget(m_listView);
|
||||||
m_listView->setParent(nullptr);
|
m_listView->setParent(nullptr);
|
||||||
delete m_listView;
|
delete m_listView;
|
||||||
|
@ -187,11 +197,9 @@ void FullCommonUseWidget::widgetMakeZero()
|
||||||
|
|
||||||
void FullCommonUseWidget::moveScrollBar(int type)
|
void FullCommonUseWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
int height = Style::primaryScreenHeight;
|
int height=Style::primaryScreenHeight;
|
||||||
|
if(type==0)
|
||||||
if (type == 0) {
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-height*100/1080);
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() - height * 100 / 1080);
|
else
|
||||||
} else {
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+height*100/1080);
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() + height * 100 / 1080);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,8 @@ private:
|
||||||
ScrollArea* m_scrollArea=nullptr;
|
ScrollArea* m_scrollArea=nullptr;
|
||||||
ScrollAreaWid* m_scrollAreaWid=nullptr;
|
ScrollAreaWid* m_scrollAreaWid=nullptr;
|
||||||
QVBoxLayout* m_scrollAreaWidLayout=nullptr;
|
QVBoxLayout* m_scrollAreaWidLayout=nullptr;
|
||||||
|
bool flag;
|
||||||
|
QTimer *time = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef DBUS_H
|
#ifndef DBUS_H
|
||||||
#define DBUS_H
|
#define DBUS_H
|
||||||
|
|
||||||
|
|
|
@ -32,37 +32,39 @@ FullFunctionWidget::FullFunctionWidget(QWidget *parent) :
|
||||||
|
|
||||||
FullFunctionWidget::~FullFunctionWidget()
|
FullFunctionWidget::~FullFunctionWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::initUi()
|
void FullFunctionWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_applistWid = new QWidget(this);
|
m_applistWid=new QWidget(this);
|
||||||
m_iconListWid = new QWidget(this);
|
m_iconListWid=new QWidget(this);
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
m_applistWid->setFixedSize(Style::AppListWidWidth, this->height());
|
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
m_iconListWid->setFixedSize(Style::LeftWidWidth, this->height());
|
m_iconListWid->setFixedSize(Style::LeftWidWidth,this->height());
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
QHBoxLayout* mainLayout=new QHBoxLayout;
|
||||||
|
mainLayout->setContentsMargins(0,0,0,0);
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
mainLayout->addWidget(m_iconListWid);
|
mainLayout->addWidget(m_iconListWid);
|
||||||
mainLayout->addWidget(m_applistWid);
|
mainLayout->addWidget(m_applistWid);
|
||||||
this->setLayout(mainLayout);
|
this->setLayout(mainLayout);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
|
|
||||||
initAppListWidget();
|
initAppListWidget();
|
||||||
initIconListWidget();
|
initIconListWidget();
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
//翻页灵敏度时间调节
|
//翻页灵敏度时间调节
|
||||||
time = new QTimer(this);
|
time = new QTimer(this);
|
||||||
connect(time, &QTimer::timeout, [ = ]() {
|
connect(time,&QTimer::timeout,[=](){
|
||||||
if (flag == false) {
|
if(flag == false)
|
||||||
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
time->stop();
|
time->stop();
|
||||||
}
|
}
|
||||||
|
@ -74,23 +76,24 @@ void FullFunctionWidget::initUi()
|
||||||
*/
|
*/
|
||||||
void FullFunctionWidget::initAppListWidget()
|
void FullFunctionWidget::initAppListWidget()
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(m_applistWid);
|
QHBoxLayout* layout=new QHBoxLayout(m_applistWid);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0,0,0,0);
|
||||||
m_applistWid->setLayout(layout);
|
m_applistWid->setLayout(layout);
|
||||||
m_scrollArea = new ScrollArea;
|
|
||||||
m_scrollAreaWid = new ScrollAreaWid;
|
m_scrollArea=new ScrollArea;
|
||||||
|
m_scrollAreaWid=new ScrollAreaWid;
|
||||||
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
|
m_scrollArea->setFixedSize(m_applistWid->width(),m_applistWid->height());
|
||||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||||
m_scrollArea->setWidgetResizable(true);
|
m_scrollArea->setWidgetResizable(true);
|
||||||
m_scrollAreaWidLayout = new QVBoxLayout;
|
m_scrollAreaWidLayout=new QVBoxLayout;
|
||||||
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
m_scrollAreaWidLayout->setContentsMargins(0,0,0,0);
|
||||||
m_scrollAreaWidLayout->setSpacing(10);
|
m_scrollAreaWidLayout->setSpacing(10);
|
||||||
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
||||||
layout->addWidget(m_scrollArea);
|
layout->addWidget(m_scrollArea);
|
||||||
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &FullFunctionWidget::valueChangedSlot);
|
this,&FullFunctionWidget::valueChangedSlot);
|
||||||
m_appListBottomSpacer = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding);
|
m_appListBottomSpacer=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||||
fillAppList();
|
fillAppList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,103 +103,92 @@ void FullFunctionWidget::initAppListWidget()
|
||||||
void FullFunctionWidget::fillAppList()
|
void FullFunctionWidget::fillAppList()
|
||||||
{
|
{
|
||||||
m_classificationList.clear();
|
m_classificationList.clear();
|
||||||
QVector<QStringList> vector = UkuiMenuInterface::functionalVector;
|
QVector<QStringList> vector=UkuiMenuInterface::functionalVector;
|
||||||
QStringList androidlist = vector.at(0);
|
QStringList androidlist=vector.at(0);
|
||||||
|
if(!androidlist.isEmpty())
|
||||||
if (!androidlist.isEmpty()) {
|
{
|
||||||
insertClassificationBtn("Mobile");
|
insertClassificationBtn("Mobile");
|
||||||
insertAppList(androidlist);
|
insertAppList(androidlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList netlist = vector.at(1);
|
QStringList netlist=vector.at(1);
|
||||||
|
if(!netlist.isEmpty())
|
||||||
if (!netlist.isEmpty()) {
|
{
|
||||||
insertClassificationBtn("Internet");
|
insertClassificationBtn("Internet");
|
||||||
insertAppList(netlist);
|
insertAppList(netlist);
|
||||||
}
|
}
|
||||||
|
QStringList sociallist=vector.at(2);
|
||||||
QStringList sociallist = vector.at(2);
|
if(!sociallist.isEmpty())
|
||||||
|
{
|
||||||
if (!sociallist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Social");
|
insertClassificationBtn("Social");
|
||||||
insertAppList(sociallist);
|
insertAppList(sociallist);
|
||||||
}
|
}
|
||||||
|
QStringList avlist=vector.at(3);
|
||||||
QStringList avlist = vector.at(3);
|
if(!avlist.isEmpty())
|
||||||
|
{
|
||||||
if (!avlist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Video");
|
insertClassificationBtn("Video");
|
||||||
insertAppList(avlist);
|
insertAppList(avlist);
|
||||||
}
|
}
|
||||||
|
QStringList developlist=vector.at(4);
|
||||||
QStringList developlist = vector.at(4);
|
if(!developlist.isEmpty())
|
||||||
|
{
|
||||||
if (!developlist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Development");
|
insertClassificationBtn("Development");
|
||||||
insertAppList(developlist);
|
insertAppList(developlist);
|
||||||
}
|
}
|
||||||
|
QStringList graphicslist=vector.at(5);
|
||||||
QStringList graphicslist = vector.at(5);
|
if(!graphicslist.isEmpty())
|
||||||
|
{
|
||||||
if (!graphicslist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Image");
|
insertClassificationBtn("Image");
|
||||||
insertAppList(graphicslist);
|
insertAppList(graphicslist);
|
||||||
}
|
}
|
||||||
|
QStringList gamelist=vector.at(6);
|
||||||
QStringList gamelist = vector.at(6);
|
if(!gamelist.isEmpty())
|
||||||
|
{
|
||||||
if (!gamelist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Game");
|
insertClassificationBtn("Game");
|
||||||
insertAppList(gamelist);
|
insertAppList(gamelist);
|
||||||
}
|
}
|
||||||
|
QStringList officelist=vector.at(7);
|
||||||
QStringList officelist = vector.at(7);
|
if(!officelist.isEmpty())
|
||||||
|
{
|
||||||
if (!officelist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Office");
|
insertClassificationBtn("Office");
|
||||||
insertAppList(officelist);
|
insertAppList(officelist);
|
||||||
}
|
}
|
||||||
|
QStringList educationlist=vector.at(8);
|
||||||
QStringList educationlist = vector.at(8);
|
if(!educationlist.isEmpty())
|
||||||
|
{
|
||||||
if (!educationlist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Education");
|
insertClassificationBtn("Education");
|
||||||
insertAppList(educationlist);
|
insertAppList(educationlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList systemadminlist = vector.at(9);
|
QStringList systemadminlist=vector.at(9);
|
||||||
|
if(!systemadminlist.isEmpty())
|
||||||
if (!systemadminlist.isEmpty()) {
|
{
|
||||||
insertClassificationBtn("System");
|
insertClassificationBtn("System");
|
||||||
insertAppList(systemadminlist);
|
insertAppList(systemadminlist);
|
||||||
}
|
}
|
||||||
|
QStringList otherlist=vector.at(10);
|
||||||
QStringList otherlist = vector.at(10);
|
if(!otherlist.isEmpty())
|
||||||
|
{
|
||||||
if (!otherlist.isEmpty()) {
|
|
||||||
insertClassificationBtn("Others");
|
insertClassificationBtn("Others");
|
||||||
insertAppList(otherlist);
|
insertAppList(otherlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scrollAreaWidLayout->addItem(m_appListBottomSpacer);
|
m_scrollAreaWidLayout->addItem(m_appListBottomSpacer);
|
||||||
resizeScrollAreaControls();
|
resizeScrollAreaControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::insertClassificationBtn(QString category)
|
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_scrollAreaWidLayout->addWidget(classificationbtn);
|
||||||
m_classificationList.append(category);
|
m_classificationList.append(category);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::insertAppList(QStringList desktopfplist)
|
void FullFunctionWidget::insertAppList(QStringList desktopfplist)
|
||||||
{
|
{
|
||||||
FullListView *listview = new FullListView(this, 2);
|
FullListView* listview=new FullListView(this,2);
|
||||||
//修复异常黑框问题
|
//修复异常黑框问题
|
||||||
connect(m_scrollArea, &ScrollArea::requestUpdate, listview->viewport(), [ = ]() {
|
connect(m_scrollArea, &ScrollArea::requestUpdate, listview->viewport(), [=](){
|
||||||
QEventLoop loop;
|
|
||||||
QTimer::singleShot(1, &loop, SLOT(quit()));
|
|
||||||
loop.exec();
|
|
||||||
listview->repaint(listview->rect());
|
listview->repaint(listview->rect());
|
||||||
});
|
});
|
||||||
connect(listview, &FullListView::sendSetslidebar, this, &FullFunctionWidget::onSetSlider);
|
connect(listview, &FullListView::sendSetslidebar, this, &FullFunctionWidget::onSetSlider);
|
||||||
|
@ -204,14 +196,11 @@ void FullFunctionWidget::insertAppList(QStringList desktopfplist)
|
||||||
listview->installEventFilter(this);
|
listview->installEventFilter(this);
|
||||||
m_scrollAreaWidLayout->addWidget(listview);
|
m_scrollAreaWidLayout->addWidget(listview);
|
||||||
m_data.clear();
|
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));
|
m_data.append(desktopfplist.at(i));
|
||||||
}
|
|
||||||
|
|
||||||
listview->addData(m_data);
|
listview->addData(m_data);
|
||||||
connect(listview, &FullListView::sendItemClickedSignal, this, &FullFunctionWidget::execApplication);
|
connect(listview,&FullListView::sendItemClickedSignal,this,&FullFunctionWidget::execApplication);
|
||||||
connect(listview, &FullListView::sendHideMainWindowSignal, this, &FullFunctionWidget::sendHideMainWindowSignal);
|
connect(listview,&FullListView::sendHideMainWindowSignal,this,&FullFunctionWidget::sendHideMainWindowSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,34 +220,29 @@ void FullFunctionWidget::updateAppListView()
|
||||||
//刷新应用列表界面
|
//刷新应用列表界面
|
||||||
QLayoutItem *child;
|
QLayoutItem *child;
|
||||||
m_scrollAreaWidLayout->removeItem(m_appListBottomSpacer);
|
m_scrollAreaWidLayout->removeItem(m_appListBottomSpacer);
|
||||||
|
while ((child = m_scrollAreaWidLayout->takeAt(0)) != 0) {
|
||||||
while ((child = m_scrollAreaWidLayout->takeAt(0)) != 0) {
|
QWidget* wid=child->widget();
|
||||||
QWidget *wid = child->widget();
|
m_scrollAreaWidLayout->removeWidget(wid);
|
||||||
m_scrollAreaWidLayout->removeWidget(wid);
|
wid->setParent(nullptr);
|
||||||
wid->setParent(nullptr);
|
delete wid;
|
||||||
delete wid;
|
delete child;
|
||||||
delete child;
|
}
|
||||||
}
|
fillAppList();
|
||||||
|
|
||||||
fillAppList();
|
|
||||||
|
|
||||||
//刷新图标列表界面
|
//刷新图标列表界面
|
||||||
Q_FOREACH (QAbstractButton *button, m_buttonList) {
|
Q_FOREACH (QAbstractButton* button, m_buttonList){
|
||||||
m_btnGroup->removeButton(button);
|
m_btnGroup->removeButton(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_buttonList.clear();
|
m_buttonList.clear();
|
||||||
m_iconListScrollAreaWidLayout->removeItem(m_topSpacerItem);
|
m_iconListScrollAreaWidLayout->removeItem(m_topSpacerItem);
|
||||||
m_iconListScrollAreaWidLayout->removeItem(m_bottomSpacerItem);
|
m_iconListScrollAreaWidLayout->removeItem(m_bottomSpacerItem);
|
||||||
|
|
||||||
while ((child = m_iconListScrollAreaWidLayout->takeAt(0)) != 0) {
|
while ((child = m_iconListScrollAreaWidLayout->takeAt(0)) != 0) {
|
||||||
QWidget *wid = child->widget();
|
QWidget* wid=child->widget();
|
||||||
m_iconListScrollAreaWidLayout->removeWidget(wid);
|
m_iconListScrollAreaWidLayout->removeWidget(wid);
|
||||||
wid->setParent(nullptr);
|
wid->setParent(nullptr);
|
||||||
delete wid;
|
delete wid;
|
||||||
delete child;
|
delete child;
|
||||||
}
|
}
|
||||||
|
|
||||||
initIconListScrollArea();
|
initIconListScrollArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,27 +251,29 @@ void FullFunctionWidget::updateAppListView()
|
||||||
*/
|
*/
|
||||||
void FullFunctionWidget::resizeScrollAreaControls()
|
void FullFunctionWidget::resizeScrollAreaControls()
|
||||||
{
|
{
|
||||||
int row = 0;
|
int row=0;
|
||||||
|
while(row<m_scrollAreaWidLayout->count()/2)
|
||||||
while (row < m_scrollAreaWidLayout->count() / 2) {
|
{
|
||||||
//应用界面
|
//应用界面
|
||||||
QLayoutItem *widItem = m_scrollAreaWidLayout->itemAt(row * 2 + 1);
|
QLayoutItem* widItem=m_scrollAreaWidLayout->itemAt(row*2+1);
|
||||||
QWidget *wid = widItem->widget();
|
QWidget* wid=widItem->widget();
|
||||||
FullListView *listview = qobject_cast<FullListView *>(wid);
|
FullListView* listview=qobject_cast<FullListView*>(wid);
|
||||||
listview->adjustSize();
|
listview->adjustSize();
|
||||||
int dividend = (m_scrollArea->width() - Style::SliderSize) / Style::AppListGridSizeWidth;
|
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
|
||||||
int rowcount = 0;
|
int rowcount=0;
|
||||||
|
if(listview->model()->rowCount()%dividend>0)
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend;
|
||||||
|
|
||||||
if (listview->model()->rowCount() % dividend > 0) {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend + 1;
|
|
||||||
} else {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listview->setFixedSize(m_scrollArea->width() - Style::SliderSize + 1, listview->gridSize().height()*rowcount);
|
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scrollArea->widget()->adjustSize();
|
m_scrollArea->widget()->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,25 +282,29 @@ void FullFunctionWidget::resizeScrollAreaControls()
|
||||||
*/
|
*/
|
||||||
void FullFunctionWidget::initIconListWidget()
|
void FullFunctionWidget::initIconListWidget()
|
||||||
{
|
{
|
||||||
m_iconListScrollArea = new ClassifyBtnScrollArea(m_iconListWid);
|
m_iconListScrollArea=new ClassifyBtnScrollArea(m_iconListWid);
|
||||||
// m_iconListScrollArea->resize(Style::LeftBtnWidth,
|
// m_iconListScrollArea->resize(Style::LeftBtnWidth,
|
||||||
// m_iconListWid->height());
|
// m_iconListWid->height());
|
||||||
m_iconListScrollAreaWid = new ClassifyBtnScrollAreaWid;
|
m_iconListScrollAreaWid=new ClassifyBtnScrollAreaWid;
|
||||||
m_iconListScrollAreaWid->setFixedSize(Style::LeftBtnWidth,
|
m_iconListScrollAreaWid->setFixedSize(Style::LeftBtnWidth,
|
||||||
m_iconListWid->height());
|
m_iconListWid->height());
|
||||||
m_iconListScrollAreaWidLayout = new QVBoxLayout;
|
m_iconListScrollAreaWidLayout=new QVBoxLayout;
|
||||||
m_iconListScrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
m_iconListScrollAreaWidLayout->setContentsMargins(0,0,0,0);
|
||||||
m_iconListScrollAreaWidLayout->setSpacing(Style::LeftSpaceBetweenItem);
|
m_iconListScrollAreaWidLayout->setSpacing(Style::LeftSpaceBetweenItem);
|
||||||
m_iconListScrollAreaWid->setLayout(m_iconListScrollAreaWidLayout);
|
m_iconListScrollAreaWid->setLayout(m_iconListScrollAreaWidLayout);
|
||||||
m_iconListScrollArea->setWidget(m_iconListScrollAreaWid);
|
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_topSpacerItem=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||||
m_btnGroup = new QButtonGroup(m_iconListScrollAreaWid);
|
m_bottomSpacerItem=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
m_btnGroup=new QButtonGroup(m_iconListScrollAreaWid);
|
||||||
m_animation = new QPropertyAnimation(m_iconListScrollArea, "geometry");
|
m_animation = new QPropertyAnimation(m_iconListScrollArea, "geometry");
|
||||||
|
|
||||||
m_scrollAnimation = new QPropertyAnimation(m_scrollArea->verticalScrollBar(), "value");
|
m_scrollAnimation = new QPropertyAnimation(m_scrollArea->verticalScrollBar(), "value");
|
||||||
m_scrollAnimation->setEasingCurve(QEasingCurve::OutQuad);
|
m_scrollAnimation->setEasingCurve(QEasingCurve::OutQuad);
|
||||||
connect(m_scrollAnimation, &QPropertyAnimation::finished, this, &FullFunctionWidget::animationFinishSlot);
|
connect(m_scrollAnimation, &QPropertyAnimation::finished, this, &FullFunctionWidget::animationFinishSlot);
|
||||||
connect(m_scrollAnimation, &QPropertyAnimation::valueChanged, this, &FullFunctionWidget::animationValueChangedSlot);
|
connect(m_scrollAnimation, &QPropertyAnimation::valueChanged, this, &FullFunctionWidget::animationValueChangedSlot);
|
||||||
|
|
||||||
initIconListScrollArea();
|
initIconListScrollArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,51 +314,48 @@ void FullFunctionWidget::initIconListWidget()
|
||||||
void FullFunctionWidget::initIconListScrollArea()
|
void FullFunctionWidget::initIconListScrollArea()
|
||||||
{
|
{
|
||||||
m_iconListScrollAreaWidLayout->addItem(m_topSpacerItem);
|
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(
|
FunctionClassifyButton* iconbtn=new FunctionClassifyButton(
|
||||||
Style::LeftBtnWidth,
|
Style::LeftBtnWidth,
|
||||||
Style::LeftBtnHeight,
|
Style::LeftBtnHeight,
|
||||||
Style::LeftIconSize,
|
Style::LeftIconSize,
|
||||||
m_classificationList.at(i),
|
m_classificationList.at(i),
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
iconbtn->setChecked(false);
|
iconbtn->setChecked(false);
|
||||||
m_buttonList.append(iconbtn);
|
m_buttonList.append(iconbtn);
|
||||||
m_iconListScrollAreaWidLayout->addWidget(iconbtn);
|
m_iconListScrollAreaWidLayout->addWidget(iconbtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_iconListScrollAreaWidLayout->addItem(m_bottomSpacerItem);
|
m_iconListScrollAreaWidLayout->addItem(m_bottomSpacerItem);
|
||||||
int id = 0;
|
|
||||||
|
|
||||||
Q_FOREACH (QAbstractButton *btn, m_buttonList) {
|
int id=0;
|
||||||
m_btnGroup->addButton(btn, id++);
|
Q_FOREACH (QAbstractButton* btn, m_buttonList) {
|
||||||
|
m_btnGroup->addButton(btn,id++);
|
||||||
}
|
}
|
||||||
|
connect(m_btnGroup,static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),this,&FullFunctionWidget::btnGroupClickedSlot);
|
||||||
connect(m_btnGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), this, &FullFunctionWidget::btnGroupClickedSlot);
|
|
||||||
|
|
||||||
// m_iconListScrollArea->widget()->adjustSize();
|
// m_iconListScrollArea->widget()->adjustSize();
|
||||||
if (m_btnGroup->button(0) != nullptr) {
|
if(m_btnGroup->button(0)!=nullptr)
|
||||||
m_btnGroup->button(0)->click();
|
m_btnGroup->button(0)->click();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::btnGroupClickedSlot(QAbstractButton *btn)
|
void FullFunctionWidget::btnGroupClickedSlot(QAbstractButton *btn)
|
||||||
{
|
{
|
||||||
disconnect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
disconnect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &FullFunctionWidget::valueChangedSlot);
|
this,&FullFunctionWidget::valueChangedSlot);
|
||||||
|
Q_FOREACH (QAbstractButton* button, m_buttonList) {
|
||||||
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_beginPos=m_scrollArea->verticalScrollBar()->sliderPosition();
|
||||||
m_endPos = m_scrollAreaWidLayout->itemAt(m_btnGroup->id(btn) * 2)->widget()->y();
|
m_endPos=m_scrollAreaWidLayout->itemAt(m_btnGroup->id(btn)*2)->widget()->y();
|
||||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
m_scrollAnimation->stop();
|
m_scrollAnimation->stop();
|
||||||
m_scrollAnimation->setStartValue(m_beginPos);
|
m_scrollAnimation->setStartValue(m_beginPos);
|
||||||
m_scrollAnimation->setEndValue(m_endPos);
|
m_scrollAnimation->setEndValue(m_endPos);
|
||||||
m_scrollAnimation->start();
|
m_scrollAnimation->start();
|
||||||
button->setChecked(true);
|
button->setChecked(true);
|
||||||
} else {
|
}
|
||||||
|
else{
|
||||||
button->setChecked(false);
|
button->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,62 +363,58 @@ void FullFunctionWidget::btnGroupClickedSlot(QAbstractButton *btn)
|
||||||
|
|
||||||
void FullFunctionWidget::animationFinishSlot()
|
void FullFunctionWidget::animationFinishSlot()
|
||||||
{
|
{
|
||||||
if (m_scrollArea->verticalScrollBar()->value() == m_endPos ||
|
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);
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &FullFunctionWidget::valueChangedSlot);
|
this,&FullFunctionWidget::valueChangedSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::animationValueChangedSlot(const QVariant &value)
|
void FullFunctionWidget::animationValueChangedSlot(const QVariant &value)
|
||||||
{
|
{
|
||||||
Q_UNUSED(value);
|
Q_UNUSED(value);
|
||||||
|
if (sender() != m_scrollAnimation)
|
||||||
if (sender() != m_scrollAnimation) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QPropertyAnimation *ani = qobject_cast<QPropertyAnimation *>(sender());
|
QPropertyAnimation *ani = qobject_cast<QPropertyAnimation *>(sender());
|
||||||
|
|
||||||
if (m_endPos != ani->endValue()) {
|
if (m_endPos != ani->endValue())
|
||||||
ani->setEndValue(m_endPos);
|
ani->setEndValue(m_endPos);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::valueChangedSlot(int value)
|
void FullFunctionWidget::valueChangedSlot(int value)
|
||||||
{
|
{
|
||||||
int index = 0;
|
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 min=m_scrollAreaWidLayout->itemAt(2*index)->widget()->y();
|
||||||
int max = 0;
|
int max=0;
|
||||||
|
if(index==m_classificationList.count()-1)
|
||||||
if (index == m_classificationList.count() - 1) {
|
max=m_scrollAreaWid->height();
|
||||||
max = m_scrollAreaWid->height();
|
else
|
||||||
} else {
|
max=m_scrollAreaWidLayout->itemAt(2*(index+1))->widget()->y();
|
||||||
max = m_scrollAreaWidLayout->itemAt(2 * (index + 1))->widget()->y();
|
if(value>=min && value<max)
|
||||||
}
|
{
|
||||||
|
Q_FOREACH (QAbstractButton* button, m_buttonList) {
|
||||||
if (value >= min && value < max) {
|
FunctionClassifyButton* fcbutton=qobject_cast<FunctionClassifyButton*>(button);
|
||||||
Q_FOREACH (QAbstractButton *button, m_buttonList) {
|
if(index==m_buttonList.indexOf(button))
|
||||||
FunctionClassifyButton *fcbutton = qobject_cast<FunctionClassifyButton *>(button);
|
{
|
||||||
|
|
||||||
if (index == m_buttonList.indexOf(button)) {
|
|
||||||
fcbutton->setChecked(true);
|
fcbutton->setChecked(true);
|
||||||
} else {
|
}
|
||||||
|
else{
|
||||||
fcbutton->setChecked(false);
|
fcbutton->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractButton *FullFunctionWidget::getCurLetterButton(int value)
|
QAbstractButton* FullFunctionWidget::getCurLetterButton(int value)
|
||||||
{
|
{
|
||||||
return m_buttonList.at(value);
|
return m_buttonList.at(value);
|
||||||
}
|
}
|
||||||
|
@ -440,12 +423,12 @@ QAbstractButton *FullFunctionWidget::getCurLetterButton(int value)
|
||||||
void FullFunctionWidget::enterAnimation()
|
void FullFunctionWidget::enterAnimation()
|
||||||
{
|
{
|
||||||
m_animation->setDuration(200);//动画总时间
|
m_animation->setDuration(200);//动画总时间
|
||||||
m_animation->setStartValue(QRect(0, 0,
|
m_animation->setStartValue(QRect(0,0,
|
||||||
0, m_iconListWid->height()));
|
0,m_iconListWid->height()));
|
||||||
m_animation->setEndValue(QRect(Style::LeftMargin,
|
m_animation->setEndValue(QRect(Style::LeftMargin,
|
||||||
0,
|
0,
|
||||||
Style::LeftBtnWidth,
|
Style::LeftBtnWidth,
|
||||||
m_iconListWid->height()));
|
m_iconListWid->height()));
|
||||||
m_animation->setEasingCurve(QEasingCurve::InQuart);
|
m_animation->setEasingCurve(QEasingCurve::InQuart);
|
||||||
m_animation->start();
|
m_animation->start();
|
||||||
m_iconListScrollArea->show();
|
m_iconListScrollArea->show();
|
||||||
|
@ -459,15 +442,17 @@ void FullFunctionWidget::setFunctionBtnGeometry()
|
||||||
Style::LeftBtnWidth,
|
Style::LeftBtnWidth,
|
||||||
m_iconListWid->height()));
|
m_iconListWid->height()));
|
||||||
m_iconListScrollArea->show();
|
m_iconListScrollArea->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::repaintWidget()
|
void FullFunctionWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
m_applistWid->setFixedSize(Style::AppListWidWidth, this->height());
|
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
|
m_scrollArea->setFixedSize(m_applistWid->width(),m_applistWid->height());
|
||||||
m_iconListWid->setFixedSize(Style::LeftWidWidth, this->height());
|
m_scrollAreaWid->setFixedWidth(m_scrollArea->width() - Style::SliderSize);
|
||||||
|
m_iconListWid->setFixedSize(Style::LeftWidWidth,this->height());
|
||||||
m_iconListScrollAreaWid->setFixedSize(Style::LeftBtnWidth,
|
m_iconListScrollAreaWid->setFixedSize(Style::LeftBtnWidth,
|
||||||
m_iconListWid->height());
|
m_iconListWid->height());
|
||||||
updateAppListView();
|
updateAppListView();
|
||||||
|
@ -475,22 +460,18 @@ void FullFunctionWidget::repaintWidget()
|
||||||
|
|
||||||
void FullFunctionWidget::widgetMakeZero()
|
void FullFunctionWidget::widgetMakeZero()
|
||||||
{
|
{
|
||||||
if (m_btnGroup->button(0) != nullptr) {
|
if(m_btnGroup->button(0)!=nullptr)
|
||||||
m_btnGroup->button(0)->click();
|
m_btnGroup->button(0)->click();
|
||||||
}
|
|
||||||
|
|
||||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::moveScrollBar(int type)
|
void FullFunctionWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
int height = Style::primaryScreenHeight;
|
int height=Style::primaryScreenHeight;
|
||||||
|
if(type==0)
|
||||||
if (type == 0) {
|
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()-height*100/1080);
|
||||||
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition() - height * 100 / 1080);
|
else
|
||||||
} else {
|
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()+height*100/1080);
|
||||||
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition() + height * 100 / 1080);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::onSetSlider(int value)
|
void FullFunctionWidget::onSetSlider(int value)
|
||||||
|
@ -499,27 +480,29 @@ void FullFunctionWidget::onSetSlider(int value)
|
||||||
// {
|
// {
|
||||||
// flag = false;
|
// flag = false;
|
||||||
// time->start(100);
|
// time->start(100);
|
||||||
int curvalue = m_scrollArea->verticalScrollBar()->value();
|
int curvalue = m_scrollArea->verticalScrollBar()->value();
|
||||||
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
|
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
|
||||||
// qDebug() << "FullFunctionWidget::onSetSlider" << curvalue;
|
// qDebug() << "FullFunctionWidget::onSetSlider" << curvalue;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FullFunctionWidget::eventFilter(QObject *watched, QEvent *event)
|
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();
|
QLayoutItem* widItem = m_scrollAreaWidLayout->itemAt(2 * m_buttonList.size() - 1);
|
||||||
FullListView *m_listview = qobject_cast<FullListView *>(wid);
|
QWidget* wid = widItem->widget();
|
||||||
QLayoutItem *widItemTop = m_scrollAreaWidLayout->itemAt(1);
|
FullListView* m_listview = qobject_cast<FullListView*>(wid);
|
||||||
QWidget *widTop = widItemTop->widget();
|
|
||||||
FullListView *m_listviewTop = qobject_cast<FullListView *>(widTop);
|
QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
|
||||||
|
QWidget* widTop = widItemTop->widget();
|
||||||
|
FullListView* m_listviewTop = qobject_cast<FullListView*>(widTop);
|
||||||
|
|
||||||
QKeyEvent *ke = (QKeyEvent *)event;
|
QKeyEvent *ke = (QKeyEvent *)event;
|
||||||
|
if( ke->key() == Qt::Key_Tab )
|
||||||
if (ke->key() == Qt::Key_Tab) {
|
{
|
||||||
Q_EMIT setFocusToSideWin();
|
Q_EMIT setFocusToSideWin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(ke->key() == Qt::Key_Up)
|
// if(ke->key() == Qt::Key_Up)
|
||||||
// {
|
// {
|
||||||
// QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
|
// QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
|
||||||
|
@ -548,49 +531,51 @@ bool FullFunctionWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (ke->key() == Qt::Key_Up) {
|
if(ke->key() == Qt::Key_Up)
|
||||||
if (!m_listviewTop->hasFocus()) {
|
{
|
||||||
QAbstractButton *buttonTop = getCurLetterButton((--m_index) % m_buttonList.size());
|
if(!m_listviewTop->hasFocus())
|
||||||
|
{
|
||||||
|
QAbstractButton* buttonTop = getCurLetterButton(( --m_index) % m_buttonList.size());
|
||||||
btnGroupClickedSlot(buttonTop);
|
btnGroupClickedSlot(buttonTop);
|
||||||
this->m_scrollArea->setFocusToPreChild();
|
this->m_scrollArea->setFocusToPreChild();
|
||||||
} else {
|
|
||||||
m_listview->setFocus();
|
|
||||||
QAbstractButton *button = getCurLetterButton(m_buttonList.size() - 1);
|
|
||||||
btnGroupClickedSlot(button);
|
|
||||||
m_index = m_buttonList.size() - 1;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_listview->setFocus();
|
||||||
|
QAbstractButton* button = getCurLetterButton(m_buttonList.size() - 1);
|
||||||
|
btnGroupClickedSlot(button);
|
||||||
|
m_index = m_buttonList.size() - 1;
|
||||||
|
}
|
||||||
Q_EMIT selectFirstItem();
|
Q_EMIT selectFirstItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(ke->key() == Qt::Key_Down)
|
||||||
if (ke->key() == Qt::Key_Down) {
|
{
|
||||||
if (!m_listview->hasFocus()) {
|
if(!m_listview->hasFocus())
|
||||||
QAbstractButton *button = getCurLetterButton((++m_index) % m_buttonList.size());
|
{
|
||||||
|
QAbstractButton* button = getCurLetterButton(( ++m_index) % m_buttonList.size());
|
||||||
btnGroupClickedSlot(button);
|
btnGroupClickedSlot(button);
|
||||||
this->m_scrollArea->setFocusToNextChild();
|
this->m_scrollArea->setFocusToNextChild();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_listviewTop->setFocus();
|
m_listviewTop->setFocus();
|
||||||
QAbstractButton *buttonTop = getCurLetterButton(0);
|
QAbstractButton* buttonTop = getCurLetterButton(0);
|
||||||
btnGroupClickedSlot(buttonTop);
|
btnGroupClickedSlot(buttonTop);
|
||||||
m_listviewTop->setCurrentIndex(m_listviewTop->model()->index(0, 0));
|
m_listviewTop->setCurrentIndex(m_listviewTop->model()->index(0,0));
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT selectFirstItem();
|
Q_EMIT selectFirstItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return QWidget::eventFilter(watched,event);
|
||||||
return QWidget::eventFilter(watched, event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullFunctionWidget::functionButtonClick()
|
void FullFunctionWidget::functionButtonClick()
|
||||||
{
|
{
|
||||||
if (m_btnGroup->button(0) != nullptr) {
|
if(m_btnGroup->button(0)!=nullptr)
|
||||||
m_btnGroup->button(0)->click();
|
m_btnGroup->button(0)->click();
|
||||||
}
|
|
||||||
|
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,7 @@ FunctionWidget::FunctionWidget(QWidget *parent) :
|
||||||
|
|
||||||
FunctionWidget::~FunctionWidget()
|
FunctionWidget::~FunctionWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,21 +37,24 @@ FunctionWidget::~FunctionWidget()
|
||||||
void FunctionWidget::initUi()
|
void FunctionWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setAttribute(Qt::WA_StyledBackground, true);
|
this->setAttribute(Qt::WA_StyledBackground,true);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
initAppListWidget();
|
initAppListWidget();
|
||||||
m_functionBtnWid = new FunctionButtonWidget(this);
|
|
||||||
|
m_functionBtnWid=new FunctionButtonWidget(this);
|
||||||
m_functionBtnWid->hide();
|
m_functionBtnWid->hide();
|
||||||
connect(this, &FunctionWidget::sendClassificationbtnList, m_functionBtnWid, &FunctionButtonWidget::recvClassificationBtnList);
|
connect(this,&FunctionWidget::sendClassificationbtnList,m_functionBtnWid,&FunctionButtonWidget::recvClassificationBtnList);
|
||||||
connect(m_functionBtnWid, &FunctionButtonWidget::sendFunctionBtnSignal, this, &FunctionWidget::recvFunctionBtnSignal);
|
connect(m_functionBtnWid, &FunctionButtonWidget::sendFunctionBtnSignal,this,&FunctionWidget::recvFunctionBtnSignal);
|
||||||
m_enterAnimation = new QPropertyAnimation;
|
|
||||||
|
m_enterAnimation=new QPropertyAnimation;
|
||||||
m_enterAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
m_enterAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
||||||
m_leaveAnimation = new QPropertyAnimation;
|
m_leaveAnimation=new QPropertyAnimation;
|
||||||
m_leaveAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
m_leaveAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
||||||
connect(m_leaveAnimation, &QPropertyAnimation::finished, this, &FunctionWidget::animationFinishedSLot);
|
connect(m_leaveAnimation,&QPropertyAnimation::finished,this,&FunctionWidget::animationFinishedSLot);
|
||||||
connect(m_enterAnimation, &QPropertyAnimation::finished, this, &FunctionWidget::animationFinishedSLot);
|
connect(m_enterAnimation,&QPropertyAnimation::finished,this,&FunctionWidget::animationFinishedSLot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,13 +62,12 @@ void FunctionWidget::initUi()
|
||||||
*/
|
*/
|
||||||
void FunctionWidget::initAppListWidget()
|
void FunctionWidget::initAppListWidget()
|
||||||
{
|
{
|
||||||
m_appListView = new ListView(this, this->width() - 6, this->height() - 6, 2);
|
m_appListView=new ListView(this,this->width()-6,this->height()-6,2);
|
||||||
m_appListView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_appListView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
fillAppListView(0);
|
fillAppListView(0);
|
||||||
connect(m_appListView, &ListView::sendItemClickedSignal, this, &FunctionWidget::recvItemClickedSlot);
|
connect(m_appListView,&ListView::sendItemClickedSignal,this,&FunctionWidget::recvItemClickedSlot);
|
||||||
connect(m_appListView, &ListView::sendHideMainWindowSignal, this, &FunctionWidget::sendHideMainWindowSignal);
|
connect(m_appListView,&ListView::sendHideMainWindowSignal,this,&FunctionWidget::sendHideMainWindowSignal);
|
||||||
connect(m_appListView, &ListView::sendMainWinActiveSignal, this, &FunctionWidget::sendMainWinActiveSignal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,118 +76,105 @@ void FunctionWidget::initAppListWidget()
|
||||||
*/
|
*/
|
||||||
void FunctionWidget::fillAppListView(int type)
|
void FunctionWidget::fillAppListView(int type)
|
||||||
{
|
{
|
||||||
row = 0;
|
row=0;
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_classificationList.clear();
|
m_classificationList.clear();
|
||||||
m_classificationBtnRowList.clear();
|
m_classificationBtnRowList.clear();
|
||||||
QVector<QStringList> vector = UkuiMenuInterface::functionalVector;
|
QVector<QStringList> vector=UkuiMenuInterface::functionalVector;
|
||||||
QStringList androidlist = vector.at(0);
|
QStringList androidlist=vector.at(0);
|
||||||
|
if(!androidlist.isEmpty())
|
||||||
if (!androidlist.isEmpty()) {
|
{
|
||||||
insertClassificationBtn(tr("Mobile"));
|
insertClassificationBtn(tr("Mobile"));
|
||||||
insertAppList(androidlist);
|
insertAppList(androidlist);
|
||||||
}
|
}
|
||||||
|
QStringList netlist=vector.at(1);
|
||||||
QStringList netlist = vector.at(1);
|
if(!netlist.isEmpty())
|
||||||
|
{
|
||||||
if (!netlist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Internet"));
|
insertClassificationBtn(tr("Internet"));
|
||||||
insertAppList(netlist);
|
insertAppList(netlist);
|
||||||
}
|
}
|
||||||
|
QStringList sociallist=vector.at(2);
|
||||||
QStringList sociallist = vector.at(2);
|
if(!sociallist.isEmpty())
|
||||||
|
{
|
||||||
if (!sociallist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Social"));
|
insertClassificationBtn(tr("Social"));
|
||||||
insertAppList(sociallist);
|
insertAppList(sociallist);
|
||||||
}
|
}
|
||||||
|
QStringList avlist=vector.at(3);
|
||||||
QStringList avlist = vector.at(3);
|
if(!avlist.isEmpty())
|
||||||
|
{
|
||||||
if (!avlist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Video"));
|
insertClassificationBtn(tr("Video"));
|
||||||
insertAppList(avlist);
|
insertAppList(avlist);
|
||||||
}
|
}
|
||||||
|
QStringList developlist=vector.at(4);
|
||||||
QStringList developlist = vector.at(4);
|
if(!developlist.isEmpty())
|
||||||
|
{
|
||||||
if (!developlist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Development"));
|
insertClassificationBtn(tr("Development"));
|
||||||
insertAppList(developlist);
|
insertAppList(developlist);
|
||||||
}
|
}
|
||||||
|
QStringList graphicslist=vector.at(5);
|
||||||
QStringList graphicslist = vector.at(5);
|
if(!graphicslist.isEmpty())
|
||||||
|
{
|
||||||
if (!graphicslist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Image"));
|
insertClassificationBtn(tr("Image"));
|
||||||
insertAppList(graphicslist);
|
insertAppList(graphicslist);
|
||||||
}
|
}
|
||||||
|
QStringList gamelist=vector.at(6);
|
||||||
QStringList gamelist = vector.at(6);
|
if(!gamelist.isEmpty())
|
||||||
|
{
|
||||||
if (!gamelist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Game"));
|
insertClassificationBtn(tr("Game"));
|
||||||
insertAppList(gamelist);
|
insertAppList(gamelist);
|
||||||
}
|
}
|
||||||
|
QStringList officelist=vector.at(7);
|
||||||
QStringList officelist = vector.at(7);
|
if(!officelist.isEmpty())
|
||||||
|
{
|
||||||
if (!officelist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Office"));
|
insertClassificationBtn(tr("Office"));
|
||||||
insertAppList(officelist);
|
insertAppList(officelist);
|
||||||
}
|
}
|
||||||
|
QStringList educationlist=vector.at(8);
|
||||||
QStringList educationlist = vector.at(8);
|
if(!educationlist.isEmpty())
|
||||||
|
{
|
||||||
if (!educationlist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Education"));
|
insertClassificationBtn(tr("Education"));
|
||||||
insertAppList(educationlist);
|
insertAppList(educationlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList systemadminlist = vector.at(9);
|
QStringList systemadminlist=vector.at(9);
|
||||||
|
if(!systemadminlist.isEmpty())
|
||||||
if (!systemadminlist.isEmpty()) {
|
{
|
||||||
insertClassificationBtn(tr("System"));
|
insertClassificationBtn(tr("System"));
|
||||||
insertAppList(systemadminlist);
|
insertAppList(systemadminlist);
|
||||||
}
|
}
|
||||||
|
QStringList otherlist=vector.at(10);
|
||||||
QStringList otherlist = vector.at(10);
|
if(!otherlist.isEmpty())
|
||||||
|
{
|
||||||
if (!otherlist.isEmpty()) {
|
|
||||||
insertClassificationBtn(tr("Others"));
|
insertClassificationBtn(tr("Others"));
|
||||||
insertAppList(otherlist);
|
insertAppList(otherlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 0) {
|
if(type==0)
|
||||||
m_appListView->addData(m_data);
|
m_appListView->addData(m_data);
|
||||||
} else {
|
else
|
||||||
m_appListView->updateData(m_data);
|
m_appListView->updateData(m_data);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionWidget::insertClassificationBtn(QString btnname)
|
void FunctionWidget::insertClassificationBtn(QString btnname)
|
||||||
{
|
{
|
||||||
m_classificationList.append(btnname);
|
m_classificationList.append(btnname);
|
||||||
m_data.append(QStringList() << btnname << "0");
|
m_data.append(QStringList()<<btnname<<"0");
|
||||||
m_classificationBtnRowList.append(QString::number(row));
|
m_classificationBtnRowList.append(QString::number(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionWidget::insertAppList(QStringList appnamelist)
|
void FunctionWidget::insertAppList(QStringList appnamelist)
|
||||||
{
|
{
|
||||||
row += (appnamelist.count() + 1);
|
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");
|
||||||
m_data.append(QStringList() << appnamelist.at(i) << "1");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionWidget::recvItemClickedSlot(QStringList arg)
|
void FunctionWidget::recvItemClickedSlot(QStringList arg)
|
||||||
{
|
{
|
||||||
if (arg.at(1).toInt() == 0) {
|
if(arg.at(1).toInt()==0)
|
||||||
appClassificationBtnClickedSlot();
|
appClassificationBtnClickedSlot();
|
||||||
} else {
|
else
|
||||||
execApplication(arg.at(0));
|
execApplication(arg.at(0));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -213,22 +199,23 @@ void FunctionWidget::updateAppListView()
|
||||||
*/
|
*/
|
||||||
void FunctionWidget::appClassificationBtnClickedSlot()
|
void FunctionWidget::appClassificationBtnClickedSlot()
|
||||||
{
|
{
|
||||||
m_leaveAnimation->setStartValue(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_leaveAnimation->setStartValue(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
// m_leaveAnimation->setEndValue(QRect(20,20,this->width()-40,this->height()-40));
|
// m_leaveAnimation->setEndValue(QRect(20,20,this->width()-40,this->height()-40));
|
||||||
m_leaveAnimation->setEndValue(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_leaveAnimation->setEndValue(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_enterAnimation->setStartValue(QRect(-40, -40, this->width() + 80, this->height() + 80));
|
m_enterAnimation->setStartValue(QRect(-40,-40,this->width()+80,this->height()+80));
|
||||||
m_enterAnimation->setEndValue(QRect((this->width() - Style::LeftBtnWidth * 2 - 5) / 2,
|
m_enterAnimation->setEndValue(QRect((this->width()-Style::LeftBtnWidth*2-5)/2,
|
||||||
(this->height() - Style::LeftBtnHeight * 6 - 25) / 2,
|
(this->height()-Style::LeftBtnHeight*6-25)/2,
|
||||||
Style::LeftBtnWidth * 2 + 5,
|
Style::LeftBtnWidth*2+5,
|
||||||
Style::LeftBtnHeight * 6 + 25));
|
Style::LeftBtnHeight*6+25));
|
||||||
m_leaveAnimation->setDuration(10);
|
m_leaveAnimation->setDuration(10);
|
||||||
m_enterAnimation->setDuration(100);
|
m_enterAnimation->setDuration(100);
|
||||||
|
|
||||||
//加载FunctionButtonWidget界面
|
//加载FunctionButtonWidget界面
|
||||||
Q_EMIT sendClassificationbtnList();
|
Q_EMIT sendClassificationbtnList();
|
||||||
m_leaveAnimation->setTargetObject(m_appListView);
|
m_leaveAnimation->setTargetObject(m_appListView);
|
||||||
m_enterAnimation->setTargetObject(m_functionBtnWid);
|
m_enterAnimation->setTargetObject(m_functionBtnWid);
|
||||||
m_leaveAnimation->start();
|
m_leaveAnimation->start();
|
||||||
m_widgetState = 1;
|
m_widgetState=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -237,42 +224,44 @@ void FunctionWidget::appClassificationBtnClickedSlot()
|
||||||
void FunctionWidget::recvFunctionBtnSignal(QString btnname)
|
void FunctionWidget::recvFunctionBtnSignal(QString btnname)
|
||||||
{
|
{
|
||||||
//此处需实现将功能为btnname的应用列表移动到applistWid界面最顶端
|
//此处需实现将功能为btnname的应用列表移动到applistWid界面最顶端
|
||||||
int index = m_classificationList.indexOf(btnname);
|
int index=m_classificationList.indexOf(btnname);
|
||||||
|
if(index!=-1)
|
||||||
if (index != -1) {
|
{
|
||||||
int row = m_classificationBtnRowList.at(index).toInt();
|
int row=m_classificationBtnRowList.at(index).toInt();
|
||||||
m_appListView->verticalScrollBar()->setValue(row);
|
m_appListView->verticalScrollBar()->setValue(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_leaveAnimation->setStartValue(QRect((this->width() - Style::LeftBtnWidth * 2 - 5) / 2,
|
m_leaveAnimation->setStartValue(QRect((this->width()-Style::LeftBtnWidth*2-5)/2,
|
||||||
(this->height() - Style::LeftBtnHeight * 6 - 25) / 2,
|
(this->height()-Style::LeftBtnHeight*6-25)/2,
|
||||||
Style::LeftBtnWidth * 2 + 5,
|
Style::LeftBtnWidth*2+5,
|
||||||
Style::LeftBtnHeight * 6 + 25));
|
Style::LeftBtnHeight*6+25));
|
||||||
m_leaveAnimation->setEndValue(QRect(-40, -40, this->width() + 80, this->height() + 80));
|
m_leaveAnimation->setEndValue(QRect(-40,-40,this->width()+80,this->height()+80));
|
||||||
// m_enterAnimation->setStartValue(QRect(20,20,this->width()-40,this->height()-40));
|
// m_enterAnimation->setStartValue(QRect(20,20,this->width()-40,this->height()-40));
|
||||||
m_enterAnimation->setStartValue(QRect(6, 0, this->width() - 6, this->height() - 6));
|
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->setEndValue(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_leaveAnimation->setDuration(100);
|
m_leaveAnimation->setDuration(100);
|
||||||
m_enterAnimation->setDuration(10);
|
m_enterAnimation->setDuration(10);
|
||||||
|
|
||||||
m_leaveAnimation->setTargetObject(m_functionBtnWid);
|
m_leaveAnimation->setTargetObject(m_functionBtnWid);
|
||||||
m_enterAnimation->setTargetObject(m_appListView);
|
m_enterAnimation->setTargetObject(m_appListView);
|
||||||
m_leaveAnimation->start();
|
m_leaveAnimation->start();
|
||||||
m_widgetState = 0;
|
m_widgetState=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionWidget::animationFinishedSLot()
|
void FunctionWidget::animationFinishedSLot()
|
||||||
{
|
{
|
||||||
if (m_widgetState == 1) {
|
if(m_widgetState==1)
|
||||||
|
{
|
||||||
m_appListView->hide();
|
m_appListView->hide();
|
||||||
m_enterAnimation->start();
|
m_enterAnimation->start();
|
||||||
m_widgetState = -1;
|
m_widgetState=-1;
|
||||||
m_functionBtnWid->show();
|
m_functionBtnWid->show();
|
||||||
}
|
}
|
||||||
|
if(m_widgetState==0)
|
||||||
if (m_widgetState == 0) {
|
{
|
||||||
m_functionBtnWid->hide();
|
m_functionBtnWid->hide();
|
||||||
m_enterAnimation->start();
|
m_enterAnimation->start();
|
||||||
m_widgetState = -1;
|
m_widgetState=-1;
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -280,24 +269,23 @@ void FunctionWidget::animationFinishedSLot()
|
||||||
void FunctionWidget::widgetMakeZero()
|
void FunctionWidget::widgetMakeZero()
|
||||||
{
|
{
|
||||||
m_functionBtnWid->hide();
|
m_functionBtnWid->hide();
|
||||||
m_appListView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_appListView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
m_appListView->verticalScrollBar()->setValue(0);
|
m_appListView->verticalScrollBar()->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionWidget::moveScrollBar(int type)
|
void FunctionWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
if (type == 0) {
|
if(type==0)
|
||||||
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition() - 100);
|
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()-100);
|
||||||
} else {
|
else
|
||||||
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition() + 100);
|
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()+100);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionWidget::repaintWidget()
|
void FunctionWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_appListView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_appListView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,8 +132,6 @@ Q_SIGNALS:
|
||||||
* @brief Send a hidden main window signal to the MainViewWidget
|
* @brief Send a hidden main window signal to the MainViewWidget
|
||||||
*/
|
*/
|
||||||
void sendHideMainWindowSignal();
|
void sendHideMainWindowSignal();
|
||||||
|
|
||||||
void sendMainWinActiveSignal(bool flag);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FUNCTIONWIDGET_H
|
#endif // FUNCTIONWIDGET_H
|
||||||
|
|
|
@ -144,7 +144,7 @@ void UkuiMenuInterface::recursiveSearchFile(const QString& _filePath)
|
||||||
} while(i < list.size());
|
} while(i < list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取系统desktop文件路径
|
//获取系统deskyop文件路径
|
||||||
QStringList UkuiMenuInterface::getDesktopFilePath()
|
QStringList UkuiMenuInterface::getDesktopFilePath()
|
||||||
{
|
{
|
||||||
filePathList.clear();
|
filePathList.clear();
|
||||||
|
@ -176,6 +176,7 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
|
||||||
{
|
{
|
||||||
getAndroidApp();
|
getAndroidApp();
|
||||||
recursiveSearchFile("/usr/share/applications/");
|
recursiveSearchFile("/usr/share/applications/");
|
||||||
|
recursiveSearchFile(QDir::homePath()+"/.local/share/applications/");
|
||||||
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
|
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
|
||||||
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
|
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
|
||||||
QJsonArray blArray=obj.value("blacklist").toArray();
|
QJsonArray blArray=obj.value("blacklist").toArray();
|
||||||
|
@ -191,6 +192,7 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
|
||||||
{
|
{
|
||||||
getAndroidApp();
|
getAndroidApp();
|
||||||
recursiveSearchFile("/usr/share/applications/");
|
recursiveSearchFile("/usr/share/applications/");
|
||||||
|
recursiveSearchFile(QDir::homePath()+"/.local/share/applications/");
|
||||||
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
|
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
|
||||||
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
|
recursiveSearchFile("/var/lib/flatpak/exports/share/applications/");
|
||||||
}
|
}
|
||||||
|
@ -203,6 +205,7 @@ QStringList UkuiMenuInterface::getDesktopFilePath()
|
||||||
{
|
{
|
||||||
getAndroidApp();
|
getAndroidApp();
|
||||||
recursiveSearchFile("/usr/share/applications/");
|
recursiveSearchFile("/usr/share/applications/");
|
||||||
|
recursiveSearchFile(QDir::homePath()+"/.local/share/applications/");
|
||||||
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
|
recursiveSearchFile("/var/lib/snapd/desktop/applications/");
|
||||||
recursiveSearchFile("/var/lib/flatpak/exports/share/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-uninstall.desktop");
|
||||||
filePathList.removeAll("/usr/share/applications/wps-office-misc.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;
|
return filePathList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +277,6 @@ QVector<QStringList> UkuiMenuInterface::createAppInfoVector()
|
||||||
QStringList appInfoList;
|
QStringList appInfoList;
|
||||||
QString desktopfp=desktopfpList.at(i);
|
QString desktopfp=desktopfpList.at(i);
|
||||||
QString name=getAppName(desktopfpList.at(i));
|
QString name=getAppName(desktopfpList.at(i));
|
||||||
|
|
||||||
if(!name.isEmpty())
|
if(!name.isEmpty())
|
||||||
{
|
{
|
||||||
QString englishName=getAppEnglishName(desktopfpList.at(i));
|
QString englishName=getAppEnglishName(desktopfpList.at(i));
|
||||||
|
@ -847,21 +834,21 @@ void UkuiMenuInterface::getAndroidApp()
|
||||||
QByteArray fpbyte=filePathStr.toLocal8Bit();
|
QByteArray fpbyte=filePathStr.toLocal8Bit();
|
||||||
char* filepath=fpbyte.data();
|
char* filepath=fpbyte.data();
|
||||||
g_key_file_load_from_file(keyfile,filepath,flags,error);
|
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);
|
char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","Categories", nullptr, nullptr);
|
||||||
// if(ret_1!=nullptr)
|
if(ret_1!=nullptr)
|
||||||
// {
|
{
|
||||||
// QString str=QString::fromLocal8Bit(ret_1);
|
QString str=QString::fromLocal8Bit(ret_1);
|
||||||
// if(!str.contains("Android"))
|
if(!str.contains("Android"))
|
||||||
// {
|
{
|
||||||
// i++;
|
i++;
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
filePathList.append(filePathStr);
|
filePathList.append(filePathStr);
|
||||||
androidDesktopfnList.append(fileInfo.fileName());
|
androidDesktopfnList.append(fileInfo.fileName());
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}while(i < list.size());
|
}while(i < list.size());
|
||||||
|
|
|
@ -28,10 +28,9 @@ FullLetterWidget::FullLetterWidget(QWidget *parent) :
|
||||||
|
|
||||||
FullLetterWidget::~FullLetterWidget()
|
FullLetterWidget::~FullLetterWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
delete m_letterListBottomSpacer;
|
||||||
m_ukuiMenuInterface = nullptr;
|
delete m_appListBottomSpacer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,28 +39,33 @@ FullLetterWidget::~FullLetterWidget()
|
||||||
void FullLetterWidget::initUi()
|
void FullLetterWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setAttribute(Qt::WA_TranslucentBackground);
|
this->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_applistWid = new QWidget(this);
|
|
||||||
m_letterListWid = new QWidget(this);
|
m_applistWid=new QWidget(this);
|
||||||
|
m_letterListWid=new QWidget(this);
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
m_applistWid->setFixedSize(Style::AppListWidWidth, this->height());
|
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
m_letterListWid->setFixedSize(Style::LeftWidWidth, this->height());
|
m_letterListWid->setFixedSize(Style::LeftWidWidth,this->height());
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
QHBoxLayout* mainLayout=new QHBoxLayout;
|
||||||
|
mainLayout->setContentsMargins(0,0,0,0);
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
mainLayout->addWidget(m_letterListWid);
|
mainLayout->addWidget(m_letterListWid);
|
||||||
mainLayout->addWidget(m_applistWid);
|
mainLayout->addWidget(m_applistWid);
|
||||||
this->setLayout(mainLayout);
|
this->setLayout(mainLayout);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
|
|
||||||
initAppListWidget();
|
initAppListWidget();
|
||||||
initLetterListWidget();
|
initLetterListWidget();
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
//翻页灵敏度时间调节
|
//翻页灵敏度时间调节
|
||||||
time = new QTimer(this);
|
time = new QTimer(this);
|
||||||
connect(time, &QTimer::timeout, [ = ]() {
|
connect(time,&QTimer::timeout,[=](){
|
||||||
if (flag == false) {
|
if(flag == false)
|
||||||
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
time->stop();
|
time->stop();
|
||||||
}
|
}
|
||||||
|
@ -73,22 +77,24 @@ void FullLetterWidget::initUi()
|
||||||
*/
|
*/
|
||||||
void FullLetterWidget::initAppListWidget()
|
void FullLetterWidget::initAppListWidget()
|
||||||
{
|
{
|
||||||
QHBoxLayout *layout = new QHBoxLayout(m_applistWid);
|
QHBoxLayout* layout=new QHBoxLayout(m_applistWid);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0,0,0,0);
|
||||||
m_applistWid->setLayout(layout);
|
m_applistWid->setLayout(layout);
|
||||||
m_scrollArea = new ScrollArea;
|
|
||||||
m_scrollAreaWid = new ScrollAreaWid;
|
m_scrollArea=new ScrollArea;
|
||||||
|
m_scrollAreaWid=new ScrollAreaWid;
|
||||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||||
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
|
m_scrollArea->setFixedSize(m_applistWid->width(),m_applistWid->height());
|
||||||
m_scrollArea->setWidgetResizable(true);
|
m_scrollArea->setWidgetResizable(true);
|
||||||
m_scrollAreaWidLayout = new QVBoxLayout;
|
m_scrollAreaWidLayout=new QVBoxLayout;
|
||||||
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
m_scrollAreaWidLayout->setContentsMargins(0,0,0,0);
|
||||||
m_scrollAreaWidLayout->setSpacing(10);
|
m_scrollAreaWidLayout->setSpacing(10);
|
||||||
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
||||||
layout->addWidget(m_scrollArea);
|
layout->addWidget(m_scrollArea);
|
||||||
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &FullLetterWidget::valueChangedSlot);
|
this,&FullLetterWidget::valueChangedSlot);
|
||||||
m_appListBottomSpacer = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding);
|
m_appListBottomSpacer=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||||
|
|
||||||
fillAppList();
|
fillAppList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,52 +111,47 @@ void FullLetterWidget::setFocusToThis()
|
||||||
void FullLetterWidget::fillAppList()
|
void FullLetterWidget::fillAppList()
|
||||||
{
|
{
|
||||||
m_letterList.clear();
|
m_letterList.clear();
|
||||||
QVector<QStringList> vector = UkuiMenuInterface::alphabeticVector;
|
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);
|
QStringList appList=vector.at(i);
|
||||||
|
if(!appList.isEmpty())
|
||||||
if (!appList.isEmpty()) {
|
{
|
||||||
QString letterstr;
|
QString letterstr;
|
||||||
|
if(i<26)
|
||||||
if (i < 26) {
|
letterstr=QString(QChar(static_cast<char>(i+65)));
|
||||||
letterstr = QString(QChar(static_cast<char>(i + 65)));
|
else if(i==26)
|
||||||
} else if (i == 26) {
|
letterstr="&";
|
||||||
letterstr = "&";
|
else
|
||||||
} else {
|
letterstr="#";
|
||||||
letterstr = "#";
|
|
||||||
}
|
|
||||||
|
|
||||||
m_letterList.append(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);
|
m_scrollAreaWidLayout->addWidget(letterbtn);
|
||||||
|
|
||||||
//插入应用列表
|
//插入应用列表
|
||||||
FullListView *listview = new FullListView(this, 1);
|
FullListView* listview=new FullListView(this,1);
|
||||||
connect(listview, &FullListView::sendSetslidebar, this, &FullLetterWidget::onSetSlider);
|
connect(listview, &FullListView::sendSetslidebar,this,&FullLetterWidget::onSetSlider);
|
||||||
connect(this, &FullLetterWidget::selectFirstItem, listview, &FullListView::selectFirstItem);
|
connect(this, &FullLetterWidget::selectFirstItem, listview, &FullListView::selectFirstItem);
|
||||||
listview->installEventFilter(this);
|
listview->installEventFilter(this);
|
||||||
//修复异常黑框问题
|
//修复异常黑框问题
|
||||||
connect(m_scrollArea, &ScrollArea::requestUpdate, listview->viewport(), [ = ]() {
|
connect(m_scrollArea, &ScrollArea::requestUpdate, listview->viewport(), [=](){
|
||||||
QEventLoop loop;
|
|
||||||
QTimer::singleShot(1, &loop, SLOT(quit()));
|
|
||||||
loop.exec();
|
|
||||||
listview->repaint(listview->rect());
|
listview->repaint(listview->rect());
|
||||||
});
|
});
|
||||||
|
|
||||||
m_scrollAreaWidLayout->addWidget(listview);
|
m_scrollAreaWidLayout->addWidget(listview);
|
||||||
m_data.clear();
|
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));
|
m_data.append(appList.at(i));
|
||||||
}
|
|
||||||
|
|
||||||
listview->addData(m_data);
|
listview->addData(m_data);
|
||||||
connect(listview, &FullListView::sendItemClickedSignal, this, &FullLetterWidget::execApplication);
|
|
||||||
connect(listview, &FullListView::sendHideMainWindowSignal, this, &FullLetterWidget::sendHideMainWindowSignal);
|
connect(listview,&FullListView::sendItemClickedSignal,this,&FullLetterWidget::execApplication);
|
||||||
|
connect(listview,&FullListView::sendHideMainWindowSignal,this,&FullLetterWidget::sendHideMainWindowSignal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scrollAreaWidLayout->addItem(m_appListBottomSpacer);
|
m_scrollAreaWidLayout->addItem(m_appListBottomSpacer);
|
||||||
|
|
||||||
resizeScrollAreaControls();
|
resizeScrollAreaControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,27 +172,23 @@ void FullLetterWidget::updateAppListView()
|
||||||
//刷新应用列表界面
|
//刷新应用列表界面
|
||||||
QLayoutItem *child;
|
QLayoutItem *child;
|
||||||
m_scrollAreaWidLayout->removeItem(m_appListBottomSpacer);
|
m_scrollAreaWidLayout->removeItem(m_appListBottomSpacer);
|
||||||
|
while ((child = m_scrollAreaWidLayout->takeAt(0)) != 0) {
|
||||||
while ((child = m_scrollAreaWidLayout->takeAt(0)) != 0) {
|
QWidget* wid=child->widget();
|
||||||
QWidget *wid = child->widget();
|
m_scrollAreaWidLayout->removeWidget(wid);
|
||||||
m_scrollAreaWidLayout->removeWidget(wid);
|
wid->setParent(nullptr);
|
||||||
wid->setParent(nullptr);
|
delete wid;
|
||||||
delete wid;
|
delete child;
|
||||||
delete child;
|
}
|
||||||
}
|
fillAppList();
|
||||||
|
|
||||||
fillAppList();
|
|
||||||
|
|
||||||
//刷新字母列表界面
|
//刷新字母列表界面
|
||||||
Q_FOREACH (QAbstractButton *button, m_buttonList) {
|
Q_FOREACH (QAbstractButton* button, m_buttonList) {
|
||||||
m_btnGroup->removeButton(button);
|
m_btnGroup->removeButton(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_buttonList.clear();
|
m_buttonList.clear();
|
||||||
m_letterListScrollAreaWidLayout->removeItem(m_letterListBottomSpacer);
|
m_letterListScrollAreaWidLayout->removeItem(m_letterListBottomSpacer);
|
||||||
|
|
||||||
while ((child = m_letterListScrollAreaWidLayout->takeAt(0)) != 0) {
|
while ((child = m_letterListScrollAreaWidLayout->takeAt(0)) != 0) {
|
||||||
QWidget *wid = child->widget();
|
QWidget* wid=child->widget();
|
||||||
m_letterListScrollAreaWidLayout->removeWidget(wid);
|
m_letterListScrollAreaWidLayout->removeWidget(wid);
|
||||||
wid->setParent(nullptr);
|
wid->setParent(nullptr);
|
||||||
delete wid;
|
delete wid;
|
||||||
|
@ -207,27 +204,30 @@ void FullLetterWidget::updateAppListView()
|
||||||
*/
|
*/
|
||||||
void FullLetterWidget::resizeScrollAreaControls()
|
void FullLetterWidget::resizeScrollAreaControls()
|
||||||
{
|
{
|
||||||
int row = 0;
|
int row=0;
|
||||||
|
while(row<m_scrollAreaWidLayout->count()/2)
|
||||||
while (row < m_scrollAreaWidLayout->count() / 2) {
|
{
|
||||||
//应用界面
|
//应用界面
|
||||||
QLayoutItem *widItem = m_scrollAreaWidLayout->itemAt(row * 2 + 1);
|
QLayoutItem* widItem=m_scrollAreaWidLayout->itemAt(row*2+1);
|
||||||
QWidget *wid = widItem->widget();
|
QWidget* wid=widItem->widget();
|
||||||
FullListView *listview = qobject_cast<FullListView *>(wid);
|
FullListView* listview=qobject_cast<FullListView*>(wid);
|
||||||
listview->adjustSize();
|
listview->adjustSize();
|
||||||
int dividend = (m_scrollArea->width() - Style::SliderSize) / Style::AppListGridSizeWidth;
|
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
|
||||||
int rowcount = 0;
|
|
||||||
|
int rowcount=0;
|
||||||
|
if(listview->model()->rowCount()%dividend>0)
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend;
|
||||||
|
|
||||||
if (listview->model()->rowCount() % dividend > 0) {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend + 1;
|
|
||||||
} else {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listview->setFixedSize(m_scrollArea->width() - Style::SliderSize + 1, listview->gridSize().height()*rowcount);
|
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scrollArea->widget()->adjustSize();
|
m_scrollArea->widget()->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,21 +236,24 @@ void FullLetterWidget::resizeScrollAreaControls()
|
||||||
*/
|
*/
|
||||||
void FullLetterWidget::initLetterListWidget()
|
void FullLetterWidget::initLetterListWidget()
|
||||||
{
|
{
|
||||||
m_letterListScrollArea = new ClassifyBtnScrollArea(m_letterListWid);
|
m_letterListScrollArea=new ClassifyBtnScrollArea(m_letterListWid);
|
||||||
m_letterListScrollAreaWid = new ClassifyBtnScrollAreaWid;
|
m_letterListScrollAreaWid=new ClassifyBtnScrollAreaWid;
|
||||||
m_letterListScrollAreaWidLayout = new QVBoxLayout;
|
m_letterListScrollAreaWidLayout=new QVBoxLayout;
|
||||||
m_letterListScrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
m_letterListScrollAreaWidLayout->setContentsMargins(0,0,0,0);
|
||||||
m_letterListScrollAreaWidLayout->setSpacing(0);
|
m_letterListScrollAreaWidLayout->setSpacing(0);
|
||||||
m_letterListScrollAreaWid->setLayout(m_letterListScrollAreaWidLayout);
|
m_letterListScrollAreaWid->setLayout(m_letterListScrollAreaWidLayout);
|
||||||
m_letterListScrollArea->setWidget(m_letterListScrollAreaWid);
|
m_letterListScrollArea->setWidget(m_letterListScrollAreaWid);
|
||||||
m_letterListScrollArea->setWidgetResizable(true);
|
m_letterListScrollArea->setWidgetResizable(true);
|
||||||
m_letterListBottomSpacer = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding);
|
|
||||||
m_btnGroup = new QButtonGroup(m_letterListScrollAreaWid);
|
m_letterListBottomSpacer=new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding);
|
||||||
|
m_btnGroup=new QButtonGroup(m_letterListScrollAreaWid);
|
||||||
m_animation = new QPropertyAnimation(m_letterListScrollArea, "geometry");
|
m_animation = new QPropertyAnimation(m_letterListScrollArea, "geometry");
|
||||||
|
|
||||||
m_scrollAnimation = new QPropertyAnimation(m_scrollArea->verticalScrollBar(), "value");
|
m_scrollAnimation = new QPropertyAnimation(m_scrollArea->verticalScrollBar(), "value");
|
||||||
m_scrollAnimation->setEasingCurve(QEasingCurve::OutQuad);
|
m_scrollAnimation->setEasingCurve(QEasingCurve::OutQuad);
|
||||||
connect(m_scrollAnimation, &QPropertyAnimation::finished, this, &FullLetterWidget::animationFinishSlot);
|
connect(m_scrollAnimation, &QPropertyAnimation::finished, this, &FullLetterWidget::animationFinishSlot);
|
||||||
connect(m_scrollAnimation, &QPropertyAnimation::valueChanged, this, &FullLetterWidget::animationValueChangedSlot);
|
connect(m_scrollAnimation, &QPropertyAnimation::valueChanged, this, &FullLetterWidget::animationValueChangedSlot);
|
||||||
|
|
||||||
initLetterListScrollArea();
|
initLetterListScrollArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,60 +262,56 @@ void FullLetterWidget::initLetterListWidget()
|
||||||
*/
|
*/
|
||||||
void FullLetterWidget::initLetterListScrollArea()
|
void FullLetterWidget::initLetterListScrollArea()
|
||||||
{
|
{
|
||||||
if (m_letterList.contains("&")) {
|
if(m_letterList.contains("&"))
|
||||||
m_letterList.replace(m_letterList.indexOf("&"), "&&");
|
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,
|
||||||
LetterClassifyButton *letterbtn = new LetterClassifyButton(m_letterListScrollAreaWid,
|
true,
|
||||||
true,
|
m_letterList.at(i));
|
||||||
m_letterList.at(i));
|
letterbtn->setFixedSize(Style::LeftLetterBtnHeight,Style::LeftLetterBtnHeight);
|
||||||
letterbtn->setFixedSize(Style::LeftLetterBtnHeight, Style::LeftLetterBtnHeight);
|
|
||||||
m_buttonList.append(letterbtn);
|
m_buttonList.append(letterbtn);
|
||||||
m_letterListScrollAreaWidLayout->addWidget(letterbtn);
|
m_letterListScrollAreaWidLayout->addWidget(letterbtn);
|
||||||
m_letterListScrollAreaWidLayout->setAlignment(letterbtn, Qt::AlignHCenter);
|
m_letterListScrollAreaWidLayout->setAlignment(letterbtn,Qt::AlignHCenter);
|
||||||
connect(letterbtn, &LetterClassifyButton::buttonClicked, m_btnGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked));
|
connect(letterbtn,&LetterClassifyButton::buttonClicked,m_btnGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_letterListScrollAreaWidLayout->addItem(m_letterListBottomSpacer);
|
m_letterListScrollAreaWidLayout->addItem(m_letterListBottomSpacer);
|
||||||
int id = 0;
|
|
||||||
|
|
||||||
Q_FOREACH (QAbstractButton *btn, m_buttonList) {
|
int id=0;
|
||||||
m_btnGroup->addButton(btn, id++);
|
Q_FOREACH (QAbstractButton* btn, m_buttonList) {
|
||||||
|
m_btnGroup->addButton(btn,id++);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_btnGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), this, &FullLetterWidget::btnGroupClickedSlot);
|
connect(m_btnGroup,static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),this,&FullLetterWidget::btnGroupClickedSlot);
|
||||||
m_letterListScrollArea->widget()->adjustSize();
|
m_letterListScrollArea->widget()->adjustSize();
|
||||||
|
if(m_btnGroup->button(0)!=nullptr)
|
||||||
if (m_btnGroup->button(0) != nullptr) {
|
|
||||||
m_btnGroup->button(0)->click();
|
m_btnGroup->button(0)->click();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn)
|
void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn)
|
||||||
{
|
{
|
||||||
disconnect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
disconnect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &FullLetterWidget::valueChangedSlot);
|
this,&FullLetterWidget::valueChangedSlot);
|
||||||
|
Q_FOREACH (QAbstractButton* button, m_buttonList) {
|
||||||
Q_FOREACH (QAbstractButton *button, m_buttonList) {
|
LetterClassifyButton* letterbtn=qobject_cast<LetterClassifyButton*>(button);
|
||||||
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);
|
letterbtn->setChecked(true);
|
||||||
//此处需实现将被选定的字母包含的应用列表移动到applistWid界面最顶端
|
//此处需实现将被选定的字母包含的应用列表移动到applistWid界面最顶端
|
||||||
QString letterstr = letterbtn->text();
|
QString letterstr=letterbtn->text();
|
||||||
int num = m_letterList.indexOf(letterstr);
|
int num=m_letterList.indexOf(letterstr);
|
||||||
|
if(num!=-1)
|
||||||
if (num != -1) {
|
{
|
||||||
m_beginPos = m_scrollArea->verticalScrollBar()->sliderPosition();
|
m_beginPos=m_scrollArea->verticalScrollBar()->sliderPosition();
|
||||||
m_endPos = m_scrollAreaWidLayout->itemAt(m_btnGroup->id(btn) * 2)->widget()->y();
|
m_endPos=m_scrollAreaWidLayout->itemAt(m_btnGroup->id(btn)*2)->widget()->y();
|
||||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
m_scrollAnimation->stop();
|
m_scrollAnimation->stop();
|
||||||
m_scrollAnimation->setStartValue(m_beginPos);
|
m_scrollAnimation->setStartValue(m_beginPos);
|
||||||
m_scrollAnimation->setEndValue(m_endPos);
|
m_scrollAnimation->setEndValue(m_endPos);
|
||||||
m_scrollAnimation->start();
|
m_scrollAnimation->start();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else{
|
||||||
letterbtn->setChecked(false);
|
letterbtn->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,58 +319,56 @@ void FullLetterWidget::btnGroupClickedSlot(QAbstractButton *btn)
|
||||||
|
|
||||||
void FullLetterWidget::animationFinishSlot()
|
void FullLetterWidget::animationFinishSlot()
|
||||||
{
|
{
|
||||||
if (m_scrollArea->verticalScrollBar()->value() == m_endPos ||
|
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);
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
|
connect(m_scrollArea->verticalScrollBar(),&QScrollBar::valueChanged,
|
||||||
this, &FullLetterWidget::valueChangedSlot);
|
this,&FullLetterWidget::valueChangedSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::animationValueChangedSlot(const QVariant &value)
|
void FullLetterWidget::animationValueChangedSlot(const QVariant &value)
|
||||||
{
|
{
|
||||||
Q_UNUSED(value);
|
Q_UNUSED(value);
|
||||||
|
if (sender() != m_scrollAnimation)
|
||||||
if (sender() != m_scrollAnimation) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
QPropertyAnimation *ani = qobject_cast<QPropertyAnimation *>(sender());
|
QPropertyAnimation *ani = qobject_cast<QPropertyAnimation *>(sender());
|
||||||
|
|
||||||
if (m_endPos != ani->endValue()) {
|
if (m_endPos != ani->endValue())
|
||||||
ani->setEndValue(m_endPos);
|
ani->setEndValue(m_endPos);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::valueChangedSlot(int value)
|
void FullLetterWidget::valueChangedSlot(int value)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index=0;
|
||||||
|
while(index<=m_letterList.count()-1)
|
||||||
|
{
|
||||||
|
int min=m_scrollAreaWidLayout->itemAt(2*index)->widget()->y();
|
||||||
|
int max=0;
|
||||||
|
if(index==m_letterList.count()-1)
|
||||||
|
max=m_scrollAreaWid->height();
|
||||||
|
else
|
||||||
|
max=m_scrollAreaWidLayout->itemAt(2*(index+1))->widget()->y();
|
||||||
|
|
||||||
while (index <= m_letterList.count() - 1) {
|
if(value>=min && value <max)
|
||||||
int min = m_scrollAreaWidLayout->itemAt(2 * index)->widget()->y();
|
{
|
||||||
int max = 0;
|
Q_FOREACH (QAbstractButton* button, m_buttonList) {
|
||||||
|
LetterClassifyButton* letterbtn=qobject_cast<LetterClassifyButton*>(button);
|
||||||
if (index == m_letterList.count() - 1) {
|
if(index==m_buttonList.indexOf(button))
|
||||||
max = m_scrollAreaWid->height();
|
{
|
||||||
} else {
|
|
||||||
max = m_scrollAreaWidLayout->itemAt(2 * (index + 1))->widget()->y();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value >= min && value < max) {
|
|
||||||
Q_FOREACH (QAbstractButton *button, m_buttonList) {
|
|
||||||
LetterClassifyButton *letterbtn = qobject_cast<LetterClassifyButton *>(button);
|
|
||||||
|
|
||||||
if (index == m_buttonList.indexOf(button)) {
|
|
||||||
letterbtn->setChecked(true);
|
letterbtn->setChecked(true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
letterbtn->setChecked(false);
|
letterbtn->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// //向下滚动
|
// //向下滚动
|
||||||
|
@ -380,23 +377,26 @@ void FullLetterWidget::valueChangedSlot(int value)
|
||||||
// int val=m_letterListScrollArea->verticalScrollBar()->sliderPosition()+m_buttonList.at(index)->height();
|
// int val=m_letterListScrollArea->verticalScrollBar()->sliderPosition()+m_buttonList.at(index)->height();
|
||||||
// m_letterListScrollArea->verticalScrollBar()->setSliderPosition(val);
|
// m_letterListScrollArea->verticalScrollBar()->setSliderPosition(val);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// //向上滚动
|
// //向上滚动
|
||||||
// if((m_buttonList.at(index)->pos().y()+m_letterListScrollArea->widget()->pos().y()) <= 0)
|
// if((m_buttonList.at(index)->pos().y()+m_letterListScrollArea->widget()->pos().y()) <= 0)
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// int val=m_letterListScrollArea->verticalScrollBar()->value()-m_buttonList.at(index)->height();
|
// int val=m_letterListScrollArea->verticalScrollBar()->value()-m_buttonList.at(index)->height();
|
||||||
// m_letterListScrollArea->verticalScrollBar()->setSliderPosition(val);
|
// m_letterListScrollArea->verticalScrollBar()->setSliderPosition(val);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::enterAnimation()
|
void FullLetterWidget::enterAnimation()
|
||||||
{
|
{
|
||||||
m_animation->setDuration(200);//动画总时间
|
m_animation->setDuration(200);//动画总时间
|
||||||
m_animation->setStartValue(QRect(0, (m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2,
|
m_animation->setStartValue(QRect(0,(m_letterListWid->height()-(m_letterList.size()+1)*Style::LeftLetterBtnHeight)/2,
|
||||||
0, (m_letterList.size() + 1)*Style::LeftLetterBtnHeight));
|
0,(m_letterList.size()+1)*Style::LeftLetterBtnHeight));
|
||||||
m_animation->setEndValue(QRect(Style::LeftMargin,
|
m_animation->setEndValue(QRect(Style::LeftMargin,
|
||||||
(m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2,
|
(m_letterListWid->height()-(m_letterList.size()+1)*Style::LeftLetterBtnHeight)/2,
|
||||||
Style::LeftLetterBtnHeight * 2,
|
Style::LeftLetterBtnHeight*2,
|
||||||
(m_letterList.size() + 1)*Style::LeftLetterBtnHeight));
|
(m_letterList.size()+1)*Style::LeftLetterBtnHeight));
|
||||||
m_animation->setEasingCurve(QEasingCurve::InQuart);
|
m_animation->setEasingCurve(QEasingCurve::InQuart);
|
||||||
m_animation->start();
|
m_animation->start();
|
||||||
m_letterListScrollArea->show();
|
m_letterListScrollArea->show();
|
||||||
|
@ -405,9 +405,9 @@ void FullLetterWidget::enterAnimation()
|
||||||
void FullLetterWidget::setLetterBtnGeometry()
|
void FullLetterWidget::setLetterBtnGeometry()
|
||||||
{
|
{
|
||||||
m_letterListScrollArea->setGeometry(QRect(Style::LeftMargin,
|
m_letterListScrollArea->setGeometry(QRect(Style::LeftMargin,
|
||||||
(m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2,
|
(m_letterListWid->height()-(m_letterList.size()+1)*Style::LeftLetterBtnHeight)/2,
|
||||||
Style::LeftLetterBtnHeight * 2,
|
Style::LeftLetterBtnHeight*2,
|
||||||
(m_letterList.size() + 1)*Style::LeftLetterBtnHeight));
|
(m_letterList.size()+1)*Style::LeftLetterBtnHeight));
|
||||||
m_letterListScrollArea->show();
|
m_letterListScrollArea->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,37 +415,35 @@ void FullLetterWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
m_applistWid->setFixedSize(Style::AppListWidWidth, this->height());
|
m_applistWid->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
|
m_scrollArea->setFixedSize(m_applistWid->width(),m_applistWid->height());
|
||||||
m_letterListWid->setFixedSize(Style::LeftWidWidth, this->height());
|
m_scrollAreaWid->setFixedWidth(m_scrollArea->width() - Style::SliderSize);
|
||||||
|
m_letterListWid->setFixedSize(Style::LeftWidWidth,this->height());
|
||||||
updateAppListView();
|
updateAppListView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::widgetMakeZero()
|
void FullLetterWidget::widgetMakeZero()
|
||||||
{
|
{
|
||||||
Q_FOREACH (QAbstractButton *button, m_buttonList) {
|
Q_FOREACH (QAbstractButton* button, m_buttonList) {
|
||||||
QString letterstr = button->text().at(0);
|
QString letterstr=button->text().at(0);
|
||||||
int num = m_letterList.indexOf(letterstr);
|
int num=m_letterList.indexOf(letterstr);
|
||||||
|
if(num!=-1)
|
||||||
if (num != -1) {
|
{
|
||||||
m_btnGroup->button(num)->click();
|
m_btnGroup->button(num)->click();
|
||||||
m_letterListScrollArea->verticalScrollBar()->setSliderPosition(0);
|
m_letterListScrollArea->verticalScrollBar()->setSliderPosition(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::moveScrollBar(int type)
|
void FullLetterWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
int height = Style::primaryScreenHeight;
|
int height=Style::primaryScreenHeight;
|
||||||
|
if(type==0)
|
||||||
if (type == 0) {
|
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()-height*100/1080);
|
||||||
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition() - height * 100 / 1080);
|
else
|
||||||
} else {
|
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition()+height*100/1080);
|
||||||
m_scrollArea->verticalScrollBar()->setSliderPosition(m_scrollArea->verticalScrollBar()->sliderPosition() + height * 100 / 1080);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::onSetSlider(int value)
|
void FullLetterWidget::onSetSlider(int value)
|
||||||
|
@ -454,75 +452,79 @@ void FullLetterWidget::onSetSlider(int value)
|
||||||
// {
|
// {
|
||||||
// flag = false;
|
// flag = false;
|
||||||
// time->start(100);
|
// time->start(100);
|
||||||
int curvalue = m_scrollArea->verticalScrollBar()->value();
|
int curvalue = m_scrollArea->verticalScrollBar()->value();
|
||||||
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
|
m_scrollArea->verticalScrollBar()->setValue(curvalue + value);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractButton *FullLetterWidget::getCurLetterButton(int value)
|
QAbstractButton* FullLetterWidget::getCurLetterButton(int value)
|
||||||
{
|
{
|
||||||
return m_buttonList.at(value);
|
return m_buttonList.at(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FullLetterWidget::eventFilter(QObject *watched, QEvent *event)
|
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();
|
QLayoutItem* widItem = m_scrollAreaWidLayout->itemAt(2 * m_buttonList.size() - 1);
|
||||||
FullListView *m_listview = qobject_cast<FullListView *>(wid);
|
QWidget* wid = widItem->widget();
|
||||||
QLayoutItem *widItemTop = m_scrollAreaWidLayout->itemAt(1);
|
FullListView* m_listview = qobject_cast<FullListView*>(wid);
|
||||||
QWidget *widTop = widItemTop->widget();
|
|
||||||
FullListView *m_listviewTop = qobject_cast<FullListView *>(widTop);
|
QLayoutItem* widItemTop = m_scrollAreaWidLayout->itemAt(1);
|
||||||
|
QWidget* widTop = widItemTop->widget();
|
||||||
|
FullListView* m_listviewTop = qobject_cast<FullListView*>(widTop);
|
||||||
|
|
||||||
QKeyEvent *ke = (QKeyEvent *)event;
|
QKeyEvent *ke = (QKeyEvent *)event;
|
||||||
|
if( ke->key() == Qt::Key_Tab )
|
||||||
if (ke->key() == Qt::Key_Tab) {
|
{
|
||||||
// m_letterListScrollAreaWid->setFocus();
|
// m_letterListScrollAreaWid->setFocus();
|
||||||
// m_letterListScrollArea->setFocus();
|
// m_letterListScrollArea->setFocus();
|
||||||
// return true;
|
// return true;
|
||||||
Q_EMIT setFocusToSideWin();
|
Q_EMIT setFocusToSideWin();
|
||||||
}
|
}
|
||||||
|
if(ke->key() == Qt::Key_Up)
|
||||||
if (ke->key() == Qt::Key_Up) {
|
{
|
||||||
if (!m_listviewTop->hasFocus()) {
|
if(!m_listviewTop->hasFocus())
|
||||||
QAbstractButton *buttonTop = getCurLetterButton((--m_index) % m_buttonList.size());
|
{
|
||||||
|
QAbstractButton* buttonTop = getCurLetterButton(( --m_index) % m_buttonList.size());
|
||||||
btnGroupClickedSlot(buttonTop);
|
btnGroupClickedSlot(buttonTop);
|
||||||
this->m_scrollArea->setFocusToPreChild();
|
this->m_scrollArea->setFocusToPreChild();
|
||||||
} else {
|
|
||||||
m_listview->setFocus();
|
|
||||||
QAbstractButton *button = getCurLetterButton(m_buttonList.size() - 1);
|
|
||||||
btnGroupClickedSlot(button);
|
|
||||||
m_index = m_buttonList.size() - 1;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_listview->setFocus();
|
||||||
|
QAbstractButton* button = getCurLetterButton(m_buttonList.size() - 1);
|
||||||
|
btnGroupClickedSlot(button);
|
||||||
|
m_index = m_buttonList.size() - 1;
|
||||||
|
}
|
||||||
Q_EMIT selectFirstItem();
|
Q_EMIT selectFirstItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(ke->key() == Qt::Key_Down)
|
||||||
if (ke->key() == Qt::Key_Down) {
|
{
|
||||||
if (!m_listview->hasFocus()) {
|
if(!m_listview->hasFocus())
|
||||||
QAbstractButton *button = getCurLetterButton((++m_index) % m_buttonList.size());
|
{
|
||||||
|
QAbstractButton* button = getCurLetterButton(( ++m_index) % m_buttonList.size());
|
||||||
btnGroupClickedSlot(button);
|
btnGroupClickedSlot(button);
|
||||||
this->m_scrollArea->setFocusToNextChild();
|
this->m_scrollArea->setFocusToNextChild();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_listviewTop->setFocus();
|
m_listviewTop->setFocus();
|
||||||
QAbstractButton *buttonTop = getCurLetterButton(0);
|
QAbstractButton* buttonTop = getCurLetterButton(0);
|
||||||
btnGroupClickedSlot(buttonTop);
|
btnGroupClickedSlot(buttonTop);
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT selectFirstItem();
|
Q_EMIT selectFirstItem();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return QWidget::eventFilter(watched,event);
|
||||||
return QWidget::eventFilter(watched, event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullLetterWidget::letterButtonClick()
|
void FullLetterWidget::letterButtonClick()
|
||||||
{
|
{
|
||||||
if (m_btnGroup->button(0) != nullptr) {
|
if(m_btnGroup->button(0)!=nullptr)
|
||||||
m_btnGroup->button(0)->click();
|
m_btnGroup->button(0)->click();
|
||||||
}
|
|
||||||
|
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,7 @@ LetterWidget::LetterWidget(QWidget *parent) :
|
||||||
|
|
||||||
LetterWidget::~LetterWidget()
|
LetterWidget::~LetterWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,21 +47,24 @@ LetterWidget::~LetterWidget()
|
||||||
void LetterWidget::initUi()
|
void LetterWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setAttribute(Qt::WA_StyledBackground, true);
|
this->setAttribute(Qt::WA_StyledBackground,true);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
initAppListWidget();
|
initAppListWidget();
|
||||||
m_letterBtnWid = new LetterButtonWidget(this);
|
|
||||||
|
m_letterBtnWid=new LetterButtonWidget(this);
|
||||||
m_letterBtnWid->hide();
|
m_letterBtnWid->hide();
|
||||||
connect(this, &LetterWidget::sendLetterBtnList, m_letterBtnWid, &LetterButtonWidget::recvLetterBtnList);
|
connect(this,&LetterWidget::sendLetterBtnList,m_letterBtnWid,&LetterButtonWidget::recvLetterBtnList);
|
||||||
connect(m_letterBtnWid, &LetterButtonWidget::sendLetterBtnSignal, this, &LetterWidget::recvLetterBtnSlot);
|
connect(m_letterBtnWid, &LetterButtonWidget::sendLetterBtnSignal,this,&LetterWidget::recvLetterBtnSlot);
|
||||||
m_enterAnimation = new QPropertyAnimation;
|
|
||||||
|
m_enterAnimation=new QPropertyAnimation;
|
||||||
m_enterAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
m_enterAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
||||||
m_leaveAnimation = new QPropertyAnimation;
|
m_leaveAnimation=new QPropertyAnimation;
|
||||||
m_leaveAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
m_leaveAnimation->setPropertyName(QString("geometry").toLocal8Bit());
|
||||||
connect(m_leaveAnimation, &QPropertyAnimation::finished, this, &LetterWidget::animationFinishedSLot);
|
connect(m_leaveAnimation,&QPropertyAnimation::finished,this,&LetterWidget::animationFinishedSLot);
|
||||||
connect(m_enterAnimation, &QPropertyAnimation::finished, this, &LetterWidget::animationFinishedSLot);
|
connect(m_enterAnimation,&QPropertyAnimation::finished,this,&LetterWidget::animationFinishedSLot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,13 +72,12 @@ void LetterWidget::initUi()
|
||||||
*/
|
*/
|
||||||
void LetterWidget::initAppListWidget()
|
void LetterWidget::initAppListWidget()
|
||||||
{
|
{
|
||||||
m_appListView = new ListView(this, this->width() - 6, this->height() - 6, 1);
|
m_appListView=new ListView(this,this->width()-6,this->height()-6,1);
|
||||||
m_appListView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_appListView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
fillAppListView();
|
fillAppListView();
|
||||||
connect(m_appListView, &ListView::sendItemClickedSignal, this, &LetterWidget::recvItemClickedSlot);
|
connect(m_appListView,&ListView::sendItemClickedSignal,this,&LetterWidget::recvItemClickedSlot);
|
||||||
connect(m_appListView, &ListView::sendHideMainWindowSignal, this, &LetterWidget::sendHideMainWindowSignal);
|
connect(m_appListView,&ListView::sendHideMainWindowSignal,this,&LetterWidget::sendHideMainWindowSignal);
|
||||||
connect(m_appListView, &ListView::sendMainWinActiveSignal, this, &LetterWidget::sendMainWinActiveSignal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,32 +87,27 @@ void LetterWidget::initAppListWidget()
|
||||||
void LetterWidget::fillAppListView()
|
void LetterWidget::fillAppListView()
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
int row = 0;
|
int row=0;
|
||||||
QVector<QStringList> vector = UkuiMenuInterface::alphabeticVector;
|
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);
|
QStringList appList=vector.at(i);
|
||||||
|
if(!appList.isEmpty())
|
||||||
if (!appList.isEmpty()) {
|
{
|
||||||
QString letterstr;
|
QString letterstr;
|
||||||
|
if(i<26)
|
||||||
if (i < 26) {
|
letterstr=QString(QChar(static_cast<char>(i+65)));
|
||||||
letterstr = QString(QChar(static_cast<char>(i + 65)));
|
else if(i==26)
|
||||||
} else if (i == 26) {
|
letterstr="&";
|
||||||
letterstr = "&";
|
else
|
||||||
} else {
|
letterstr="#";
|
||||||
letterstr = "#";
|
|
||||||
}
|
|
||||||
|
|
||||||
m_letterList.append(letterstr);//存储分类字符
|
m_letterList.append(letterstr);//存储分类字符
|
||||||
m_letterBtnRowList.append(QString::number(row));//存储分类字符所在行
|
m_letterBtnRowList.append(QString::number(row));//存储分类字符所在行
|
||||||
m_data.append(QStringList() << letterstr << "0");
|
m_data.append(QStringList()<<letterstr<<"0");
|
||||||
|
for(int i=0;i<appList.count();i++)
|
||||||
|
m_data.append(QStringList()<<appList.at(i)<<"1");
|
||||||
|
row+=(appList.count()+1);
|
||||||
|
|
||||||
for (int i = 0; i < appList.count(); i++) {
|
|
||||||
m_data.append(QStringList() << appList.at(i) << "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
row += (appList.count() + 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,11 +116,10 @@ void LetterWidget::fillAppListView()
|
||||||
|
|
||||||
void LetterWidget::recvItemClickedSlot(QStringList arg)
|
void LetterWidget::recvItemClickedSlot(QStringList arg)
|
||||||
{
|
{
|
||||||
if (arg.at(1).toInt() == 0) {
|
if(arg.at(1).toInt()==0)
|
||||||
appClassificationBtnClickedSlot();
|
appClassificationBtnClickedSlot();
|
||||||
} else {
|
else
|
||||||
execApplication(arg.at(0));
|
execApplication(arg.at(0));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,38 +136,32 @@ void LetterWidget::execApplication(QString desktopfp)
|
||||||
*/
|
*/
|
||||||
void LetterWidget::updateAppListView()
|
void LetterWidget::updateAppListView()
|
||||||
{
|
{
|
||||||
int row = 0;
|
int row=0;
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_letterList.clear();
|
m_letterList.clear();
|
||||||
m_letterBtnRowList.clear();
|
m_letterBtnRowList.clear();
|
||||||
QVector<QStringList> vector = UkuiMenuInterface::alphabeticVector;
|
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);
|
QStringList appList=vector.at(i);
|
||||||
|
if(!appList.isEmpty())
|
||||||
if (!appList.isEmpty()) {
|
{
|
||||||
QString letterstr;
|
QString letterstr;
|
||||||
|
if(i<26)
|
||||||
if (i < 26) {
|
letterstr=QString(QChar(static_cast<char>(i+65)));
|
||||||
letterstr = QString(QChar(static_cast<char>(i + 65)));
|
else if(i==26)
|
||||||
} else if (i == 26) {
|
letterstr="&";
|
||||||
letterstr = "&";
|
else
|
||||||
} else {
|
letterstr="#";
|
||||||
letterstr = "#";
|
|
||||||
}
|
|
||||||
|
|
||||||
m_letterList.append(letterstr);//存储分类字符
|
m_letterList.append(letterstr);//存储分类字符
|
||||||
m_letterBtnRowList.append(QString::number(row));//存储分类字符所在行
|
m_letterBtnRowList.append(QString::number(row));//存储分类字符所在行
|
||||||
m_data.append(QStringList() << letterstr << "0");
|
m_data.append(QStringList()<<letterstr<<"0");
|
||||||
|
for(int i=0;i<appList.count();i++)
|
||||||
|
m_data.append(QStringList()<<appList.at(i)<<"1");
|
||||||
|
row+=(appList.count()+1);
|
||||||
|
|
||||||
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);
|
m_appListView->updateData(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,11 +170,12 @@ void LetterWidget::updateAppListView()
|
||||||
*/
|
*/
|
||||||
void LetterWidget::appClassificationBtnClickedSlot()
|
void LetterWidget::appClassificationBtnClickedSlot()
|
||||||
{
|
{
|
||||||
m_leaveAnimation->setStartValue(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_leaveAnimation->setStartValue(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_leaveAnimation->setEndValue(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_leaveAnimation->setEndValue(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
// m_leaveAnimation->setEndValue(QRect(20,20,this->width()-40,this->height()-40));
|
// 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->setStartValue(QRect(-40,-40,this->width()+80,this->height()+80));
|
||||||
m_enterAnimation->setEndValue(QRect((this->width() - 235) / 2, (this->height() - 366) / 2, 235, 366));
|
m_enterAnimation->setEndValue(QRect((this->width()-235)/2,(this->height()-366)/2,235,366));
|
||||||
|
|
||||||
//加载LetterBUttonWidget界面
|
//加载LetterBUttonWidget界面
|
||||||
m_enterAnimation->setDuration(100);
|
m_enterAnimation->setDuration(100);
|
||||||
m_leaveAnimation->setDuration(10);
|
m_leaveAnimation->setDuration(10);
|
||||||
|
@ -195,7 +183,7 @@ void LetterWidget::appClassificationBtnClickedSlot()
|
||||||
m_leaveAnimation->setTargetObject(m_appListView);
|
m_leaveAnimation->setTargetObject(m_appListView);
|
||||||
m_enterAnimation->setTargetObject(m_letterBtnWid);
|
m_enterAnimation->setTargetObject(m_letterBtnWid);
|
||||||
m_leaveAnimation->start();
|
m_leaveAnimation->start();
|
||||||
m_widgetState = 1;
|
m_widgetState=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,38 +192,40 @@ void LetterWidget::appClassificationBtnClickedSlot()
|
||||||
void LetterWidget::recvLetterBtnSlot(QString btnname)
|
void LetterWidget::recvLetterBtnSlot(QString btnname)
|
||||||
{
|
{
|
||||||
//此处需实现将字母为btnname的应用列表移动到applistWid界面最顶端
|
//此处需实现将字母为btnname的应用列表移动到applistWid界面最顶端
|
||||||
int num = m_letterList.indexOf(QString(QChar(btnname.at(0))));
|
int num=m_letterList.indexOf(QString(QChar(btnname.at(0))));
|
||||||
|
if(num!=-1)
|
||||||
if (num != -1) {
|
{
|
||||||
int row = m_letterBtnRowList.at(num).toInt();
|
int row=m_letterBtnRowList.at(num).toInt();
|
||||||
m_appListView->verticalScrollBar()->setValue(row);
|
m_appListView->verticalScrollBar()->setValue(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_leaveAnimation->setStartValue(QRect((this->width() - 235) / 2, (this->height() - 366) / 2, 235, 366));
|
m_leaveAnimation->setStartValue(QRect((this->width()-235)/2,(this->height()-366)/2,235,366));
|
||||||
m_leaveAnimation->setEndValue(QRect(-40, -40, this->width() + 80, this->height() + 80));
|
m_leaveAnimation->setEndValue(QRect(-40,-40,this->width()+80,this->height()+80));
|
||||||
// m_enterAnimation->setStartValue(QRect(16,10,this->width()-20,this->height()-20));
|
// 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->setStartValue(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_enterAnimation->setEndValue(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_enterAnimation->setDuration(10);
|
||||||
m_leaveAnimation->setDuration(100);
|
m_leaveAnimation->setDuration(100);
|
||||||
m_leaveAnimation->setTargetObject(m_letterBtnWid);
|
m_leaveAnimation->setTargetObject(m_letterBtnWid);
|
||||||
m_enterAnimation->setTargetObject(m_appListView);
|
m_enterAnimation->setTargetObject(m_appListView);
|
||||||
m_leaveAnimation->start();
|
m_leaveAnimation->start();
|
||||||
m_widgetState = 0;
|
m_widgetState=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LetterWidget::animationFinishedSLot()
|
void LetterWidget::animationFinishedSLot()
|
||||||
{
|
{
|
||||||
if (m_widgetState == 1) {
|
if(m_widgetState==1)
|
||||||
|
{
|
||||||
m_enterAnimation->start();
|
m_enterAnimation->start();
|
||||||
m_widgetState = -1;
|
m_widgetState=-1;
|
||||||
m_appListView->hide();
|
m_appListView->hide();
|
||||||
m_letterBtnWid->show();
|
m_letterBtnWid->show();
|
||||||
}
|
}
|
||||||
|
if(m_widgetState==0)
|
||||||
if (m_widgetState == 0) {
|
{
|
||||||
m_enterAnimation->start();
|
m_enterAnimation->start();
|
||||||
m_widgetState = -1;
|
m_widgetState=-1;
|
||||||
m_letterBtnWid->hide();
|
m_letterBtnWid->hide();
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
}
|
}
|
||||||
|
@ -244,24 +234,23 @@ void LetterWidget::animationFinishedSLot()
|
||||||
void LetterWidget::widgetMakeZero()
|
void LetterWidget::widgetMakeZero()
|
||||||
{
|
{
|
||||||
m_letterBtnWid->hide();
|
m_letterBtnWid->hide();
|
||||||
m_appListView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_appListView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
m_appListView->verticalScrollBar()->setValue(0);
|
m_appListView->verticalScrollBar()->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LetterWidget::moveScrollBar(int type)
|
void LetterWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
if (type == 0) {
|
if(type==0)
|
||||||
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition() - 100);
|
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()-100);
|
||||||
} else {
|
else
|
||||||
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition() + 100);
|
m_appListView->verticalScrollBar()->setSliderPosition(m_appListView->verticalScrollBar()->sliderPosition()+100);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LetterWidget::repaintWidget()
|
void LetterWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_appListView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_appListView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_appListView->show();
|
m_appListView->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,6 @@ Q_SIGNALS:
|
||||||
* @brief Send a hidden main window signal to the MainViewWidget
|
* @brief Send a hidden main window signal to the MainViewWidget
|
||||||
*/
|
*/
|
||||||
void sendHideMainWindowSignal();
|
void sendHideMainWindowSignal();
|
||||||
void sendMainWinActiveSignal(bool flag);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LETTERWIDGET_H
|
#endif // LETTERWIDGET_H
|
||||||
|
|
|
@ -23,40 +23,44 @@
|
||||||
|
|
||||||
DirectoryChangedThread::DirectoryChangedThread()
|
DirectoryChangedThread::DirectoryChangedThread()
|
||||||
{
|
{
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryChangedThread::~DirectoryChangedThread()
|
DirectoryChangedThread::~DirectoryChangedThread()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoryChangedThread::run()
|
void DirectoryChangedThread::run()
|
||||||
{
|
{
|
||||||
closeDataBase("DirectoryChangedThread");
|
closeDataBase("DirectoryChangedThread");
|
||||||
openDataBase("DirectoryChangedThread");
|
openDataBase("DirectoryChangedThread");
|
||||||
QStringList desktopfpList = m_ukuiMenuInterface->getDesktopFilePath();
|
QStringList desktopfpList=m_ukuiMenuInterface->getDesktopFilePath();
|
||||||
|
if(desktopfpList.size() >= UkuiMenuInterface::desktopfpVector.size())//有新的应用安装
|
||||||
if (desktopfpList.size() >= UkuiMenuInterface::desktopfpVector.size()) { //有新的应用安装
|
{
|
||||||
for (int i = 0; i < desktopfpList.count(); i++) {
|
for(int i=0;i<desktopfpList.count();i++)
|
||||||
if (!UkuiMenuInterface::desktopfpVector.contains(desktopfpList.at(i))) {
|
{
|
||||||
|
if(!UkuiMenuInterface::desktopfpVector.contains(desktopfpList.at(i)))
|
||||||
|
{
|
||||||
QFileInfo fileInfo(desktopfpList.at(i));
|
QFileInfo fileInfo(desktopfpList.at(i));
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
updateDataBaseTableRecent(desktopfn);
|
updateDataBaseTableRecent(desktopfn);
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else { //软件卸载
|
}
|
||||||
for (int i = 0; i < UkuiMenuInterface::desktopfpVector.size(); i++) {
|
else//软件卸载
|
||||||
if (!desktopfpList.contains(UkuiMenuInterface::desktopfpVector.at(i))) {
|
{
|
||||||
QString desktopfp = UkuiMenuInterface::appInfoVector.at(i).at(0);
|
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);
|
QFileInfo fileInfo(desktopfp);
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
deleteAppRecord(desktopfn);
|
deleteAppRecord(desktopfn);
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +68,8 @@ void DirectoryChangedThread::run()
|
||||||
UkuiMenuInterface::appInfoVector.clear();
|
UkuiMenuInterface::appInfoVector.clear();
|
||||||
UkuiMenuInterface::alphabeticVector.clear();
|
UkuiMenuInterface::alphabeticVector.clear();
|
||||||
UkuiMenuInterface::functionalVector.clear();
|
UkuiMenuInterface::functionalVector.clear();
|
||||||
UkuiMenuInterface::appInfoVector = m_ukuiMenuInterface->createAppInfoVector();
|
UkuiMenuInterface::appInfoVector=m_ukuiMenuInterface->createAppInfoVector();
|
||||||
UkuiMenuInterface::alphabeticVector = m_ukuiMenuInterface->getAlphabeticClassification();
|
UkuiMenuInterface::alphabeticVector=m_ukuiMenuInterface->getAlphabeticClassification();
|
||||||
UkuiMenuInterface::functionalVector = m_ukuiMenuInterface->getFunctionalClassification();
|
UkuiMenuInterface::functionalVector=m_ukuiMenuInterface->getFunctionalClassification();
|
||||||
Q_EMIT requestUpdateSignal();
|
Q_EMIT requestUpdateSignal();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,23 +40,9 @@
|
||||||
#include "src/SearchResultWidget/fullsearchresultwidget.h"
|
#include "src/SearchResultWidget/fullsearchresultwidget.h"
|
||||||
#include "src/SearchResultWidget/searchresultwidget.h"
|
#include "src/SearchResultWidget/searchresultwidget.h"
|
||||||
#include "src/SearchResultWidget/searchappthread.h"
|
#include "src/SearchResultWidget/searchappthread.h"
|
||||||
#include "src/UtilityFunction/convertdesktoptowinid.h"
|
|
||||||
#include "directorychangedthread.h"
|
#include "directorychangedthread.h"
|
||||||
#include "src/Style/style.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
|
class MainViewWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -88,6 +74,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief changeFocuUp
|
* @brief changeFocuUp
|
||||||
*/
|
*/
|
||||||
|
void repaintFullWidget();
|
||||||
void changeFocuUp();
|
void changeFocuUp();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,8 +92,6 @@ public:
|
||||||
|
|
||||||
void resetQueryLine();
|
void resetQueryLine();
|
||||||
|
|
||||||
MyLineEdit* getQueryLineEditer() {return m_queryLineEdit;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface=nullptr;
|
UkuiMenuInterface *m_ukuiMenuInterface=nullptr;
|
||||||
QWidget *m_topWidget=nullptr;
|
QWidget *m_topWidget=nullptr;
|
||||||
|
@ -114,7 +99,7 @@ private:
|
||||||
|
|
||||||
QWidget *m_contentWid=nullptr;
|
QWidget *m_contentWid=nullptr;
|
||||||
|
|
||||||
MyLineEdit *m_queryLineEdit=nullptr;
|
QLineEdit *m_queryLineEdit=nullptr;
|
||||||
QWidget *m_queryWid=nullptr;
|
QWidget *m_queryWid=nullptr;
|
||||||
QLabel *m_queryIcon=nullptr;
|
QLabel *m_queryIcon=nullptr;
|
||||||
QLabel *m_queryText=nullptr;
|
QLabel *m_queryText=nullptr;
|
||||||
|
@ -251,8 +236,6 @@ Q_SIGNALS:
|
||||||
*/
|
*/
|
||||||
void sendHideMainWindowSignal();
|
void sendHideMainWindowSignal();
|
||||||
|
|
||||||
void sendMainWinActiveSignal(bool flag);
|
|
||||||
|
|
||||||
void setFocusToSideWin();
|
void setFocusToSideWin();
|
||||||
|
|
||||||
void selectFirstItem();
|
void selectFirstItem();
|
||||||
|
@ -260,8 +243,6 @@ Q_SIGNALS:
|
||||||
void selectFirstItemTab();
|
void selectFirstItemTab();
|
||||||
|
|
||||||
void setSlideBar(int value);
|
void setSlideBar(int value);
|
||||||
|
|
||||||
void setMainWinHideSignal();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINVIEWWIDGET_H
|
#endif // MAINVIEWWIDGET_H
|
||||||
|
|
|
@ -29,69 +29,63 @@
|
||||||
#include <QJsonParseError>
|
#include <QJsonParseError>
|
||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
#include "src/Style/style.h"
|
#include "src/Style/style.h"
|
||||||
#include "src/UtilityFunction/utility.h"
|
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent)
|
QMainWindow(parent)
|
||||||
{
|
{
|
||||||
getCurrentCPU();
|
|
||||||
openDataBase("MainThread");
|
openDataBase("MainThread");
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
UkuiMenuInterface::appInfoVector = m_ukuiMenuInterface->createAppInfoVector();
|
UkuiMenuInterface::appInfoVector=m_ukuiMenuInterface->createAppInfoVector();
|
||||||
initDatabase();
|
initDatabase();
|
||||||
UkuiMenuInterface::alphabeticVector = m_ukuiMenuInterface->getAlphabeticClassification();
|
UkuiMenuInterface::alphabeticVector=m_ukuiMenuInterface->getAlphabeticClassification();
|
||||||
UkuiMenuInterface::functionalVector = m_ukuiMenuInterface->getFunctionalClassification();
|
UkuiMenuInterface::functionalVector=m_ukuiMenuInterface->getFunctionalClassification();
|
||||||
UkuiMenuInterface::allAppVector = m_ukuiMenuInterface->getAllClassification();
|
UkuiMenuInterface::allAppVector=m_ukuiMenuInterface->getAllClassification();
|
||||||
|
|
||||||
Style::initWidStyle();
|
Style::initWidStyle();
|
||||||
initUi();
|
initUi();
|
||||||
m_dbus = new DBus;
|
|
||||||
|
|
||||||
|
m_dbus=new DBus;
|
||||||
new MenuAdaptor(m_dbus);
|
new MenuAdaptor(m_dbus);
|
||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con=QDBusConnection::sessionBus();
|
||||||
|
if(!con.registerService("org.ukui.menu") ||
|
||||||
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();
|
qDebug()<<"error:"<<con.lastError().message();
|
||||||
}
|
}
|
||||||
|
connect(m_dbus,&DBus::sendReloadSignal,this,[=]
|
||||||
connect(m_dbus, &DBus::sendReloadSignal, this, [ = ] {
|
{
|
||||||
UkuiMenuInterface::appInfoVector.clear();
|
UkuiMenuInterface::appInfoVector.clear();
|
||||||
UkuiMenuInterface::alphabeticVector.clear();
|
UkuiMenuInterface::alphabeticVector.clear();
|
||||||
UkuiMenuInterface::functionalVector.clear();
|
UkuiMenuInterface::functionalVector.clear();
|
||||||
UkuiMenuInterface::appInfoVector = m_ukuiMenuInterface->createAppInfoVector();
|
UkuiMenuInterface::appInfoVector=m_ukuiMenuInterface->createAppInfoVector();
|
||||||
UkuiMenuInterface::alphabeticVector = m_ukuiMenuInterface->getAlphabeticClassification();
|
UkuiMenuInterface::alphabeticVector=m_ukuiMenuInterface->getAlphabeticClassification();
|
||||||
UkuiMenuInterface::functionalVector = m_ukuiMenuInterface->getFunctionalClassification();
|
UkuiMenuInterface::functionalVector=m_ukuiMenuInterface->getFunctionalClassification();
|
||||||
Q_EMIT m_mainViewWid->reloadUkuiMenu();
|
Q_EMIT m_mainViewWid->reloadUkuiMenu();
|
||||||
});
|
});
|
||||||
connect(m_dbus, &DBus::winKeyResponseSignal, this, [ = ] {
|
|
||||||
if (QGSettings::isSchemaInstalled(QString("org.ukui.session").toLocal8Bit()))
|
connect(m_dbus,&DBus::winKeyResponseSignal,this,[=]{
|
||||||
|
if(QGSettings::isSchemaInstalled(QString("org.ukui.session").toLocal8Bit()))
|
||||||
{
|
{
|
||||||
QGSettings gsetting(QString("org.ukui.session").toLocal8Bit());
|
QGSettings gsetting(QString("org.ukui.session").toLocal8Bit());
|
||||||
|
if(gsetting.keys().contains("win-key-release"))
|
||||||
// if(gsetting.keys().contains("win-key-release"))
|
if(gsetting.get("win-key-release").toBool())
|
||||||
// if(gsetting.get("win-key-release").toBool())
|
|
||||||
// return;
|
|
||||||
if (gsetting.keys().contains("winKeyRelease"))
|
|
||||||
if (gsetting.get("winKeyRelease").toBool()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (QGSettings::isSchemaInstalled(QString("org.ukui.screenshot").toLocal8Bit()))
|
if(QGSettings::isSchemaInstalled(QString("org.ukui.screenshot").toLocal8Bit()))
|
||||||
{
|
{
|
||||||
QGSettings gsetting(QString("org.ukui.screenshot").toLocal8Bit());
|
QGSettings gsetting(QString("org.ukui.screenshot").toLocal8Bit());
|
||||||
|
if(gsetting.keys().contains("isrunning"))
|
||||||
if (gsetting.keys().contains("isrunning"))
|
if(gsetting.get("isrunning").toBool())
|
||||||
if (gsetting.get("isrunning").toBool()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->isVisible())
|
if(this->isVisible())
|
||||||
{
|
{
|
||||||
this->hide();
|
this->hide();
|
||||||
} else
|
}
|
||||||
{
|
else{
|
||||||
this->loadMainWindow();
|
this->loadMainWindow();
|
||||||
this->show();
|
this->show();
|
||||||
this->raise();
|
this->raise();
|
||||||
|
@ -104,11 +98,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
closeDataBase("MainThread");
|
closeDataBase("MainThread");
|
||||||
|
delete m_ukuiMenuInterface;
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::initUi()
|
void MainWindow::initUi()
|
||||||
|
@ -117,115 +107,101 @@ void MainWindow::initUi()
|
||||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
this->setAutoFillBackground(false);
|
this->setAutoFillBackground(false);
|
||||||
this->setFocusPolicy(Qt::NoFocus);
|
this->setFocusPolicy(Qt::NoFocus);
|
||||||
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
|
||||||
this->setMinimumSize(Style::minw, Style::minh);
|
this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||||
this->setContentsMargins(0, 0, 0, 0);
|
this->setMinimumSize(Style::minw,Style::minh);
|
||||||
// this->setFocus();
|
this->setContentsMargins(0,0,0,0);
|
||||||
m_frame = new QFrame;
|
m_frame=new QFrame;
|
||||||
m_mainViewWid = new MainViewWidget;
|
m_mainViewWid=new MainViewWidget;
|
||||||
m_sideBarWid = new SideBarWidget;
|
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);
|
this->setCentralWidget(m_frame);
|
||||||
QHBoxLayout *mainlayout = new QHBoxLayout;
|
QHBoxLayout *mainlayout=new QHBoxLayout;
|
||||||
mainlayout->setContentsMargins(0, 0, 0, 0);
|
mainlayout->setContentsMargins(0,0,0,0);
|
||||||
mainlayout->setSpacing(0);
|
mainlayout->setSpacing(0);
|
||||||
m_frame->setLayout(mainlayout);
|
m_frame->setLayout(mainlayout);
|
||||||
|
|
||||||
mainlayout->addWidget(m_mainViewWid);
|
mainlayout->addWidget(m_mainViewWid);
|
||||||
m_line = new QFrame;
|
m_line=new QFrame;
|
||||||
m_line->installEventFilter(this);
|
m_line->installEventFilter(this);
|
||||||
m_line->setFrameShape(QFrame::VLine);
|
m_line->setFrameShape(QFrame::VLine);
|
||||||
m_line->setFixedSize(1, this->height() - 1);
|
m_line->setFixedSize(1,this->height()-1);
|
||||||
m_line->setEnabled(false);
|
m_line->setEnabled(false);
|
||||||
mainlayout->addWidget(m_line);
|
mainlayout->addWidget(m_line);
|
||||||
mainlayout->addWidget(m_sideBarWid);
|
mainlayout->addWidget(m_sideBarWid);
|
||||||
m_sideBarWid->loadMinSidebar();
|
m_sideBarWid->loadMinSidebar();
|
||||||
m_mainViewWid->loadMinMainView();
|
m_mainViewWid->loadMinMainView();
|
||||||
|
|
||||||
|
|
||||||
m_animation = new QPropertyAnimation(this, "geometry");
|
m_animation = new QPropertyAnimation(this, "geometry");
|
||||||
connect(m_animation, &QPropertyAnimation::finished, this, &MainWindow::animationValueFinishedSlot);
|
connect(m_animation,&QPropertyAnimation::finished,this,&MainWindow::animationValueFinishedSlot);
|
||||||
|
|
||||||
connect(m_sideBarWid, &SideBarWidget::setFocusToMainWin, m_mainViewWid, &MainViewWidget::selectFirstItemTab);
|
connect(m_sideBarWid, &SideBarWidget::setFocusToMainWin, m_mainViewWid, &MainViewWidget::selectFirstItemTab);
|
||||||
connect(m_sideBarWid, &SideBarWidget::sendCommonUseBtnSignal, m_mainViewWid, &MainViewWidget::loadCommonUseWidget);
|
connect(m_sideBarWid, &SideBarWidget::sendCommonUseBtnSignal, m_mainViewWid, &MainViewWidget::loadCommonUseWidget);
|
||||||
connect(m_sideBarWid, &SideBarWidget::sendLetterBtnSignal, m_mainViewWid, &MainViewWidget::loadLetterWidget);
|
connect(m_sideBarWid,&SideBarWidget::sendLetterBtnSignal, m_mainViewWid, &MainViewWidget::loadLetterWidget);
|
||||||
connect(m_sideBarWid, &SideBarWidget::sendFunctionBtnSignal, m_mainViewWid, &MainViewWidget::loadFunctionWidget);
|
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(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(QApplication::desktop(),&QDesktopWidget::resized,this, [=]{
|
connect(QApplication::desktop(),&QDesktopWidget::resized,this, [=]{
|
||||||
repaintWidget();
|
primaryScreenChangeSlot();
|
||||||
});
|
});
|
||||||
connect(QApplication::desktop(),&QDesktopWidget::primaryScreenChanged,this,[=]{
|
connect(QApplication::desktop(),&QDesktopWidget::primaryScreenChanged,this,[=]{
|
||||||
repaintWidget();
|
primaryScreenChangeSlot();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(QApplication::desktop(),&QDesktopWidget::screenCountChanged,this,[=]{
|
connect(QApplication::desktop(),&QDesktopWidget::screenCountChanged,this,[=]{
|
||||||
repaintWidget();
|
primaryScreenChangeSlot();
|
||||||
});
|
});
|
||||||
QDBusConnection::sessionBus().connect(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE, QString("PanelGeometryRefresh"), this, SLOT(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) {
|
QGSettings* m_gsetting=new QGSettings(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit());
|
||||||
if (key == "scalingFactor") {
|
connect(m_gsetting,&QGSettings::changed,this,[=](const QString &key)
|
||||||
|
{
|
||||||
|
if(key=="scalingFactor")
|
||||||
repaintWidget();
|
repaintWidget();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit())) {
|
if (QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit())) {
|
||||||
QGSettings *gsetting = new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
|
QGSettings *psetting = new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit(), QByteArray(), this);
|
||||||
connect(gsetting, &QGSettings::changed,
|
connect(psetting, &QGSettings::changed,
|
||||||
this, &MainWindow::panelChangedSlot);
|
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)
|
void MainWindow::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
double transparency = getTransparency();
|
double transparency=getTransparency();
|
||||||
|
|
||||||
QRect rect = this->rect();
|
QRect rect = this->rect();
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
painter.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||||
painter.setPen(Qt::transparent);
|
painter.setPen(Qt::transparent);
|
||||||
|
if(!m_isFullScreen)
|
||||||
if (!m_isFullScreen) {
|
{
|
||||||
qreal radius = 6;
|
qreal radius=6;
|
||||||
path.moveTo(rect.topRight() - QPointF(radius, 0));
|
path.moveTo(rect.topRight() - QPointF(radius, 0));
|
||||||
path.lineTo(rect.topLeft() + QPointF(radius, 0));
|
path.lineTo(rect.topLeft() + QPointF(radius, 0));
|
||||||
path.quadTo(rect.topLeft(), rect.topLeft() + QPointF(0, radius));
|
path.quadTo(rect.topLeft(), rect.topLeft() + QPointF(0, radius));
|
||||||
|
@ -235,13 +211,17 @@ void MainWindow::paintEvent(QPaintEvent *event)
|
||||||
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
|
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
|
||||||
path.lineTo(rect.topRight() + QPointF(0, radius));
|
path.lineTo(rect.topRight() + QPointF(0, radius));
|
||||||
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
|
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
|
||||||
|
|
||||||
painter.setBrush(this->palette().base());
|
painter.setBrush(this->palette().base());
|
||||||
painter.setPen(Qt::transparent);
|
painter.setPen(Qt::transparent);
|
||||||
painter.setOpacity(transparency);
|
painter.setOpacity(transparency);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
|
|
||||||
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
||||||
KWindowEffects::enableBlurBehind(this->winId(), true, 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()))
|
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
|
||||||
// {
|
// {
|
||||||
// QGSettings gsetting(QString("org.ukui.control-center.personalise").toLocal8Bit());
|
// QGSettings gsetting(QString("org.ukui.control-center.personalise").toLocal8Bit());
|
||||||
|
@ -272,16 +252,16 @@ void MainWindow::paintEvent(QPaintEvent *event)
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
painter.setBrush(this->palette().base());
|
painter.setBrush(this->palette().base());
|
||||||
painter.setPen(Qt::transparent);
|
painter.setPen(Qt::transparent);
|
||||||
painter.setOpacity(transparency);
|
painter.setOpacity(transparency);
|
||||||
painter.drawRect(this->rect());
|
painter.drawRect(this->rect());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addRect(this->rect());
|
path.addRect(this->rect());
|
||||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
|
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QMainWindow::paintEvent(event);
|
QMainWindow::paintEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,31 +270,24 @@ void MainWindow::paintEvent(QPaintEvent *event)
|
||||||
*/
|
*/
|
||||||
void MainWindow::showFullScreenWidget()
|
void MainWindow::showFullScreenWidget()
|
||||||
{
|
{
|
||||||
QRect availableGeometry = getScreenAvailableGeometry();
|
|
||||||
m_isFullScreen = true;
|
m_isFullScreen = true;
|
||||||
this->setContentsMargins(0, 0, 0, 0);
|
this->setContentsMargins(0, 0, 0, 0);
|
||||||
int position = Style::panelPosition;
|
int position = Style::panelPosition;
|
||||||
int panelSize = Style::panelSize;
|
|
||||||
int x = Style::primaryScreenX;
|
int x = Style::primaryScreenX;
|
||||||
int y = Style::primaryScreenY;
|
int y = Style::primaryScreenY;
|
||||||
// int width = Style::primaryScreenWidth;
|
int width = Style::widthavailable;
|
||||||
// int height = Style::primaryScreenHeight;
|
int height = Style::heightavailable;
|
||||||
QRect startRect;
|
QRect startRect;
|
||||||
QRect endRect;
|
QRect endRect;
|
||||||
|
|
||||||
if (position == 0) {
|
if (position == BOTTOM) {
|
||||||
startRect.setRect(x + 4, y + availableGeometry.height() - Style::minh - 3, Style::minw, Style::minh);
|
startRect.setRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh);
|
||||||
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
|
} else if (position == RIGHT) {
|
||||||
} else if (position == 1) {
|
startRect.setRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh);
|
||||||
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());
|
|
||||||
} else {
|
} else {
|
||||||
startRect.setRect(x + availableGeometry.width() - Style::minw - 4, y + 4, Style::minw, Style::minh);
|
startRect.setRect(x + 4, y + 4, Style::minw, Style::minh);
|
||||||
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
|
|
||||||
}
|
}
|
||||||
|
endRect.setRect(x, y, width, height);
|
||||||
|
|
||||||
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
|
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
|
||||||
m_mainViewWid->setParent(nullptr);
|
m_mainViewWid->setParent(nullptr);
|
||||||
|
@ -323,32 +296,17 @@ void MainWindow::showFullScreenWidget()
|
||||||
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
|
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
|
||||||
m_sideBarWid->setParent(nullptr);
|
m_sideBarWid->setParent(nullptr);
|
||||||
|
|
||||||
if (isPANGU || isHuaWeiPC) {
|
m_animation->setDuration(100);//动画总时间
|
||||||
is_repaint = false;
|
m_animation->setStartValue(startRect);
|
||||||
this->hide();
|
m_animation->setEndValue(endRect);
|
||||||
QEventLoop loop;
|
m_animation->setEasingCurve(QEasingCurve::Linear);
|
||||||
QTimer::singleShot(150, &loop, SLOT(quit()));
|
m_animation->start();
|
||||||
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)
|
void MainWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (m_isFullScreen && event->button() == Qt::LeftButton) {
|
if(m_isFullScreen && event->button()==Qt::LeftButton)
|
||||||
|
{
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,30 +316,23 @@ void MainWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||||
*/
|
*/
|
||||||
void MainWindow::showDefaultWidget()
|
void MainWindow::showDefaultWidget()
|
||||||
{
|
{
|
||||||
QRect availableGeometry = getScreenAvailableGeometry();
|
|
||||||
m_isFullScreen = false;
|
m_isFullScreen = false;
|
||||||
this->setContentsMargins(0, 0, 0, 0);
|
this->setContentsMargins(0, 0, 0, 0);
|
||||||
int position = Style::panelPosition;
|
int position = Style::panelPosition;
|
||||||
int panelSize = Style::panelSize;
|
|
||||||
int x = Style::primaryScreenX;
|
int x = Style::primaryScreenX;
|
||||||
int y = Style::primaryScreenY;
|
int y = Style::primaryScreenY;
|
||||||
int width = Style::primaryScreenWidth;
|
int width = Style::widthavailable;
|
||||||
int height = Style::primaryScreenHeight;
|
int height = Style::heightavailable;
|
||||||
QRect startRect;
|
QRect startRect;
|
||||||
QRect endRect;
|
QRect endRect;
|
||||||
|
|
||||||
if (position == 0) {
|
startRect.setRect(x, y, width, height);
|
||||||
endRect.setRect(x + 4, y + availableGeometry.height() - Style::minh - 3, Style::minw, Style::minh);
|
if (position == BOTTOM) {
|
||||||
startRect.setRect(x, y, width, height - panelSize);
|
endRect.setRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh);
|
||||||
} else if (position == 1) {
|
} else if (position == RIGHT) {
|
||||||
endRect.setRect(x + 4, y + panelSize + 4, Style::minw, Style::minh);
|
endRect.setRect(x + width - Style::minw - 4, y + 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);
|
|
||||||
} else {
|
} else {
|
||||||
endRect.setRect(x + availableGeometry.width() - Style::minw - 4, y + 4, Style::minw, Style::minh);
|
endRect.setRect(x + 4, y + 4, Style::minw, Style::minh);
|
||||||
startRect.setRect(x, y, width - panelSize, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
|
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
|
||||||
|
@ -389,21 +340,17 @@ void MainWindow::showDefaultWidget()
|
||||||
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
|
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
|
||||||
m_sideBarWid->setParent(nullptr);
|
m_sideBarWid->setParent(nullptr);
|
||||||
|
|
||||||
if (isPANGU || isHuaWeiPC) {
|
m_animation->setDuration(100);//动画总时间
|
||||||
this->setGeometry(endRect);
|
m_animation->setStartValue(startRect);
|
||||||
animationValueFinishedSlot();
|
m_animation->setEndValue(endRect);
|
||||||
} else {
|
m_animation->setEasingCurve(QEasingCurve::Linear);
|
||||||
m_animation->setDuration(100);//动画总时间
|
m_animation->start();
|
||||||
m_animation->setStartValue(startRect);
|
|
||||||
m_animation->setEndValue(endRect);
|
|
||||||
m_animation->setEasingCurve(QEasingCurve::Linear);
|
|
||||||
m_animation->start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::animationValueChangedSlot(const QVariant &value)
|
void MainWindow::animationValueChangedSlot(const QVariant &value)
|
||||||
{
|
{
|
||||||
if (m_isFullScreen) {
|
if(m_isFullScreen)
|
||||||
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addRect(this->rect());
|
path.addRect(this->rect());
|
||||||
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
// setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
|
||||||
|
@ -413,91 +360,71 @@ void MainWindow::animationValueChangedSlot(const QVariant &value)
|
||||||
|
|
||||||
void MainWindow::animationValueFinishedSlot()
|
void MainWindow::animationValueFinishedSlot()
|
||||||
{
|
{
|
||||||
if (m_isFullScreen) {
|
if(m_isFullScreen)
|
||||||
|
{
|
||||||
this->centralWidget()->layout()->addWidget(m_mainViewWid);
|
this->centralWidget()->layout()->addWidget(m_mainViewWid);
|
||||||
this->centralWidget()->layout()->addWidget(m_sideBarWid);
|
this->centralWidget()->layout()->addWidget(m_sideBarWid);
|
||||||
m_sideBarWid->loadMaxSidebar();
|
m_sideBarWid->loadMaxSidebar();
|
||||||
m_mainViewWid->loadMaxMainView();
|
m_mainViewWid->loadMaxMainView();
|
||||||
m_sideBarWid->enterAnimation();
|
m_sideBarWid->enterAnimation();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->centralWidget()->layout()->addWidget(m_mainViewWid);
|
this->centralWidget()->layout()->addWidget(m_mainViewWid);
|
||||||
this->centralWidget()->layout()->addWidget(m_line);
|
this->centralWidget()->layout()->addWidget(m_line);
|
||||||
this->centralWidget()->layout()->addWidget(m_sideBarWid);
|
this->centralWidget()->layout()->addWidget(m_sideBarWid);
|
||||||
m_sideBarWid->loadMinSidebar();
|
m_sideBarWid->loadMinSidebar();
|
||||||
m_mainViewWid->loadMinMainView();
|
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)
|
void MainWindow::activeWindowSolt(bool flag)
|
||||||
{
|
{
|
||||||
// qDebug() << "void MainWindow::activeWindowSolt(bool flag)";
|
// qDebug() << "void MainWindow::activeWindowSolt(bool flag)";
|
||||||
if (isPANGU || isHuaWeiPC) {
|
QTimer::singleShot(30,this, SLOT(mainWinShowSlot()));
|
||||||
QTimer::singleShot(50, this, SLOT(mainWinShowSlot()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::mainWinShowSlot()
|
void MainWindow::mainWinShowSlot()
|
||||||
{
|
{
|
||||||
this->activateWindow();
|
this->activateWindow();
|
||||||
|
qDebug() << "void MainWindow::activeWindowSolt()";
|
||||||
if (!this->geometry().contains(QCursor::pos())) {
|
|
||||||
this->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "void MainWindow::activeWindowSolt()";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 鼠标点击窗口外部事件
|
* 鼠标点击窗口外部事件
|
||||||
*/
|
*/
|
||||||
bool MainWindow::event(QEvent *event)
|
bool MainWindow::event ( QEvent * event )
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::ActivationChange && is_repaint)
|
if (event->type() == QEvent::ActivationChange)
|
||||||
// if(QEvent::WindowDeactivate == event->type() && m_canHide)//窗口停用
|
// if(QEvent::WindowDeactivate == event->type() && m_canHide)//窗口停用
|
||||||
{
|
{
|
||||||
qDebug() << " * 鼠标点击窗口外部事件";
|
qDebug() << " * 鼠标点击窗口外部事件";
|
||||||
|
if(QApplication::activeWindow() != this)
|
||||||
if (QApplication::activeWindow() != this) {
|
{
|
||||||
this->hide();
|
this->hide();
|
||||||
m_mainViewWid->widgetMakeZero();
|
m_mainViewWid->widgetMakeZero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type() == QEvent::KeyPress) {
|
|
||||||
QKeyEvent *keyEvent = (QKeyEvent *) event;
|
|
||||||
|
|
||||||
|
if (event->type() == QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
QKeyEvent *keyEvent = (QKeyEvent *) event;
|
||||||
// if (keyEvent->key() == Qt::Key_Tab)
|
// if (keyEvent->key() == Qt::Key_Tab)
|
||||||
// {
|
// {
|
||||||
// m_mainViewWid->setFocus();
|
// m_mainViewWid->setFocus();
|
||||||
// Q_EMIT setFocusSignal();
|
// Q_EMIT setFocusSignal();
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
if (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down ||
|
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_Left || keyEvent->key() == Qt::Key_Right ||
|
||||||
keyEvent->key() == Qt::Key_Tab) {
|
keyEvent->key() == Qt::Key_Tab)
|
||||||
m_mainViewWid->setFocus();
|
{
|
||||||
Q_EMIT setFocusSignal();
|
m_mainViewWid->setFocus();
|
||||||
// return true;
|
Q_EMIT setFocusSignal();
|
||||||
}
|
// return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (event->type() == QEvent::FocusIn) {
|
return QWidget::event(event);
|
||||||
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()
|
void MainWindow::loadMainWindow()
|
||||||
{
|
{
|
||||||
cleanTimeoutApp();
|
cleanTimeoutApp();
|
||||||
QRect availableGeometry = getScreenAvailableGeometry();
|
|
||||||
int position = Style::panelPosition;
|
int position = Style::panelPosition;
|
||||||
int panelSize = Style::panelSize;
|
|
||||||
int x = Style::primaryScreenX;
|
int x = Style::primaryScreenX;
|
||||||
int y = Style::primaryScreenY;
|
int y = Style::primaryScreenY;
|
||||||
int width = Style::primaryScreenWidth;
|
int width = Style::widthavailable;
|
||||||
int height = Style::primaryScreenHeight;
|
int height = Style::heightavailable;
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
|
|
||||||
if (m_isFullScreen) {
|
if (m_isFullScreen) {
|
||||||
|
@ -527,19 +453,14 @@ void MainWindow::loadMainWindow()
|
||||||
QRect startRect;
|
QRect startRect;
|
||||||
QRect endRect;
|
QRect endRect;
|
||||||
|
|
||||||
if (position == 0) {
|
if (position == BOTTOM) {
|
||||||
startRect.setRect(x + 4, y + availableGeometry.height() - Style::minh - 3, Style::minw, Style::minh);
|
startRect.setRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh);
|
||||||
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
|
} else if (position == RIGHT) {
|
||||||
} else if (position == 1) {
|
startRect.setRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh);
|
||||||
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());
|
|
||||||
} else {
|
} else {
|
||||||
startRect.setRect(x + availableGeometry.width() - Style::minw - 4, y + 4, Style::minw, Style::minh);
|
startRect.setRect(x + 4, y + 4, Style::minw, Style::minh);
|
||||||
endRect.setRect(x, y, availableGeometry.width(), availableGeometry.height());
|
|
||||||
}
|
}
|
||||||
|
endRect.setRect(x, y, width, height);
|
||||||
|
|
||||||
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
|
this->centralWidget()->layout()->removeWidget(m_mainViewWid);
|
||||||
m_mainViewWid->setParent(nullptr);
|
m_mainViewWid->setParent(nullptr);
|
||||||
|
@ -547,156 +468,92 @@ void MainWindow::loadMainWindow()
|
||||||
m_line->setParent(nullptr);
|
m_line->setParent(nullptr);
|
||||||
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
|
this->centralWidget()->layout()->removeWidget(m_sideBarWid);
|
||||||
m_sideBarWid->setParent(nullptr);
|
m_sideBarWid->setParent(nullptr);
|
||||||
// m_sideBarWid->clearFocus();
|
|
||||||
// m_mainViewWid->clearFocus();
|
|
||||||
m_animation->setDuration(1);//动画总时间
|
m_animation->setDuration(1);//动画总时间
|
||||||
m_animation->setStartValue(startRect);
|
m_animation->setStartValue(startRect);
|
||||||
m_animation->setEndValue(endRect);
|
m_animation->setEndValue(endRect);
|
||||||
m_animation->setEasingCurve(QEasingCurve::Linear);
|
m_animation->setEasingCurve(QEasingCurve::Linear);
|
||||||
m_animation->start();
|
m_animation->start();
|
||||||
} else {
|
} else {
|
||||||
// QGSettings* setting1 = new QGSettings(QString("org.ukui.SettingsDaemon.plugins.xsettings").toLocal8Bit());
|
if (position == BOTTOM) {
|
||||||
// QString value1 = setting1->get("scaling-factor").toString();
|
this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh));
|
||||||
// double scaling = value1.toDouble();
|
} else if (position == RIGHT) {
|
||||||
qDebug() << "availableGeometry.height();" << availableGeometry.height();
|
this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh));
|
||||||
|
} else {
|
||||||
if (position == 0)
|
this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh));
|
||||||
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));
|
|
||||||
|
|
||||||
m_sideBarWid->loadMinSidebar();
|
m_sideBarWid->loadMinSidebar();
|
||||||
m_mainViewWid->loadMinMainView();
|
m_mainViewWid->loadMinMainView();
|
||||||
m_mainViewWid->getQueryLineEditer()->setFocus();
|
|
||||||
QTimer::singleShot(1, this, [ = ]() {
|
|
||||||
m_mainViewWid->getQueryLineEditer()->simulateFocusOutEvent(nullptr);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::panelChangedSlot(QString key)
|
void MainWindow::panelChangedSlot(QString key)
|
||||||
{
|
{
|
||||||
Q_UNUSED(key);
|
Q_UNUSED(key);
|
||||||
|
Style::initWidStyle();
|
||||||
|
m_mainViewWid->repaintFullWidget();
|
||||||
repaintWidget();
|
repaintWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::primaryScreenChangeSlot()
|
void MainWindow::primaryScreenChangeSlot()
|
||||||
{
|
{
|
||||||
repaintWidget();
|
Style::initWidStyle();
|
||||||
|
m_mainViewWid->repaintFullWidget();
|
||||||
|
resizeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::repaintWidget()
|
void MainWindow::repaintWidget()
|
||||||
{
|
{
|
||||||
Style::initWidStyle();
|
Style::initWidStyle();
|
||||||
QRect availableGeometry = getScreenAvailableGeometry();/*qApp->primaryScreen()->availableGeometry();*/
|
|
||||||
this->setMinimumSize(Style::minw, Style::minh);
|
this->setMinimumSize(Style::minw, Style::minh);
|
||||||
m_line->setFixedSize(1, this->height() - 1);
|
m_line->setFixedSize(1, this->height() - 1);
|
||||||
|
m_line->setStyleSheet("border : 1px solid rgb(255,255,255,25)");
|
||||||
m_mainViewWid->repaintWidget();
|
m_mainViewWid->repaintWidget();
|
||||||
resizeWidget();
|
resizeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::resizeWidget()
|
void MainWindow::resizeWidget()
|
||||||
{
|
{
|
||||||
QRect availableGeometry = getScreenAvailableGeometry();
|
|
||||||
|
|
||||||
if (QApplication::activeWindow() == this) {
|
if (QApplication::activeWindow() == this) {
|
||||||
int position = Style::panelPosition;
|
int position = Style::panelPosition;
|
||||||
int panelSize = Style::panelSize;
|
|
||||||
int x = Style::primaryScreenX;
|
int x = Style::primaryScreenX;
|
||||||
int y = Style::primaryScreenY;
|
int y = Style::primaryScreenY;
|
||||||
int width = Style::primaryScreenWidth;
|
int width = Style::widthavailable;
|
||||||
int height = Style::primaryScreenHeight;
|
int height = Style::heightavailable;
|
||||||
|
|
||||||
if (m_isFullScreen) {
|
if (m_isFullScreen) {
|
||||||
if (position == 0) {
|
this->setGeometry(x, y, width, height);
|
||||||
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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sideBarWid->loadMaxSidebar();
|
m_sideBarWid->loadMaxSidebar();
|
||||||
m_sideBarWid->setSideBarBtnGeometry();
|
m_sideBarWid->setSideBarBtnGeometry();
|
||||||
m_mainViewWid->resizeControl();
|
|
||||||
} else {
|
} else {
|
||||||
if (position == 0)
|
if (position == BOTTOM) {
|
||||||
this->setGeometry(QRect(x + 4, y + availableGeometry.height() - Style::minh - 3,
|
this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh));
|
||||||
Style::minw, Style::minh));
|
} else if (position == RIGHT) {
|
||||||
else if (position == 1) {
|
this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh));
|
||||||
this->setGeometry(QRect(x + 4, y + panelSize + 4, Style::minw, Style::minh));
|
} else {
|
||||||
} else if (position == 2) {
|
this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh));
|
||||||
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));
|
|
||||||
|
|
||||||
m_sideBarWid->loadMinSidebar();
|
m_sideBarWid->loadMinSidebar();
|
||||||
m_mainViewWid->resizeControl();
|
}
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
if(e->key() == Qt::Key_Backspace)
|
||||||
|
{
|
||||||
|
m_mainViewWid->setLineEditFocus("");
|
||||||
|
}
|
||||||
|
if(e->key() == Qt::Key_Escape)
|
||||||
|
{
|
||||||
|
this->hide();
|
||||||
|
m_mainViewWid->widgetMakeZero();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//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()
|
|
||||||
{
|
|
||||||
this->hide();
|
|
||||||
m_mainViewWid->widgetMakeZero();
|
|
||||||
}
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ public:
|
||||||
* @brief Load the main window
|
* @brief Load the main window
|
||||||
*/
|
*/
|
||||||
void loadMainWindow();
|
void loadMainWindow();
|
||||||
void getCurrentCPU();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -70,7 +69,6 @@ private:
|
||||||
|
|
||||||
QPropertyAnimation *m_animation=nullptr;
|
QPropertyAnimation *m_animation=nullptr;
|
||||||
bool m_winFlag = false;
|
bool m_winFlag = false;
|
||||||
bool is_repaint = true;
|
|
||||||
DBus *m_dbus=nullptr;
|
DBus *m_dbus=nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -83,7 +81,10 @@ protected:
|
||||||
/**
|
/**
|
||||||
* @brief The query box responds to keyboard events
|
* @brief The query box responds to keyboard events
|
||||||
*/
|
*/
|
||||||
|
void keyPressEvent(QKeyEvent* e);
|
||||||
|
/**
|
||||||
|
* @brief Repaint window
|
||||||
|
*/
|
||||||
void repaintWidget();
|
void repaintWidget();
|
||||||
void resizeWidget();
|
void resizeWidget();
|
||||||
|
|
||||||
|
@ -109,7 +110,6 @@ public Q_SLOTS:
|
||||||
void primaryScreenChangeSlot();
|
void primaryScreenChangeSlot();
|
||||||
void activeWindowSolt(bool flag);
|
void activeWindowSolt(bool flag);
|
||||||
void mainWinShowSlot();
|
void mainWinShowSlot();
|
||||||
void mainWinHideSlot();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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
|
|
@ -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;
|
||||||
|
}
|
|
@ -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
|
|
@ -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();
|
||||||
|
}
|
|
@ -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
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "qtlockedfile.h"
|
#include "qtlockedfile.h"
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "qtsingleapplication.h"
|
#include "qtsingleapplication.h"
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include "menubox.h"
|
#include "menubox.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef MENUBOX_H
|
#ifndef MENUBOX_H
|
||||||
#define MENUBOX_H
|
#define MENUBOX_H
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
RightClickMenu::RightClickMenu(QWidget *parent):
|
RightClickMenu::RightClickMenu(QWidget *parent):
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
m_cmdProc = new QProcess;
|
m_cmdProc=new QProcess;
|
||||||
|
|
||||||
m_whiteList.append("kylin-screenshot.desktop");
|
m_whiteList.append("kylin-screenshot.desktop");
|
||||||
m_whiteList.append("ukui-notebook.desktop");
|
m_whiteList.append("ukui-notebook.desktop");
|
||||||
m_whiteList.append("ukui-clock.desktop");
|
m_whiteList.append("ukui-clock.desktop");
|
||||||
|
@ -43,69 +44,59 @@ RightClickMenu::RightClickMenu(QWidget *parent):
|
||||||
m_whiteList.append("peony.desktop");
|
m_whiteList.append("peony.desktop");
|
||||||
m_whiteList.append("engrampa.desktop");
|
m_whiteList.append("engrampa.desktop");
|
||||||
|
|
||||||
if (isPANGU || isHuaWeiPC) {
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
m_whiteList.append("org.gnome.FileRoller.desktop");
|
|
||||||
m_whiteList.append("mate-terminal.desktop");
|
|
||||||
m_whiteList.append("hwaudioui.desktop");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RightClickMenu::~RightClickMenu()
|
RightClickMenu::~RightClickMenu()
|
||||||
{
|
{
|
||||||
delete m_cmdProc;
|
delete m_cmdProc;
|
||||||
|
delete m_ukuiMenuInterface;
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap RightClickMenu::getIconPixmap(QString iconstr, int type)
|
QPixmap RightClickMenu::getIconPixmap(QString iconstr, int type)
|
||||||
{
|
{
|
||||||
const auto ratio = devicePixelRatioF();
|
const auto ratio=devicePixelRatioF();
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
|
|
||||||
if (type == 0) {
|
if(type==0)
|
||||||
pixmap = loadSvg(iconstr, 16 * ratio);
|
{
|
||||||
|
pixmap=loadSvg(iconstr,16*ratio);
|
||||||
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
|
pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
|
||||||
} else {
|
|
||||||
QIcon icon = QIcon::fromTheme(iconstr);
|
|
||||||
QPixmap pixmap_1 = icon.pixmap(QSize(16 * ratio, 16 * ratio));
|
|
||||||
pixmap = drawSymbolicColoredPixmap(pixmap_1);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QIcon icon=QIcon::fromTheme(iconstr);
|
||||||
|
QPixmap pixmap_1=icon.pixmap(QSize(16*ratio,16*ratio));
|
||||||
|
pixmap=drawSymbolicColoredPixmap(pixmap_1);
|
||||||
|
}
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::fixToAllActionTriggerSlot()
|
void RightClickMenu::fixToAllActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 1;
|
m_actionNumber=1;
|
||||||
QFileInfo fileInfo(m_desktopfp);
|
QFileInfo fileInfo(m_desktopfp);
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
updateDataBaseTableType(desktopfn, 1);
|
updateDataBaseTableType(desktopfn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::unfixedFromAllActionTriggerSlot()
|
void RightClickMenu::unfixedFromAllActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 2;
|
m_actionNumber=2;
|
||||||
QFileInfo fileInfo(m_desktopfp);
|
QFileInfo fileInfo(m_desktopfp);
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
updateDataBaseTableType(desktopfn, 0);
|
updateDataBaseTableType(desktopfn,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::fixToTaskbarActionTriggerSlot()
|
void RightClickMenu::fixToTaskbarActionTriggerSlot()
|
||||||
{
|
{
|
||||||
// QDBusInterface iface("com.ukui.panel.desktop",
|
QDBusInterface iface("com.ukui.panel.desktop",
|
||||||
// "/",
|
"/",
|
||||||
// "com.ukui.panel.desktop",
|
"com.ukui.panel.desktop",
|
||||||
// QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
// QDBusReply<QVariant> ret=iface.call("AddToTaskbar",m_desktopfp);
|
QDBusReply<QVariant> ret=iface.call("AddToTaskbar",m_desktopfp);
|
||||||
QDBusMessage message = QDBusMessage::createSignal("/taskbar/quicklaunch", "org.ukui.panel.taskbar", "AddToTaskbar");
|
m_actionNumber=3;
|
||||||
message << m_desktopfp;
|
|
||||||
QDBusConnection::sessionBus().send(message);
|
|
||||||
m_actionNumber = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::unfixedFromTaskbarActionTriggerSlot()
|
void RightClickMenu::unfixedFromTaskbarActionTriggerSlot()
|
||||||
|
@ -114,150 +105,146 @@ void RightClickMenu::unfixedFromTaskbarActionTriggerSlot()
|
||||||
"/",
|
"/",
|
||||||
"com.ukui.panel.desktop",
|
"com.ukui.panel.desktop",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
QDBusReply<QVariant> ret = iface.call("RemoveFromTaskbar", m_desktopfp);
|
QDBusReply<QVariant> ret=iface.call("RemoveFromTaskbar",m_desktopfp);
|
||||||
m_actionNumber = 4;
|
m_actionNumber=4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::addToDesktopActionTriggerSlot()
|
void RightClickMenu::addToDesktopActionTriggerSlot()
|
||||||
{
|
{
|
||||||
QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
QString path=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QFileInfo fileInfo(m_desktopfp);
|
QFileInfo fileInfo(m_desktopfp);
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
QFile file(m_desktopfp);
|
QFile file(m_desktopfp);
|
||||||
QString newname = QString(path + "/" + desktopfn);
|
QString newname=QString(path+"/"+desktopfn);
|
||||||
bool ret = file.copy(QString(path + "/" + desktopfn));
|
bool ret=file.copy(QString(path+"/"+desktopfn));
|
||||||
|
if(ret)
|
||||||
if (ret) {
|
{
|
||||||
char command[200];
|
char command[200];
|
||||||
sprintf(command, "chmod a+x %s", newname.toLocal8Bit().data());
|
sprintf(command,"chmod a+x %s",newname.toLocal8Bit().data());
|
||||||
QProcess::startDetached(QString::fromLocal8Bit(command));
|
QProcess::startDetached(QString::fromLocal8Bit(command));
|
||||||
}
|
}
|
||||||
|
m_actionNumber=5;
|
||||||
m_actionNumber = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::uninstallActionTriggerSlot()
|
void RightClickMenu::uninstallActionTriggerSlot()
|
||||||
{
|
{
|
||||||
// if(!checkOsRelease())
|
if(!checkOsRelease())
|
||||||
// {
|
{
|
||||||
QString cmd = QString("kylin-uninstaller %1")
|
QString cmd=QString("kylin-uninstaller %1")
|
||||||
.arg(m_desktopfp.toLocal8Bit().data());
|
.arg(m_desktopfp.toLocal8Bit().data());
|
||||||
bool ret = QProcess::startDetached(cmd);
|
bool ret=QProcess::startDetached(cmd);
|
||||||
qDebug() << "卸载:" << cmd << ret;
|
qDebug()<<"卸载:"<<cmd<<ret;
|
||||||
qDebug() << "kylin-uninstaller";
|
qDebug() << "kylin-uninstaller";
|
||||||
// }
|
|
||||||
// else
|
}
|
||||||
// {
|
else
|
||||||
// QString cmd=QString("dpkg -S "+m_desktopfp);
|
{
|
||||||
// m_cmdProc->start("sh",QStringList()<<"-c"<<cmd);
|
QString cmd=QString("dpkg -S "+m_desktopfp);
|
||||||
// m_cmdProc->waitForFinished();
|
m_cmdProc->start("sh",QStringList()<<"-c"<<cmd);
|
||||||
// QString output=m_cmdProc->readAllStandardOutput().trimmed();
|
m_cmdProc->waitForFinished();
|
||||||
// QString packageName=output.split(":").at(0);
|
QString output=m_cmdProc->readAllStandardOutput().trimmed();
|
||||||
// cmd.clear();
|
QString packageName=output.split(":").at(0);
|
||||||
// cmd=QString("kylin-installer -remove %1")
|
cmd.clear();
|
||||||
// .arg(packageName.toLocal8Bit().data());
|
cmd=QString("kylin-installer -remove %1")
|
||||||
// bool ret=QProcess::startDetached(cmd);
|
.arg(packageName.toLocal8Bit().data());
|
||||||
// qDebug()<<"卸载:"<<cmd<<ret;
|
bool ret=QProcess::startDetached(cmd);
|
||||||
// qDebug() << "dpkg -S";
|
qDebug()<<"卸载:"<<cmd<<ret;
|
||||||
// }
|
qDebug() << "dpkg -S";
|
||||||
m_actionNumber = 6;
|
}
|
||||||
|
m_actionNumber=6;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::attributeActionTriggerSlot()
|
void RightClickMenu::attributeActionTriggerSlot()
|
||||||
{
|
{
|
||||||
char command[100];
|
char command[100];
|
||||||
sprintf(command, "ukui-menu-attr %s", m_desktopfp.toLocal8Bit().data());
|
sprintf(command,"ukui-menu-attr %s",m_desktopfp.toLocal8Bit().data());
|
||||||
QProcess::startDetached(command);
|
QProcess::startDetached(command);
|
||||||
m_actionNumber = 7;
|
m_actionNumber=7;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::lockScreenActionTriggerSlot()
|
void RightClickMenu::lockScreenActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 10;
|
m_actionNumber=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::switchUserActionTriggerSlot()
|
void RightClickMenu::switchUserActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 11;
|
m_actionNumber=11;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::logoutActionTriggerSlot()
|
void RightClickMenu::logoutActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 12;
|
m_actionNumber=12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::rebootActionTriggerSlot()
|
void RightClickMenu::rebootActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 13;
|
m_actionNumber=13;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::shutdownActionTriggerSlot()
|
void RightClickMenu::shutdownActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 14;
|
m_actionNumber=14;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::otherListActionTriggerSlot()
|
void RightClickMenu::otherListActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 15;
|
m_actionNumber=15;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::hibernateActionTriggerSlot()
|
void RightClickMenu::hibernateActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 16;
|
m_actionNumber=16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RightClickMenu::sleepActionTriggerSlot()
|
void RightClickMenu::sleepActionTriggerSlot()
|
||||||
{
|
{
|
||||||
m_actionNumber = 17;
|
m_actionNumber=17;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RightClickMenu::showAppBtnMenu(const QPoint &pos, QString desktopfp)
|
int RightClickMenu::showAppBtnMenu(const QPoint &pos, QString desktopfp)
|
||||||
{
|
{
|
||||||
m_actionNumber = 0;
|
m_actionNumber=0;
|
||||||
this->m_desktopfp.clear();
|
this->m_desktopfp.clear();
|
||||||
this->m_desktopfp = desktopfp;
|
this->m_desktopfp=desktopfp;
|
||||||
|
|
||||||
MenuBox m_showAppMenu;
|
MenuBox m_showAppMenu;
|
||||||
connect(&m_showAppMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
|
connect(&m_showAppMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
|
||||||
m_showAppMenu.setWindowFlag(Qt::Popup);
|
m_showAppMenu.setWindowFlag(Qt::Popup);
|
||||||
|
|
||||||
//添加菜单项,指定图标、名称、响应函数
|
//添加菜单项,指定图标、名称、响应函数
|
||||||
QFileInfo fileInfo(desktopfp);
|
QFileInfo fileInfo(desktopfp);
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
|
if(!checkIfLocked(desktopfn))
|
||||||
if (!checkIfLocked(desktopfn))
|
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/fixed.svg",0)),tr("Pin to all"),
|
||||||
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/fixed.svg", 0)), tr("Pin to all"),
|
this,SLOT(fixToAllActionTriggerSlot()));
|
||||||
this, SLOT(fixToAllActionTriggerSlot()));
|
|
||||||
else
|
else
|
||||||
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/unfixed.svg", 0)), tr("Unpin from all"),
|
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/unfixed.svg",0)),tr("Unpin from all"),
|
||||||
this, SLOT(unfixedFromAllActionTriggerSlot()));
|
this,SLOT(unfixedFromAllActionTriggerSlot()));
|
||||||
|
|
||||||
QDBusInterface iface("com.ukui.panel.desktop",
|
QDBusInterface iface("com.ukui.panel.desktop",
|
||||||
"/",
|
"/",
|
||||||
"com.ukui.panel.desktop",
|
"com.ukui.panel.desktop",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
QDBusReply<bool> ret = iface.call("CheckIfExist", desktopfp);
|
|
||||||
|
|
||||||
if (!ret)
|
QDBusReply<bool> ret=iface.call("CheckIfExist",desktopfp);
|
||||||
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/fixed.svg", 0)), tr("Pin to taskbar"),
|
if(!ret)
|
||||||
this, SLOT(fixToTaskbarActionTriggerSlot()));
|
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/fixed.svg",0)),tr("Pin to taskbar"),
|
||||||
|
this,SLOT(fixToTaskbarActionTriggerSlot()));
|
||||||
else
|
else
|
||||||
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/unfixed.svg", 0)), tr("Unpin from taskbar"),
|
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/unfixed.svg",0)),tr("Unpin from taskbar"),
|
||||||
this, SLOT(unfixedFromTaskbarActionTriggerSlot()));
|
this,SLOT(unfixedFromTaskbarActionTriggerSlot()));
|
||||||
|
|
||||||
m_showAppMenu.addAction(tr("Add to desktop shortcuts"),
|
m_showAppMenu.addAction(tr("Add to desktop shortcuts"),
|
||||||
this, SLOT(addToDesktopActionTriggerSlot()));
|
this,SLOT(addToDesktopActionTriggerSlot()));
|
||||||
//检查桌面快捷方式是否存在
|
//检查桌面快捷方式是否存在
|
||||||
QString desktopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
QString desktopPath=QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QString path = QString(desktopPath + "/" + QFileInfo(m_desktopfp).fileName());
|
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.actions().at(2)->setEnabled(false); //存在时禁用
|
|
||||||
}
|
|
||||||
|
|
||||||
m_showAppMenu.addSeparator();
|
m_showAppMenu.addSeparator();
|
||||||
|
if(!m_whiteList.contains(desktopfn))
|
||||||
if (!m_whiteList.contains(desktopfn))
|
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/uninstall.svg",0)),tr("Uninstall"),
|
||||||
m_showAppMenu.addAction(QIcon(getIconPixmap(":/data/img/mainviewwidget/uninstall.svg", 0)), tr("Uninstall"),
|
this,SLOT(uninstallActionTriggerSlot()));
|
||||||
this, SLOT(uninstallActionTriggerSlot()));
|
|
||||||
|
|
||||||
m_showAppMenu.setAttribute(Qt::WA_TranslucentBackground);
|
m_showAppMenu.setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_showAppMenu.setAttribute(Qt::WA_DeleteOnClose);
|
m_showAppMenu.setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -268,18 +255,19 @@ int RightClickMenu::showAppBtnMenu(const QPoint &pos, QString desktopfp)
|
||||||
|
|
||||||
int RightClickMenu::showShutdownMenu(const QPoint &pos)
|
int RightClickMenu::showShutdownMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
m_actionNumber = 0;
|
m_actionNumber=0;
|
||||||
MenuBox m_showShutMenu;
|
MenuBox m_showShutMenu;
|
||||||
connect(&m_showShutMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
|
connect(&m_showShutMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
|
||||||
m_showShutMenu.setWindowFlag(Qt::Popup);
|
m_showShutMenu.setWindowFlag(Qt::Popup);
|
||||||
m_showShutMenu.addAction(QIcon(getIconPixmap("kylin-hebernate-symbolic", 1)), tr("Sleep"),
|
|
||||||
this, SLOT(hibernateActionTriggerSlot())); //休眠睡眠相同
|
m_showShutMenu.addAction(QIcon(getIconPixmap("kylin-hebernate-symbolic",1)),tr("Sleep"),
|
||||||
m_showShutMenu.addAction(QIcon(getIconPixmap("system-logout-symbolic", 1)), tr("Log Out"),
|
this,SLOT(hibernateActionTriggerSlot()));//休眠睡眠相同
|
||||||
this, SLOT(logoutActionTriggerSlot()));
|
m_showShutMenu.addAction(QIcon(getIconPixmap("system-logout-symbolic",1)),tr("Log Out"),
|
||||||
m_showShutMenu.addAction(QIcon(getIconPixmap("system-restart-symbolic", 1)), tr("Restart"),
|
this,SLOT(logoutActionTriggerSlot()));
|
||||||
this, SLOT(rebootActionTriggerSlot()));
|
m_showShutMenu.addAction(QIcon(getIconPixmap("system-restart-symbolic",1)),tr("Restart"),
|
||||||
m_showShutMenu.addAction(QIcon(getIconPixmap("exit-symbolic", 1)), tr("Power Off"),
|
this,SLOT(rebootActionTriggerSlot()));
|
||||||
this, SLOT(shutdownActionTriggerSlot()));
|
m_showShutMenu.addAction(QIcon(getIconPixmap("exit-symbolic",1)),tr("Power Off"),
|
||||||
|
this,SLOT(shutdownActionTriggerSlot()));
|
||||||
m_showShutMenu.setAttribute(Qt::WA_TranslucentBackground);
|
m_showShutMenu.setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_showShutMenu.setAttribute(Qt::WA_DeleteOnClose);
|
m_showShutMenu.setAttribute(Qt::WA_DeleteOnClose);
|
||||||
m_showShutMenu.raise();
|
m_showShutMenu.raise();
|
||||||
|
@ -290,9 +278,9 @@ int RightClickMenu::showShutdownMenu(const QPoint &pos)
|
||||||
|
|
||||||
int RightClickMenu::showOtherMenu(const QPoint &pos, QString desktopfp)
|
int RightClickMenu::showOtherMenu(const QPoint &pos, QString desktopfp)
|
||||||
{
|
{
|
||||||
m_actionNumber = 0;
|
m_actionNumber=0;
|
||||||
this->m_desktopfp.clear();
|
this->m_desktopfp.clear();
|
||||||
this->m_desktopfp = desktopfp;
|
this->m_desktopfp=desktopfp;
|
||||||
MenuBox m_showOtherMenu;
|
MenuBox m_showOtherMenu;
|
||||||
connect(&m_showOtherMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
|
connect(&m_showOtherMenu, &MenuBox::sendMainWinActiveSignal, this, &RightClickMenu::sendMainWinActiveSignal);
|
||||||
m_showOtherMenu.setWindowFlag(Qt::Popup);
|
m_showOtherMenu.setWindowFlag(Qt::Popup);
|
||||||
|
@ -300,6 +288,7 @@ int RightClickMenu::showOtherMenu(const QPoint &pos, QString desktopfp)
|
||||||
// "/",
|
// "/",
|
||||||
// "com.ukui.panel.desktop",
|
// "com.ukui.panel.desktop",
|
||||||
// QDBusConnection::sessionBus());
|
// QDBusConnection::sessionBus());
|
||||||
|
|
||||||
// QDBusReply<bool> ret=iface.call("CheckIfExist",this->m_desktopfp);
|
// QDBusReply<bool> ret=iface.call("CheckIfExist",this->m_desktopfp);
|
||||||
// if(!ret)
|
// if(!ret)
|
||||||
// menu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/fixed.svg",0)),tr("Pin to taskbar"),
|
// menu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/fixed.svg",0)),tr("Pin to taskbar"),
|
||||||
|
@ -307,11 +296,12 @@ int RightClickMenu::showOtherMenu(const QPoint &pos, QString desktopfp)
|
||||||
// else
|
// else
|
||||||
// menu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/unfixed.svg",0)),tr("Unpin from taskbar"),
|
// menu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/unfixed.svg",0)),tr("Unpin from taskbar"),
|
||||||
// this,SLOT(unfixedFromTaskbarActionTriggerSlot()));
|
// this,SLOT(unfixedFromTaskbarActionTriggerSlot()));
|
||||||
m_showOtherMenu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/setting.svg", 0)), tr("Personalize this list"),
|
m_showOtherMenu.addAction(QIcon(getIconPixmap(":/data/img/sidebarwidget/setting.svg",0)),tr("Personalize this list"),
|
||||||
this, SLOT(otherListActionTriggerSlot()));
|
this,SLOT(otherListActionTriggerSlot()));
|
||||||
m_showOtherMenu.setAttribute(Qt::WA_TranslucentBackground);
|
m_showOtherMenu.setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_showOtherMenu.setAttribute(Qt::WA_DeleteOnClose);
|
m_showOtherMenu.setAttribute(Qt::WA_DeleteOnClose);
|
||||||
m_showOtherMenu.exec(pos);
|
m_showOtherMenu.exec(pos);
|
||||||
qDebug() << "RightClickMenu::showOtherMenu(QString desktopfp)";
|
qDebug() << "RightClickMenu::showOtherMenu(QString desktopfp)";
|
||||||
|
|
||||||
return m_actionNumber;
|
return m_actionNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "src/Interface/ukuimenuinterface.h"
|
#include "src/Interface/ukuimenuinterface.h"
|
||||||
#include "src/Style/style.h"
|
#include "src/Style/style.h"
|
||||||
#include "menubox.h"
|
#include "menubox.h"
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class RightClickMenu : public QWidget
|
class RightClickMenu : public QWidget
|
||||||
{
|
{
|
||||||
|
|
|
@ -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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
|
@ -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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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
|
|
@ -30,43 +30,44 @@ FullSearchResultWidget::FullSearchResultWidget(QWidget *parent) :
|
||||||
|
|
||||||
FullSearchResultWidget::~FullSearchResultWidget()
|
FullSearchResultWidget::~FullSearchResultWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullSearchResultWidget::initUi()
|
void FullSearchResultWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setAttribute(Qt::WA_StyledBackground, true);
|
this->setAttribute(Qt::WA_StyledBackground,true);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
QHBoxLayout* mainLayout=new QHBoxLayout;
|
||||||
m_spaceItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed);
|
mainLayout->setContentsMargins(0,0,0,0);
|
||||||
|
m_spaceItem=new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||||
mainLayout->addItem(m_spaceItem);
|
mainLayout->addItem(m_spaceItem);
|
||||||
m_listView = new FullListView(this, 3);
|
m_listView=new FullListView(this,3);
|
||||||
this->setLayout(mainLayout);
|
this->setLayout(mainLayout);
|
||||||
m_scrollArea = new ScrollArea;
|
|
||||||
m_scrollAreaWid = new ScrollAreaWid;
|
m_scrollArea=new ScrollArea;
|
||||||
|
m_scrollAreaWid=new ScrollAreaWid;
|
||||||
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
m_scrollArea->setFixedSize(Style::AppListWidWidth, this->height());
|
m_scrollArea->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||||
m_scrollArea->setWidgetResizable(true);
|
m_scrollArea->setWidgetResizable(true);
|
||||||
m_scrollAreaWidLayout = new QVBoxLayout;
|
m_scrollAreaWidLayout=new QVBoxLayout;
|
||||||
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
m_scrollAreaWidLayout->setContentsMargins(0,0,0,0);
|
||||||
m_scrollAreaWidLayout->setSpacing(10);
|
m_scrollAreaWidLayout->setSpacing(10);
|
||||||
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
m_scrollAreaWid->setLayout(m_scrollAreaWidLayout);
|
||||||
mainLayout->addWidget(m_scrollArea);
|
mainLayout->addWidget(m_scrollArea);
|
||||||
m_scrollAreaWidLayout->addWidget(m_listView);
|
m_scrollAreaWidLayout->addWidget(m_listView);
|
||||||
m_scrollAreaWidLayout->addItem(new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding));
|
m_scrollAreaWidLayout->addItem(new QSpacerItem(20,40,QSizePolicy::Fixed,QSizePolicy::Expanding));
|
||||||
|
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_listView->addData(m_data);
|
m_listView->addData(m_data);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
connect(m_listView, &FullListView::sendItemClickedSignal, this, &FullSearchResultWidget::execApplication);
|
|
||||||
connect(m_listView, &FullListView::sendHideMainWindowSignal, this, &FullSearchResultWidget::sendHideMainWindowSignal);
|
connect(m_listView,&FullListView::sendItemClickedSignal,this,&FullSearchResultWidget::execApplication);
|
||||||
|
connect(m_listView,&FullListView::sendHideMainWindowSignal,this,&FullSearchResultWidget::sendHideMainWindowSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,31 +82,31 @@ void FullSearchResultWidget::execApplication(QString desktopfp)
|
||||||
void FullSearchResultWidget::updateAppListView(QVector<QStringList> arg)
|
void FullSearchResultWidget::updateAppListView(QVector<QStringList> arg)
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
Q_FOREACH(QStringList appinfo,arg)
|
||||||
Q_FOREACH (QStringList appinfo, arg) {
|
|
||||||
m_data.append(appinfo.at(0));
|
m_data.append(appinfo.at(0));
|
||||||
}
|
|
||||||
|
|
||||||
m_listView->updateData(m_data);
|
m_listView->updateData(m_data);
|
||||||
resizeScrollAreaControls();
|
resizeScrollAreaControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullSearchResultWidget::resizeScrollAreaControls()
|
void FullSearchResultWidget::resizeScrollAreaControls()
|
||||||
{
|
{
|
||||||
QLayoutItem *widItem = m_scrollAreaWidLayout->itemAt(0);
|
QLayoutItem* widItem=m_scrollAreaWidLayout->itemAt(0);
|
||||||
QWidget *wid = widItem->widget();
|
QWidget* wid=widItem->widget();
|
||||||
FullListView *listview = qobject_cast<FullListView *>(wid);
|
FullListView* listview=qobject_cast<FullListView*>(wid);
|
||||||
listview->adjustSize();
|
listview->adjustSize();
|
||||||
int dividend = (m_scrollArea->width() - Style::SliderSize) / Style::AppListGridSizeWidth;
|
int dividend=(m_scrollArea->width()-Style::SliderSize)/Style::AppListGridSizeWidth;
|
||||||
int rowcount = 0;
|
int rowcount=0;
|
||||||
|
if(listview->model()->rowCount()%dividend>0)
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend+1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rowcount=listview->model()->rowCount()/dividend;
|
||||||
|
|
||||||
if (listview->model()->rowCount() % dividend > 0) {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend + 1;
|
|
||||||
} else {
|
|
||||||
rowcount = listview->model()->rowCount() / dividend;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listview->setFixedSize(m_scrollArea->width() - Style::SliderSize + 1, listview->gridSize().height()*rowcount);
|
listview->setFixedSize(m_scrollArea->width()-Style::SliderSize+1,listview->gridSize().height()*rowcount);
|
||||||
m_scrollArea->widget()->adjustSize();
|
m_scrollArea->widget()->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,29 +114,27 @@ void FullSearchResultWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::MainViewWidWidth,
|
this->setFixedSize(Style::MainViewWidWidth,
|
||||||
Style::AppListWidHeight);
|
Style::AppListWidHeight);
|
||||||
m_scrollArea->setFixedSize(Style::AppListWidWidth, this->height());
|
m_scrollArea->setFixedSize(Style::AppListWidWidth,this->height());
|
||||||
// this->layout()->setContentsMargins(Style::LeftWidWidth,0,0,0);
|
|
||||||
m_scrollAreaWidLayout->removeWidget(m_listView);
|
m_scrollAreaWidLayout->removeWidget(m_listView);
|
||||||
m_listView->setParent(nullptr);
|
m_listView->setParent(nullptr);
|
||||||
delete m_listView;
|
delete m_listView;
|
||||||
m_listView = new FullListView(this, 3);
|
m_listView=new FullListView(this,3);
|
||||||
m_scrollAreaWidLayout->insertWidget(0, m_listView);
|
m_scrollAreaWidLayout->insertWidget(0,m_listView);
|
||||||
|
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_listView->addData(m_data);
|
m_listView->addData(m_data);
|
||||||
resizeScrollAreaControls();
|
resizeScrollAreaControls();
|
||||||
connect(m_listView, &FullListView::sendItemClickedSignal, this, &FullSearchResultWidget::execApplication);
|
connect(m_listView,&FullListView::sendItemClickedSignal,this,&FullSearchResultWidget::execApplication);
|
||||||
connect(m_listView, &FullListView::sendHideMainWindowSignal, this, &FullSearchResultWidget::sendHideMainWindowSignal);
|
connect(m_listView,&FullListView::sendHideMainWindowSignal,this,&FullSearchResultWidget::sendHideMainWindowSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullSearchResultWidget::moveScrollBar(int type)
|
void FullSearchResultWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
int height = Style::primaryScreenHeight;
|
int height=Style::primaryScreenHeight;
|
||||||
|
if(type==0)
|
||||||
if (type == 0) {
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-height*100/1080);
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() - height * 100 / 1080);
|
else
|
||||||
} else {
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+height*100/1080);
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() + height * 100 / 1080);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullSearchResultWidget::setViewFocus()
|
void FullSearchResultWidget::setViewFocus()
|
||||||
|
|
|
@ -6669,7 +6669,7 @@ gāng 冈
|
||||||
rǎn,nán,dān 冉
|
rǎn,nán,dān 冉
|
||||||
cè 冊
|
cè 冊
|
||||||
jiōng,jiǒng 冋
|
jiōng,jiǒng 冋
|
||||||
cè 册
|
cè,zhà 册
|
||||||
zài 再
|
zài 再
|
||||||
guǎ 冎
|
guǎ 冎
|
||||||
jiǒng,jiōng 冏
|
jiǒng,jiōng 冏
|
||||||
|
|
|
@ -6669,7 +6669,7 @@ gang 冈
|
||||||
dan,nan,ran 冉
|
dan,nan,ran 冉
|
||||||
ce 冊
|
ce 冊
|
||||||
jiong 冋
|
jiong 冋
|
||||||
ce 册
|
zha,ce 册
|
||||||
zai 再
|
zai 再
|
||||||
gua 冎
|
gua 冎
|
||||||
jiong 冏
|
jiong 冏
|
||||||
|
|
|
@ -22,127 +22,108 @@
|
||||||
|
|
||||||
SearchAppThread::SearchAppThread()
|
SearchAppThread::SearchAppThread()
|
||||||
{
|
{
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchAppThread::~SearchAppThread()
|
SearchAppThread::~SearchAppThread()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchAppThread::run()
|
void SearchAppThread::run()
|
||||||
{
|
{
|
||||||
m_appInfoVector.clear();
|
m_appInfoVector.clear();
|
||||||
m_appInfoVector = UkuiMenuInterface::appInfoVector;
|
m_appInfoVector=UkuiMenuInterface::appInfoVector;
|
||||||
m_searchResultVector.clear();
|
m_searchResultVector.clear();
|
||||||
m_searchFirstVector.clear();
|
if(!this->m_keyWord.isEmpty())
|
||||||
m_searchRestVector.clear();
|
{
|
||||||
|
QString str=m_ukuiMenuInterface->getAppNamePinyin(m_keyWord);
|
||||||
if (!this->m_keyWord.isEmpty()) {
|
int index=0;
|
||||||
QString str = m_ukuiMenuInterface->getAppNamePinyin(m_keyWord);
|
if(str.size()==1)
|
||||||
int index = 0;
|
{
|
||||||
// if(str.size()==1)
|
int num=static_cast<int>(str.toLocal8Bit().at(0));
|
||||||
// {
|
QStringList searchDesktopList;
|
||||||
// int num=static_cast<int>(str.toLocal8Bit().at(0));
|
searchDesktopList.clear();
|
||||||
// QStringList searchDesktopList;
|
if(num>=65 && num<=90)
|
||||||
// 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));
|
||||||
// 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)));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// 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++) {
|
|
||||||
appNameLs.append(appNamePyLst.at(i * 2));
|
|
||||||
appNameFls.append(appNamePyLst.at(i * 2 + 1));
|
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
|
||||||
QString appName = m_appInfoVector.at(index).at(1);
|
if(appNameFl==str)//匹配首字母
|
||||||
QString appEnglishName = m_appInfoVector.at(index).at(2);
|
{
|
||||||
//QString appNameFls=m_appInfoVector.at(index).at(4);
|
m_searchResultVector.append(m_appInfoVector.at(index));
|
||||||
|
}
|
||||||
if (m_keyWord.contains(QRegExp("[\\x4e00-\\x9fa5]+"))) { //中文正则表达式
|
index++;
|
||||||
if (appName.toUpper().contains(m_keyWord.toUpper())) {
|
|
||||||
m_searchResultVector.append(m_appInfoVector.at(index));
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
for (int var = 0; var < appNameLs.size(); ++var) {
|
// else if(num<48 || (num>57 && num<65) || num>90)
|
||||||
if (appNameLs[var].left(str.length()).contains(str, Qt::CaseInsensitive) ||
|
// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(26).size();i++)
|
||||||
appNameFls[var].left(str.length()).contains(str, Qt::CaseInsensitive)) {
|
// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(26).at(i));
|
||||||
m_searchFirstVector.append(m_appInfoVector.at(index));
|
// else
|
||||||
break;
|
// for(int i=0;i<UkuiMenuInterface::alphabeticVector.at(27).size();i++)
|
||||||
} else if (appNameLs[var].contains(str, Qt::CaseInsensitive) ||
|
// searchDesktopList.append(UkuiMenuInterface::alphabeticVector.at(27).at(i));
|
||||||
appNameFls[var].contains(str, Qt::CaseInsensitive) ||
|
|
||||||
appEnglishName.contains(str, Qt::CaseInsensitive)) {
|
if(!searchDesktopList.isEmpty())
|
||||||
m_searchRestVector.append(m_appInfoVector.at(index));
|
{
|
||||||
break;
|
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++)
|
||||||
|
{
|
||||||
|
appNameLs.append(appNamePyLst.at(i * 2));
|
||||||
|
appNameFls.append(appNamePyLst.at(i * 2 + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString appName = m_appInfoVector.at(index).at(1);
|
||||||
|
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()))
|
||||||
|
m_searchResultVector.append(m_appInfoVector.at(index));
|
||||||
|
}
|
||||||
|
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_searchResultVector.append(m_appInfoVector.at(index));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qSort(m_searchFirstVector.begin(), m_searchFirstVector.end(), UkuiMenuInterface::cmpApp);
|
qSort(m_searchResultVector.begin(),m_searchResultVector.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);
|
Q_EMIT sendSearchResult(m_searchResultVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchAppThread::recvSearchKeyword(QString arg)
|
void SearchAppThread::recvSearchKeyword(QString arg)
|
||||||
{
|
{
|
||||||
this->m_keyWord.clear();
|
this->m_keyWord.clear();
|
||||||
this->m_keyWord = arg;
|
this->m_keyWord=arg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,6 @@ public:
|
||||||
private:
|
private:
|
||||||
QString m_keyWord;
|
QString m_keyWord;
|
||||||
QVector<QStringList> m_searchResultVector;
|
QVector<QStringList> m_searchResultVector;
|
||||||
QVector<QStringList> m_searchFirstVector;
|
|
||||||
QVector<QStringList> m_searchRestVector;
|
|
||||||
|
|
||||||
UkuiMenuInterface* m_ukuiMenuInterface=nullptr;
|
UkuiMenuInterface* m_ukuiMenuInterface=nullptr;
|
||||||
QVector<QStringList> m_appInfoVector;
|
QVector<QStringList> m_appInfoVector;
|
||||||
|
|
|
@ -30,28 +30,26 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||||
|
|
||||||
SearchResultWidget::~SearchResultWidget()
|
SearchResultWidget::~SearchResultWidget()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete m_ukuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWidget::initUi()
|
void SearchResultWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
|
||||||
this->setAttribute(Qt::WA_StyledBackground, true);
|
this->setAttribute(Qt::WA_StyledBackground,true);
|
||||||
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
this->setFocusPolicy(Qt::StrongFocus);
|
this->setFocusPolicy(Qt::StrongFocus);
|
||||||
m_listView = new ListView(this, this->width() - 6, this->height() - 6, 3);
|
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->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_listView->show();
|
m_listView->show();
|
||||||
|
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_listView->addData(m_data);
|
m_listView->addData(m_data);
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
m_ukuiMenuInterface=new UkuiMenuInterface;
|
||||||
connect(m_listView, &ListView::sendItemClickedSignal, this, &SearchResultWidget::execApplication);
|
|
||||||
connect(m_listView, &ListView::sendHideMainWindowSignal, this, &SearchResultWidget::sendHideMainWindowSignal);
|
connect(m_listView,&ListView::sendItemClickedSignal,this,&SearchResultWidget::execApplication);
|
||||||
connect(m_listView, &ListView::sendMainWinActiveSignal, this, &SearchResultWidget::sendMainWinActiveSignal);
|
connect(m_listView,&ListView::sendHideMainWindowSignal,this,&SearchResultWidget::sendHideMainWindowSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,34 +58,30 @@ void SearchResultWidget::initUi()
|
||||||
void SearchResultWidget::execApplication(QStringList arg)
|
void SearchResultWidget::execApplication(QStringList arg)
|
||||||
{
|
{
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
QString desktopfp = arg.at(0);
|
QString desktopfp=arg.at(0);
|
||||||
execApp(desktopfp);
|
execApp(desktopfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWidget::updateAppListView(QVector<QStringList> arg)
|
void SearchResultWidget::updateAppListView(QVector<QStringList> arg)
|
||||||
{
|
{
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
|
Q_FOREACH(QStringList appinfo,arg)
|
||||||
Q_FOREACH (QStringList appinfo, arg) {
|
m_data.append(QStringList()<<appinfo.at(0)<<"1");
|
||||||
m_data.append(QStringList() << appinfo.at(0) << "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
m_listView->updateData(m_data);
|
m_listView->updateData(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWidget::moveScrollBar(int type)
|
void SearchResultWidget::moveScrollBar(int type)
|
||||||
{
|
{
|
||||||
if (type == 0) {
|
if(type==0)
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() - 100);
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()-100);
|
||||||
} else {
|
else
|
||||||
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition() + 100);
|
m_listView->verticalScrollBar()->setSliderPosition(m_listView->verticalScrollBar()->sliderPosition()+100);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultWidget::repaintWidget()
|
void SearchResultWidget::repaintWidget()
|
||||||
{
|
{
|
||||||
this->setFixedSize(Style::defaultMainViewWidWidth, Style::defaultContentWidHeight);
|
this->setFixedSize(Style::defaultMainViewWidWidth,Style::defaultContentWidHeight);
|
||||||
m_listView->setGeometry(QRect(6, 0, this->width() - 6, this->height() - 6));
|
m_listView->setGeometry(QRect(6,0,this->width()-6,this->height()-6));
|
||||||
m_listView->show();
|
m_listView->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ public:
|
||||||
void setViewFocus();
|
void setViewFocus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface* m_ukuiMenuInterface=nullptr;
|
||||||
ListView *m_listView = nullptr;
|
ListView* m_listView=nullptr;
|
||||||
QVector<QStringList> m_data;
|
QVector<QStringList> m_data;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -81,8 +81,6 @@ Q_SIGNALS:
|
||||||
* @brief Send a hidden main window signal to the MainViewWidget
|
* @brief Send a hidden main window signal to the MainViewWidget
|
||||||
*/
|
*/
|
||||||
void sendHideMainWindowSignal();
|
void sendHideMainWindowSignal();
|
||||||
|
|
||||||
void sendMainWinActiveSignal(bool flag);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SEARCHRESULTWIDGET_H
|
#endif // SEARCHRESULTWIDGET_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,34 +61,34 @@ public:
|
||||||
void setSideBarBtnGeometry();
|
void setSideBarBtnGeometry();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface *m_ukuiMenuInterface=nullptr;
|
||||||
|
|
||||||
QWidget *m_mainWidget = nullptr;
|
QWidget *m_mainWidget=nullptr;
|
||||||
QVBoxLayout *m_mainWidgetLayout = nullptr;
|
QVBoxLayout *m_mainWidgetLayout=nullptr;
|
||||||
|
|
||||||
QWidget *m_minMaxWidget = nullptr;
|
QWidget *m_minMaxWidget=nullptr;
|
||||||
QHBoxLayout *m_minMaxLayout = nullptr;
|
QHBoxLayout *m_minMaxLayout=nullptr;
|
||||||
QPushButton *m_minMaxBtn = nullptr;
|
QPushButton *m_minMaxBtn=nullptr;
|
||||||
|
|
||||||
QList<QAbstractButton *> m_buttonList;
|
QList<QAbstractButton*> m_buttonList;
|
||||||
QList<QLabel *> m_labelList;
|
QList<QLabel*> m_labelList;
|
||||||
QStringList m_textList;
|
QStringList m_textList;
|
||||||
QPushButton *m_allBtn = nullptr;
|
QPushButton *m_allBtn=nullptr;
|
||||||
QPushButton *m_letterBtn = nullptr;
|
QPushButton *m_letterBtn=nullptr;
|
||||||
QPushButton *m_functionBtn = nullptr;
|
QPushButton *m_functionBtn=nullptr;
|
||||||
|
|
||||||
QPushButton *m_userIconBtn = nullptr;
|
QPushButton *m_userIconBtn=nullptr;
|
||||||
QPushButton *m_computerBtn = nullptr;
|
QPushButton *m_computerBtn=nullptr;
|
||||||
QPushButton *m_personalBtn = nullptr;
|
QPushButton *m_personalBtn=nullptr;
|
||||||
QPushButton *m_controlBtn = nullptr;
|
QPushButton *m_controlBtn=nullptr;
|
||||||
QPushButton *m_trashBtn = nullptr;
|
QPushButton *m_trashBtn=nullptr;
|
||||||
QPushButton *m_shutDownBtn = nullptr;
|
QPushButton *m_shutDownBtn=nullptr;
|
||||||
QSpacerItem *m_verticalSpacer = nullptr;
|
QSpacerItem *m_verticalSpacer=nullptr;
|
||||||
bool m_isFullScreen = false;
|
bool m_isFullScreen=false;
|
||||||
QGSettings *m_gsetting = nullptr;
|
QGSettings *m_gsetting=nullptr;
|
||||||
// RightClickMenu *m_shutDownMenu=nullptr;
|
// RightClickMenu *m_shutDownMenu=nullptr;
|
||||||
// RightClickMenu *m_otherMenu=nullptr;
|
// RightClickMenu *m_otherMenu=nullptr;
|
||||||
QPropertyAnimation *m_animation = nullptr;
|
QPropertyAnimation* m_animation=nullptr;
|
||||||
|
|
||||||
int m_btnWidth, m_btnheight;
|
int m_btnWidth, m_btnheight;
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ protected:
|
||||||
* @param text: Button text
|
* @param text: Button text
|
||||||
* @param num: Button Number
|
* @param num: Button Number
|
||||||
*/
|
*/
|
||||||
void initBtn(QPushButton *btn, QString btnicon, QString text, int num);
|
void initBtn(QPushButton *btn, QString btnicon,QString text,int num);
|
||||||
/**
|
/**
|
||||||
* @brief Set the default sidebar button
|
* @brief Set the default sidebar button
|
||||||
* @param btn: QPushButton
|
* @param btn: QPushButton
|
||||||
|
@ -124,7 +124,7 @@ protected:
|
||||||
* @brief Add right-click menu
|
* @brief Add right-click menu
|
||||||
* @param btn: QPushButton
|
* @param btn: QPushButton
|
||||||
*/
|
*/
|
||||||
// void addRightClickMenu(QPushButton* btn);
|
void addRightClickMenu(QPushButton* btn);
|
||||||
/**
|
/**
|
||||||
* @brief Set the minimize button
|
* @brief Set the minimize button
|
||||||
*/
|
*/
|
||||||
|
@ -136,9 +136,9 @@ protected:
|
||||||
QPixmap PixmapToRound(const QPixmap &src, int radius);
|
QPixmap PixmapToRound(const QPixmap &src, int radius);
|
||||||
void changeIconColor(bool isFullScreen);
|
void changeIconColor(bool isFullScreen);
|
||||||
// void mousePressEvent(QMouseEvent* event);
|
// void mousePressEvent(QMouseEvent* event);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent* e);
|
||||||
|
|
||||||
bool eventFilter(QObject *target, QEvent *event);
|
bool eventFilter(QObject * target , QEvent * event );
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +160,7 @@ private Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* @brief Load other application right-click menu
|
* @brief Load other application right-click menu
|
||||||
*/
|
*/
|
||||||
// void otherBtnRightClickSlot(const QPoint &pos);
|
void otherBtnRightClickSlot(const QPoint &pos);
|
||||||
/**
|
/**
|
||||||
* @brief Respond to computer btn
|
* @brief Respond to computer btn
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,7 +41,6 @@ int Style::defaultQueryLineEditHeight=0;
|
||||||
int Style::defaultQueryLineEditIconSize=0;
|
int Style::defaultQueryLineEditIconSize=0;
|
||||||
int Style::defaultContentWidHeight=0;
|
int Style::defaultContentWidHeight=0;
|
||||||
int Style::defaultSideBarWidWidth=0;
|
int Style::defaultSideBarWidWidth=0;
|
||||||
int Style::defaultIconSize=32;
|
|
||||||
/**
|
/**
|
||||||
* 全屏窗口
|
* 全屏窗口
|
||||||
*/
|
*/
|
||||||
|
@ -101,39 +100,28 @@ int Style::SideBarSpaceBetweenItem=0;
|
||||||
|
|
||||||
void Style::initWidStyle()
|
void Style::initWidStyle()
|
||||||
{
|
{
|
||||||
|
getScreenAvailableGeometry();
|
||||||
|
|
||||||
QVariantList list=getScreenGeometry();
|
int fontSize = 10;
|
||||||
if(list.count()>=6)
|
if (QGSettings::isSchemaInstalled(QString("org.mate.interface").toLocal8Bit())) {
|
||||||
{
|
QGSettings *setting = new QGSettings(QString("org.mate.interface").toLocal8Bit());
|
||||||
primaryScreenX=list.at(0).toInt();
|
if (setting->keys().contains(QString("font-name"))) {
|
||||||
primaryScreenY=list.at(1).toInt();
|
QString value = setting->get("font-name").toString();
|
||||||
primaryScreenWidth=list.at(2).toInt();
|
QStringList valstr = value.split(" ");
|
||||||
primaryScreenHeight=list.at(3).toInt();
|
fontSize = valstr.at(valstr.count() - 1).toInt();
|
||||||
panelSize=list.at(4).toInt();
|
}
|
||||||
panelPosition=list.at(5).toInt();
|
|
||||||
}
|
}
|
||||||
|
int len = 0;
|
||||||
QGSettings* setting=new QGSettings(QString("org.mate.interface").toLocal8Bit());
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
if(panelPosition==2 || panelPosition==3)
|
|
||||||
{
|
|
||||||
widthavailable=primaryScreenWidth-panelSize;
|
|
||||||
heightavailable=primaryScreenHeight;
|
|
||||||
}
|
|
||||||
int len=0;
|
|
||||||
QString locale = QLocale::system().name();
|
QString locale = QLocale::system().name();
|
||||||
if (locale == "zh_CN")
|
|
||||||
len=0;
|
if (locale == "zh_CN") {
|
||||||
else
|
len = 0;
|
||||||
len=10;
|
} else {
|
||||||
|
len = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
primaryScreenWidth = qApp->primaryScreen()->geometry().width();
|
||||||
|
primaryScreenHeight = qApp->primaryScreen()->geometry().height();
|
||||||
|
|
||||||
if(primaryScreenWidth==800 && primaryScreenHeight==600)
|
if(primaryScreenWidth==800 && primaryScreenHeight==600)
|
||||||
{
|
{
|
||||||
|
@ -175,7 +163,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=14;
|
LeftLetterFontSize=14;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=15;
|
LeftSpaceBetweenItem=15;
|
||||||
|
@ -221,7 +209,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=14;
|
LeftLetterFontSize=14;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=15;
|
LeftSpaceBetweenItem=15;
|
||||||
|
@ -267,7 +255,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=11;
|
LeftLetterFontSize=11;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=10;
|
LeftSpaceBetweenItem=10;
|
||||||
|
@ -313,7 +301,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=11;
|
LeftLetterFontSize=11;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=10;
|
LeftSpaceBetweenItem=10;
|
||||||
|
@ -359,7 +347,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=11;
|
LeftLetterFontSize=11;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=10;
|
LeftSpaceBetweenItem=10;
|
||||||
|
@ -405,7 +393,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=11;
|
LeftLetterFontSize=11;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=10;
|
LeftSpaceBetweenItem=10;
|
||||||
|
@ -451,7 +439,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=11;
|
LeftLetterFontSize=11;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=10;
|
LeftSpaceBetweenItem=10;
|
||||||
|
@ -497,7 +485,7 @@ void Style::initWidStyle()
|
||||||
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
RightMargin=LeftWidWidth-LeftMargin-LeftBtnWidth;
|
||||||
LeftFontSize=fontSize;
|
LeftFontSize=fontSize;
|
||||||
LeftLetterFontSize=11;
|
LeftLetterFontSize=11;
|
||||||
LeftIconSize=17;
|
LeftIconSize=19;
|
||||||
LeftSpaceIconLeft=15;
|
LeftSpaceIconLeft=15;
|
||||||
LeftSpaceIconText=14;
|
LeftSpaceIconText=14;
|
||||||
LeftSpaceBetweenItem=10;
|
LeftSpaceBetweenItem=10;
|
||||||
|
@ -528,3 +516,40 @@ void Style::initWidStyle()
|
||||||
SideBarSpaceBetweenItem=16;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -100,7 +100,6 @@ public:
|
||||||
static int minh;
|
static int minh;
|
||||||
static int defaultMainViewWidWidth;
|
static int defaultMainViewWidWidth;
|
||||||
static int defaultTopWidHeight;
|
static int defaultTopWidHeight;
|
||||||
static int defaultIconSize;
|
|
||||||
static int defaultQueryLineEditWidth;
|
static int defaultQueryLineEditWidth;
|
||||||
static int defaultQueryLineEditHeight;
|
static int defaultQueryLineEditHeight;
|
||||||
static int defaultQueryLineEditIconSize;
|
static int defaultQueryLineEditIconSize;
|
||||||
|
@ -165,6 +164,8 @@ public:
|
||||||
static int SideBarSpaceIconText; //按钮图标与文字内边距
|
static int SideBarSpaceIconText; //按钮图标与文字内边距
|
||||||
static int SideBarSpaceBetweenItem; //item间距
|
static int SideBarSpaceBetweenItem; //item间距
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void getScreenAvailableGeometry(); //获取屏幕可用区域
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STYLE_H
|
#endif // STYLE_H
|
||||||
|
|
|
@ -32,35 +32,32 @@ QString ConvertDesktopToWinId::tranIdToDesktop(WId id)
|
||||||
{
|
{
|
||||||
KWindowInfo info(id, 0, NET::WM2AllProperties);
|
KWindowInfo info(id, 0, NET::WM2AllProperties);
|
||||||
QString desktopName = confirmDesktopFile(info);
|
QString desktopName = confirmDesktopFile(info);
|
||||||
qDebug() << "desktopName is :" << desktopName;
|
myDebug() << "desktopName is :" << desktopName;
|
||||||
return desktopName;
|
return desktopName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
|
QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
|
||||||
{
|
{
|
||||||
m_desktopfilePath = "";
|
QString desktopFilePath = nullptr;
|
||||||
|
QDir dir = QDir(DESKTOP_FILE_PATH);
|
||||||
m_dir = new QDir(DEKSTOP_FILE_PATH);
|
QFileInfoList list = dir.entryInfoList();
|
||||||
m_list = m_dir->entryInfoList();
|
|
||||||
//跳过 ./ 和 ../ 目录
|
//跳过 ./ 和 ../ 目录
|
||||||
m_list.removeAll(QFile(USR_SHARE_APP_CURRENT));
|
list.removeAll(QFile(USR_SHARE_APP_CURRENT));
|
||||||
m_list.removeAll(QFile(USR_SHARE_APP_UPER));
|
list.removeAll(QFile(USR_SHARE_APP_UPER));
|
||||||
|
|
||||||
//第一种方法:获取点击应用时大部分desktop文件名
|
//第一种方法:获取点击应用时大部分desktop文件名
|
||||||
searchFromEnviron(info);
|
desktopFilePath = searchFromEnviron(info, list);
|
||||||
|
|
||||||
//第二种方法:比较名字一致性
|
//第二种方法:比较名字一致性
|
||||||
if (m_desktopfilePath.isEmpty()) {
|
if (desktopFilePath.isEmpty()) {
|
||||||
m_classClass = info.windowClassClass().toLower();
|
m_classClass = info.windowClassClass().toLower();
|
||||||
m_className = info.windowClassName();
|
m_className = info.windowClassName();
|
||||||
|
|
||||||
//匹配安卓兼容
|
//匹配安卓兼容
|
||||||
if (m_className == "kylin-kmre-window") {
|
if (m_className == "kylin-kmre-window") {
|
||||||
searchAndroidApp(info);
|
return searchAndroidApp(info);
|
||||||
return m_desktopfilePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QFile file(QString("/proc/%1/status").arg(info.pid()));
|
QFile file(QString("/proc/%1/status").arg(info.pid()));
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
@ -69,11 +66,11 @@ QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
|
||||||
m_statusName = QString::fromLocal8Bit(buf).remove("Name:").remove("\t").remove("\n");
|
m_statusName = QString::fromLocal8Bit(buf).remove("Name:").remove("\t").remove("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compareClassName();
|
desktopFilePath = compareClassName(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
//第三种方法:比较cmd命令行操作一致性
|
//第三种方法:比较cmd命令行操作一致性
|
||||||
if (m_desktopfilePath.isEmpty()) {
|
if (desktopFilePath.isEmpty()) {
|
||||||
QFile file(QString("/proc/%1/cmdline").arg(info.pid()));
|
QFile file(QString("/proc/%1/cmdline").arg(info.pid()));
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
@ -82,30 +79,30 @@ QString ConvertDesktopToWinId::confirmDesktopFile(KWindowInfo info)
|
||||||
m_cmdLine = QString::fromLocal8Bit(buf).remove("\n");
|
m_cmdLine = QString::fromLocal8Bit(buf).remove("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compareCmdExec();
|
desktopFilePath = compareCmdExec(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
//第四种方法:匹配部分字段
|
//第四种方法:匹配部分字段
|
||||||
if (m_desktopfilePath.isEmpty()) {
|
if (desktopFilePath.isEmpty()) {
|
||||||
compareLastStrategy();
|
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));
|
QDir androidDir = QString(QDir::homePath() + ANDROID_FILE_PATH);
|
||||||
m_androidList = m_androidDir->entryInfoList();
|
QFileInfoList androidList = androidDir.entryInfoList();
|
||||||
m_androidList.removeAll(QDir::homePath() + ANDROID_APP_CURRENT);
|
androidList.removeAll(QDir::homePath() + ANDROID_APP_CURRENT);
|
||||||
m_androidList.removeAll(QDir::homePath() + ANDROID_APP_UPER);
|
androidList.removeAll(QDir::homePath() + ANDROID_APP_UPER);
|
||||||
|
|
||||||
QFile file(QString("/proc/%1/cmdline").arg(info.pid()));
|
QFile file(QString("/proc/%1/cmdline").arg(info.pid()));
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QByteArray cmd = file.readAll();
|
QByteArray cmd = file.readAll();
|
||||||
file.close();
|
file.close();
|
||||||
QList<QByteArray> cmdList = cmd.split('\0');
|
QList<QByteArray> cmdList = cmd.split('\0');
|
||||||
for (int i = 0; i < m_androidList.size(); i++) {
|
for (int i = 0; i < androidList.size(); i++) {
|
||||||
QFileInfo fileInfo = m_androidList.at(i);
|
QFileInfo fileInfo = androidList.at(i);
|
||||||
QString desktopName = fileInfo.filePath();
|
QString desktopName = fileInfo.filePath();
|
||||||
if (!fileInfo.filePath().endsWith(".desktop")) {
|
if (!fileInfo.filePath().endsWith(".desktop")) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -113,59 +110,65 @@ void ConvertDesktopToWinId::searchAndroidApp(KWindowInfo info)
|
||||||
desktopName = desktopName.mid(desktopName.lastIndexOf("/") + 1);
|
desktopName = desktopName.mid(desktopName.lastIndexOf("/") + 1);
|
||||||
desktopName = desktopName.left(desktopName.lastIndexOf("."));
|
desktopName = desktopName.left(desktopName.lastIndexOf("."));
|
||||||
if(desktopName == cmdList.at(10)){
|
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");
|
QFile file("/proc/" + QString::number(info.pid()) + "/environ");
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QByteArray BA = file.readAll();
|
QByteArray BA = file.readAll();
|
||||||
file.close();
|
file.close();
|
||||||
QList<QByteArray> list_BA = BA.split('\0');
|
QList<QByteArray> list_BA = BA.split('\0');
|
||||||
|
|
||||||
|
QString desktopFilePath = nullptr;
|
||||||
for (int i = 0; i < list_BA.length(); i++) {
|
for (int i = 0; i < list_BA.length(); i++) {
|
||||||
if (list_BA.at(i).startsWith("GIO_LAUNCHED_DESKTOP_FILE=")) {
|
if (list_BA.at(i).startsWith("GIO_LAUNCHED_DESKTOP_FILE=")) {
|
||||||
m_desktopfilePath = list_BA.at(i);
|
desktopFilePath = list_BA.at(i);
|
||||||
m_desktopfilePath = m_desktopfilePath.mid(m_desktopfilePath.indexOf("=") + 1);
|
desktopFilePath = desktopFilePath.mid(desktopFilePath.indexOf("=") + 1);
|
||||||
//desktop文件地址需要重写
|
//desktop文件地址需要重写
|
||||||
m_desktopfilePath = m_desktopfilePath.mid(m_desktopfilePath.lastIndexOf("/") + 1);
|
desktopFilePath = desktopFilePath.mid(desktopFilePath.lastIndexOf("/") + 1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//desktop文件地址重写
|
//desktop文件地址重写
|
||||||
if (!m_desktopfilePath.isEmpty()) {
|
if (!desktopFilePath.isEmpty()) {
|
||||||
for (int i = 0; i < m_list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
QFileInfo fileInfo = m_list.at(i);;
|
QFileInfo fileInfo = list.at(i);
|
||||||
if (fileInfo.filePath() == DEKSTOP_FILE_PATH + m_desktopfilePath) {
|
if (fileInfo.filePath() == DESKTOP_FILE_PATH + desktopFilePath) {
|
||||||
m_desktopfilePath = fileInfo.filePath();
|
desktopFilePath = fileInfo.filePath();
|
||||||
|
return desktopFilePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return desktopFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertDesktopToWinId::compareClassName()
|
QString ConvertDesktopToWinId::compareClassName(QFileInfoList list)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
QFileInfo fileInfo = m_list.at(i);;
|
QFileInfo fileInfo = list.at(i);;
|
||||||
QString path_desktop_name = fileInfo.filePath();
|
QString pathDesktopName = fileInfo.filePath();
|
||||||
if (!fileInfo.filePath().endsWith(".desktop")) {
|
if (!fileInfo.filePath().endsWith(".desktop")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
|
pathDesktopName = pathDesktopName.mid(pathDesktopName.lastIndexOf("/") + 1);
|
||||||
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
|
pathDesktopName = pathDesktopName.left(pathDesktopName.lastIndexOf("."));
|
||||||
if (path_desktop_name == m_classClass || path_desktop_name == m_className || path_desktop_name == m_statusName) {
|
if (pathDesktopName == m_classClass || pathDesktopName == m_className || pathDesktopName == m_statusName) {
|
||||||
m_desktopfilePath = fileInfo.filePath();
|
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;
|
QString cmd;
|
||||||
QFileInfo fileInfo = m_list.at(i);
|
QFileInfo fileInfo = list.at(i);
|
||||||
if (!fileInfo.filePath().endsWith(".desktop")) {
|
if (!fileInfo.filePath().endsWith(".desktop")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -177,38 +180,38 @@ void ConvertDesktopToWinId::compareCmdExec()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desktopFileExeName == m_cmdLine || desktopFileExeName.startsWith(m_cmdLine) || m_cmdLine.startsWith(desktopFileExeName)) {
|
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;
|
||||||
desktopFileExeName = "/usr/lib/" + desktopFileExeName;
|
if (desktopFileExeName == m_cmdLine || desktopFileExeName.startsWith(m_cmdLine) || m_cmdLine.startsWith(desktopFileExeName)) {
|
||||||
if (desktopFileExeName == m_cmdLine || desktopFileExeName.startsWith(m_cmdLine) || m_cmdLine.startsWith(desktopFileExeName)) {
|
return fileInfo.filePath();
|
||||||
m_desktopfilePath = fileInfo.filePath();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//最后的匹配策略汇总
|
//最后的匹配策略汇总
|
||||||
void ConvertDesktopToWinId::compareLastStrategy()
|
QString ConvertDesktopToWinId::compareLastStrategy(QFileInfoList list)
|
||||||
{
|
{
|
||||||
compareCmdName();
|
QString desktopFilePath = compareCmdName(list);
|
||||||
|
|
||||||
if (m_desktopfilePath.isEmpty()) {
|
if (desktopFilePath.isEmpty()) {
|
||||||
compareDesktopClass();
|
desktopFilePath = compareDesktopClass(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_desktopfilePath.isEmpty()) {
|
if (desktopFilePath.isEmpty()) {
|
||||||
containsName();
|
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;
|
QString cmd;
|
||||||
QFileInfo fileInfo = m_list.at(i);
|
QFileInfo fileInfo = list.at(i);
|
||||||
if (!fileInfo.filePath().endsWith(".desktop")) {
|
if (!fileInfo.filePath().endsWith(".desktop")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -220,37 +223,39 @@ void ConvertDesktopToWinId::compareCmdName()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desktopFileExeName.startsWith(m_className) || desktopFileExeName.endsWith(m_className)) {
|
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++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
QFileInfo fileInfo = m_list.at(i);
|
QFileInfo fileInfo = list.at(i);
|
||||||
QString path_desktop_name = fileInfo.filePath();
|
QString pathDesktopName = fileInfo.filePath();
|
||||||
if (!fileInfo.filePath().endsWith(".desktop")) {
|
if (!fileInfo.filePath().endsWith(".desktop")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
|
pathDesktopName = pathDesktopName.mid(pathDesktopName.lastIndexOf("/") + 1);
|
||||||
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
|
pathDesktopName = pathDesktopName.left(pathDesktopName.lastIndexOf("."));
|
||||||
|
|
||||||
if (path_desktop_name.startsWith(m_className) || path_desktop_name.endsWith(m_className)) {
|
if (pathDesktopName.startsWith(m_className) || pathDesktopName.endsWith(m_className)) {
|
||||||
m_desktopfilePath = fileInfo.filePath();
|
return fileInfo.filePath();
|
||||||
}
|
}
|
||||||
else if (m_className.startsWith(path_desktop_name) || m_className.endsWith(path_desktop_name)) {
|
else if (m_className.startsWith(pathDesktopName) || m_className.endsWith(pathDesktopName)) {
|
||||||
m_desktopfilePath = fileInfo.filePath();
|
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;
|
QString cmd;
|
||||||
QFileInfo fileInfo = m_list.at(i);
|
QFileInfo fileInfo = list.at(i);
|
||||||
QString path_desktop_name = fileInfo.filePath();
|
QString pathDesktopName = fileInfo.filePath();
|
||||||
|
|
||||||
if (!fileInfo.filePath().endsWith(".desktop")) {
|
if (!fileInfo.filePath().endsWith(".desktop")) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -259,13 +264,14 @@ void ConvertDesktopToWinId::containsName()
|
||||||
cmd.sprintf(GET_DESKTOP_EXEC_NAME_MAIN, fileInfo.filePath().toStdString().data());
|
cmd.sprintf(GET_DESKTOP_EXEC_NAME_MAIN, fileInfo.filePath().toStdString().data());
|
||||||
QString desktopFileExeName = getDesktopFileName(cmd).remove("\n");
|
QString desktopFileExeName = getDesktopFileName(cmd).remove("\n");
|
||||||
|
|
||||||
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
|
pathDesktopName = pathDesktopName.mid(pathDesktopName.lastIndexOf("/") + 1);
|
||||||
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
|
pathDesktopName = pathDesktopName.left(pathDesktopName.lastIndexOf("."));
|
||||||
|
|
||||||
if (path_desktop_name.contains(m_className) || desktopFileExeName.contains(m_className)) {
|
if (pathDesktopName.contains(m_className) || desktopFileExeName.contains(m_className)) {
|
||||||
m_desktopfilePath = fileInfo.filePath();
|
return fileInfo.filePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//执行头文件中宏定义写好的终端指令获取对应的Exec字段
|
//执行头文件中宏定义写好的终端指令获取对应的Exec字段
|
||||||
|
@ -284,12 +290,4 @@ QString ConvertDesktopToWinId::getDesktopFileName(QString cmd)
|
||||||
|
|
||||||
ConvertDesktopToWinId::~ConvertDesktopToWinId()
|
ConvertDesktopToWinId::~ConvertDesktopToWinId()
|
||||||
{
|
{
|
||||||
if (m_dir != nullptr) {
|
|
||||||
delete m_dir;
|
|
||||||
m_dir = nullptr;
|
|
||||||
}
|
|
||||||
if (m_androidDir) {
|
|
||||||
delete m_androidDir;
|
|
||||||
m_androidDir = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
#include <QDir>
|
#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_CURRENT "/usr/share/applications/."
|
||||||
#define USR_SHARE_APP_UPER "/usr/share/applications/.."
|
#define USR_SHARE_APP_UPER "/usr/share/applications/.."
|
||||||
#define PEONY_TRASH "/usr/share/applications/peony-trash.desktop"
|
#define PEONY_TRASH "/usr/share/applications/peony-trash.desktop"
|
||||||
|
@ -36,10 +36,11 @@
|
||||||
#define ANDROID_APP_CURRENT "/.local/share/applications/."
|
#define ANDROID_APP_CURRENT "/.local/share/applications/."
|
||||||
#define ANDROID_APP_UPER "/.local/share/applications/.."
|
#define ANDROID_APP_UPER "/.local/share/applications/.."
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The ConvertDesktopToWinId class
|
* @brief The ConvertDesktopToWinId class
|
||||||
* 需要实现的功能,desktop文件与windowId的转换
|
* 需要实现的功能,desktop文件与windowId的转换
|
||||||
* 传入WindowId 转化为desktop文件路径
|
* 传入desktop文件的路径,转化为(int)WindowId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ConvertDesktopToWinId: public QObject
|
class ConvertDesktopToWinId: public QObject
|
||||||
|
@ -52,26 +53,20 @@ public:
|
||||||
QString tranIdToDesktop(WId id);
|
QString tranIdToDesktop(WId id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_desktopfilePath = nullptr;
|
|
||||||
QString m_classClass = nullptr;
|
QString m_classClass = nullptr;
|
||||||
QString m_className = nullptr;
|
QString m_className = nullptr;
|
||||||
QString m_statusName = nullptr;
|
QString m_statusName = nullptr;
|
||||||
QString m_cmdLine = nullptr;
|
QString m_cmdLine = nullptr;
|
||||||
|
|
||||||
QDir *m_dir = nullptr;
|
|
||||||
QDir *m_androidDir = nullptr;
|
|
||||||
QFileInfoList m_list;
|
|
||||||
QFileInfoList m_androidList;
|
|
||||||
|
|
||||||
QString confirmDesktopFile(KWindowInfo info);
|
QString confirmDesktopFile(KWindowInfo info);
|
||||||
void searchFromEnviron(KWindowInfo info);
|
QString searchFromEnviron(KWindowInfo info, QFileInfoList list);
|
||||||
void searchAndroidApp(KWindowInfo info);
|
QString searchAndroidApp(KWindowInfo info);
|
||||||
void compareClassName();
|
QString compareClassName(QFileInfoList list);
|
||||||
void compareCmdExec();
|
QString compareCmdExec(QFileInfoList list);
|
||||||
void compareLastStrategy();
|
QString compareLastStrategy(QFileInfoList list);
|
||||||
void compareCmdName();
|
QString compareCmdName(QFileInfoList list);
|
||||||
void compareDesktopClass();
|
QString compareDesktopClass(QFileInfoList list);
|
||||||
void containsName();
|
QString containsName(QFileInfoList list);
|
||||||
QString getDesktopFileName(QString cmd);
|
QString getDesktopFileName(QString cmd);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,27 +23,27 @@
|
||||||
FullItemDelegate::FullItemDelegate(QObject *parent, int module):
|
FullItemDelegate::FullItemDelegate(QObject *parent, int module):
|
||||||
QStyledItemDelegate(parent)
|
QStyledItemDelegate(parent)
|
||||||
{
|
{
|
||||||
this->module = module;
|
this->module=module;
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
pUkuiMenuInterface=new UkuiMenuInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullItemDelegate::~FullItemDelegate()
|
FullItemDelegate::~FullItemDelegate()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete pUkuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isValid()) {
|
|
||||||
|
if(index.isValid())
|
||||||
|
{
|
||||||
QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
|
QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
rect.setX(option.rect.x());
|
rect.setX(option.rect.x());
|
||||||
rect.setY(option.rect.y());
|
rect.setY(option.rect.y());
|
||||||
rect.setWidth(option.rect.width());
|
rect.setWidth(option.rect.width());
|
||||||
rect.setHeight(option.rect.height());
|
rect.setHeight(option.rect.height());
|
||||||
|
|
||||||
//QPainterPath画圆角矩形
|
//QPainterPath画圆角矩形
|
||||||
const qreal radius = 4;
|
const qreal radius = 4;
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
@ -56,9 +56,10 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||||
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
|
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
|
||||||
path.lineTo(rect.topRight() + QPointF(0, radius));
|
path.lineTo(rect.topRight() + QPointF(0, radius));
|
||||||
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
|
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();
|
// QColor color = option.palette.text().color();
|
||||||
// color.setAlphaF(0.15);
|
// color.setAlphaF(0.15);
|
||||||
painter->save();
|
painter->save();
|
||||||
|
@ -71,136 +72,130 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setOpacity(1);
|
painter->setOpacity(1);
|
||||||
QString desktopfp = index.data(Qt::DisplayRole).value<QString>();
|
QString desktopfp=index.data(Qt::DisplayRole).value<QString>();
|
||||||
QString iconstr = m_ukuiMenuInterface->getAppIcon(desktopfp);
|
QString iconstr=pUkuiMenuInterface->getAppIcon(desktopfp);
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
QFileInfo iconFileInfo(iconstr);
|
QFileInfo iconFileInfo(iconstr);
|
||||||
|
if(iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg")))
|
||||||
if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) {
|
icon=QIcon(iconstr);
|
||||||
icon = QIcon(iconstr);
|
else
|
||||||
} else {
|
{
|
||||||
iconstr.remove(".png");
|
iconstr.remove(".png");
|
||||||
iconstr.remove(".svg");
|
iconstr.remove(".svg");
|
||||||
icon = QIcon::fromTheme(iconstr);
|
icon=QIcon::fromTheme(iconstr);
|
||||||
|
if(icon.isNull())
|
||||||
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 (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"));
|
||||||
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"));
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/scalable/apps/%1.%2").arg(iconstr).arg("png"));
|
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/128x128/apps/%1.%2").arg(iconstr).arg("png"))) {
|
icon=QIcon(QString("/usr/share/icons/hicolor/96x96/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/96x96/apps/%1.%2").arg(iconstr).arg("svg")))
|
||||||
} else if (QFile::exists(QString("/usr/share/icons/hicolor/128x128/apps/%1.%2").arg(iconstr).arg("svg"))) {
|
icon=QIcon(QString("/usr/share/icons/hicolor/96x96/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/64x64/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/64x64/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/64x64/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/64x64/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/48x48/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/48x48/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/48x48/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/48x48/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/32x32/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/32x32/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/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/32x32/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/pixmaps/%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/pixmaps/%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/pixmaps/%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/pixmaps/%1.%2").arg(iconstr).arg("svg"));
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/32x32/apps/%1.%2").arg(iconstr).arg("svg"));
|
else
|
||||||
} else if (QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"))) {
|
icon=QIcon::fromTheme(QString("application-x-desktop"));
|
||||||
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"))) {
|
|
||||||
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 {
|
|
||||||
icon = QIcon::fromTheme(QString("application-x-desktop"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString appname = m_ukuiMenuInterface->getAppName(desktopfp);
|
QString appname=pUkuiMenuInterface->getAppName(desktopfp);
|
||||||
|
|
||||||
QRect iconRect;
|
QRect iconRect;
|
||||||
QRect textRect;
|
QRect textRect;
|
||||||
iconRect = QRect(rect.x() + Style::AppLeftSpace,
|
iconRect=QRect(rect.x()+Style::AppLeftSpace ,
|
||||||
rect.y() + Style::AppTopSpace,
|
rect.y()+Style::AppTopSpace,
|
||||||
Style::AppListIconSize,
|
Style::AppListIconSize,
|
||||||
Style::AppListIconSize);
|
Style::AppListIconSize);
|
||||||
icon.paint(painter, iconRect);
|
icon.paint(painter,iconRect);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
painter->save();
|
|
||||||
bool is_locked = false;
|
|
||||||
QFileInfo fileInfo(desktopfp);
|
|
||||||
QString desktopfn = fileInfo.fileName();
|
|
||||||
|
|
||||||
|
painter->save();
|
||||||
|
bool is_locked=false;
|
||||||
|
QFileInfo fileInfo(desktopfp);
|
||||||
|
QString desktopfn=fileInfo.fileName();
|
||||||
//添加固定图标
|
//添加固定图标
|
||||||
if (module == 0) {
|
if(module==0)
|
||||||
if (checkIfLocked(desktopfn)) {
|
{
|
||||||
is_locked = true;
|
if(checkIfLocked(desktopfn))
|
||||||
|
{
|
||||||
|
is_locked=true;
|
||||||
QIcon icon(QString(":/data/img/mainviewwidget/lock-fs.svg"));
|
QIcon icon(QString(":/data/img/mainviewwidget/lock-fs.svg"));
|
||||||
icon.paint(painter, QRect(iconRect.topRight().x() - 14, iconRect.topRight().y() - 2, 16, 16));
|
icon.paint(painter,QRect(iconRect.topRight().x()-14,iconRect.topRight().y()-2,16,16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
textRect = QRect(rect.x() + 5,
|
|
||||||
iconRect.bottom() + Style::AppSpaceBetweenIconText,
|
textRect=QRect(rect.x()+5,
|
||||||
rect.width() - 10,
|
iconRect.bottom()+Style::AppSpaceBetweenIconText,
|
||||||
rect.height() - iconRect.height() - Style::AppSpaceBetweenIconText);
|
rect.width()-10,
|
||||||
|
rect.height()-iconRect.height()-Style::AppSpaceBetweenIconText);
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
//添加最近安装蓝色标签
|
//添加最近安装蓝色标签
|
||||||
bool is_recentapp = false;
|
bool is_recentapp=false;
|
||||||
QFontMetrics fm = painter->fontMetrics();
|
QFontMetrics fm=painter->fontMetrics();
|
||||||
QString appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 10, Qt::TextShowMnemonic);
|
QString appnameElidedText=fm.elidedText(appname,Qt::ElideRight,rect.width()-10,Qt::TextShowMnemonic);
|
||||||
|
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);
|
||||||
|
|
||||||
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->setPen(QPen(Qt::NoPen));
|
||||||
painter->setBrush(QColor("#4d94ff"));
|
painter->setBrush(QColor("#4d94ff"));
|
||||||
int x = 0;
|
int x=0;
|
||||||
|
if(rect.width()<(23+fm.boundingRect(appname).width()))
|
||||||
if (rect.width() < (23 + fm.boundingRect(appname).width())) {
|
x=rect.x()+9;
|
||||||
x = rect.x() + 9;
|
else
|
||||||
} else {
|
x=rect.x()+(rect.width()-13-fm.boundingRect(appname).width())/2+4;
|
||||||
x = rect.x() + (rect.width() - 13 - fm.boundingRect(appname).width()) / 2 + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
painter->drawEllipse(QPoint(x,
|
painter->drawEllipse(QPoint(x,
|
||||||
textRect.y() + (fm.boundingRect(appname).height() - 8) / 2 + 4),
|
textRect.y()+(fm.boundingRect(appname).height()-8)/2+4),
|
||||||
4,
|
4,
|
||||||
4);
|
4);
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
// painter->setPen(QPen(option.palette.text().color()));
|
// painter->setPen(QPen(option.palette.text().color()));
|
||||||
painter->setPen(QPen(Qt::white));
|
painter->setPen(QPen(Qt::white));
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
painter->drawText(textRect, Qt::AlignHCenter | Qt::AlignTop, appnameElidedText);
|
painter->drawText(textRect,Qt::AlignHCenter |Qt::AlignTop,appnameElidedText);
|
||||||
// painter->drawText(textRect,Qt::TextWordWrap |Qt::AlignHCenter,appname);
|
// painter->drawText(textRect,Qt::TextWordWrap |Qt::AlignHCenter,appname);
|
||||||
painter->restore();
|
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;
|
{
|
||||||
|
int len=0;
|
||||||
if (!is_locked && is_recentapp) {
|
if(!is_locked && is_recentapp)
|
||||||
len = fm.boundingRect(appname).width() + 23;
|
len=fm.boundingRect(appname).width()+23;
|
||||||
} else {
|
else
|
||||||
len = fm.boundingRect(appname).width() + 10;
|
len=fm.boundingRect(appname).width()+10;
|
||||||
|
if(len>rect.width())
|
||||||
|
{
|
||||||
|
QToolTip::showText(QCursor::pos(),appname);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (len > rect.width()) {
|
|
||||||
QToolTip::showText(QCursor::pos(), appname);
|
|
||||||
} else {
|
|
||||||
QToolTip::hideText();
|
QToolTip::hideText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,20 +27,20 @@
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QHelpEvent>
|
#include <QHelpEvent>
|
||||||
#include "src/Interface/ukuimenuinterface.h"
|
#include "src/Interface/ukuimenuinterface.h"
|
||||||
|
#include "src/Style/style.h"
|
||||||
|
|
||||||
class FullItemDelegate : public QStyledItemDelegate
|
class FullItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FullItemDelegate(QObject *parent, int module);
|
FullItemDelegate(QObject* parent,int module);
|
||||||
~FullItemDelegate();
|
~FullItemDelegate();
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int module = 0;
|
int module=0;
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index);
|
// bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index);
|
||||||
|
|
|
@ -26,27 +26,22 @@
|
||||||
FullListView::FullListView(QWidget *parent, int module):
|
FullListView::FullListView(QWidget *parent, int module):
|
||||||
QListView(parent)
|
QListView(parent)
|
||||||
{
|
{
|
||||||
this->module = module;
|
this->module=module;
|
||||||
initWidget();
|
initWidget();
|
||||||
// inCurView = false;
|
// inCurView = false;
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
pUkuiMenuInterface=new UkuiMenuInterface;
|
||||||
// menu=new RightClickMenu;
|
// menu=new RightClickMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullListView::~FullListView()
|
FullListView::~FullListView()
|
||||||
{
|
{
|
||||||
// delete menu;
|
// delete menu;
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete pUkuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullListView::initWidget()
|
void FullListView::initWidget()
|
||||||
{
|
{
|
||||||
viewport()->setAttribute(Qt::WA_TranslucentBackground);
|
viewport()->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
viewport()->setStyleSheet("background:transparent");//在paint中绘制,滚动页面会导致透明效果绘制不及时出现黑影,将paintEvent替换为样式表
|
|
||||||
this->setAutoFillBackground(false);
|
|
||||||
this->setSelectionMode(QAbstractItemView::SingleSelection);
|
this->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
// if(module==1 || module==2)s
|
// if(module==1 || module==2)s
|
||||||
|
@ -56,38 +51,44 @@ void FullListView::initWidget()
|
||||||
this->setResizeMode(QListView::Adjust);
|
this->setResizeMode(QListView::Adjust);
|
||||||
this->setTextElideMode(Qt::ElideRight);
|
this->setTextElideMode(Qt::ElideRight);
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
// this->setFocusPolicy(Qt::StrongFocus);
|
// this->setFocusPolicy(Qt::StrongFocus);
|
||||||
this->setMovement(QListView::Static);
|
this->setMovement(QListView::Static);
|
||||||
this->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
this->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
this->setGridSize(QSize(Style::AppListGridSizeWidth, Style::AppListGridSizeWidth));
|
this->setGridSize(QSize(Style::AppListGridSizeWidth,Style::AppListGridSizeWidth));
|
||||||
this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
|
this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
this->setFrameShape(QFrame::NoFrame);//移除边框
|
this->setFrameShape(QFrame::NoFrame);//移除边框
|
||||||
this->setStyleSheet(QString::fromUtf8("QStandardItemModel#listmodel{border:3px solid #FFFFFF; }QWidget#widget:focus{ border:5px solid #A5A6A1; } "));
|
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::customContextMenuRequested,this,&FullListView::rightClickedSlot);
|
||||||
connect(this, &FullListView::clicked, this, &FullListView::onClicked);
|
|
||||||
flag = true;
|
connect(this,&FullListView::clicked,this,&FullListView::onClicked);
|
||||||
//翻页灵敏度时间调节
|
|
||||||
time = new QTimer(this);
|
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
|
||||||
connect(time, &QTimer::timeout, [ = ]() {
|
// {
|
||||||
if (flag == false) {
|
// gsetting = new QGSettings(QString("org.ukui.control-center.personalise").toLocal8Bit());
|
||||||
flag = true;
|
// if(gsetting->keys().contains(QString("transparency")))
|
||||||
time->stop();
|
// 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)
|
void FullListView::addData(QStringList data)
|
||||||
{
|
{
|
||||||
listmodel = new QStandardItemModel(this);
|
listmodel=new QStandardItemModel(this);
|
||||||
this->setModel(listmodel);
|
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);
|
QStandardItem* item=new QStandardItem;
|
||||||
|
item->setData(QVariant::fromValue<QString>(desktopfp),Qt::DisplayRole);
|
||||||
listmodel->appendRow(item);
|
listmodel->appendRow(item);
|
||||||
}
|
}
|
||||||
|
m_delegate= new FullItemDelegate(this,module);
|
||||||
m_delegate = new FullItemDelegate(this, module);
|
|
||||||
this->setItemDelegate(m_delegate);
|
this->setItemDelegate(m_delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,71 +107,66 @@ void FullListView::focusOutEvent(QFocusEvent *event)
|
||||||
void FullListView::updateData(QStringList data)
|
void FullListView::updateData(QStringList data)
|
||||||
{
|
{
|
||||||
listmodel->clear();
|
listmodel->clear();
|
||||||
|
Q_FOREACH(QString desktopfp,data)
|
||||||
Q_FOREACH (QString desktopfp, data) {
|
{
|
||||||
QStandardItem *item = new QStandardItem;
|
QStandardItem* item=new QStandardItem;
|
||||||
item->setData(QVariant::fromValue<QString>(desktopfp), Qt::DisplayRole);
|
item->setData(QVariant::fromValue<QString>(desktopfp),Qt::DisplayRole);
|
||||||
listmodel->appendRow(item);
|
listmodel->appendRow(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullListView::onClicked(QModelIndex index)
|
void FullListView::onClicked(QModelIndex index)
|
||||||
{
|
{
|
||||||
QVariant var = listmodel->data(index, Qt::DisplayRole);
|
QVariant var = listmodel->data(index, Qt::DisplayRole);
|
||||||
|
if(var.isValid())
|
||||||
|
{
|
||||||
|
QString desktopfp=var.value<QString>();
|
||||||
|
Q_EMIT sendItemClickedSignal(desktopfp);
|
||||||
|
|
||||||
if (var.isValid()) {
|
}
|
||||||
QString desktopfp = var.value<QString>();
|
|
||||||
Q_EMIT sendItemClickedSignal(desktopfp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullListView::rightClickedSlot(const QPoint &pos)
|
void FullListView::rightClickedSlot(const QPoint &pos)
|
||||||
{
|
{
|
||||||
Q_UNUSED(pos)
|
Q_UNUSED(pos)
|
||||||
|
if(!(this->selectionModel()->selectedIndexes().isEmpty()))
|
||||||
if (!(this->selectionModel()->selectedIndexes().isEmpty())) {
|
{
|
||||||
QModelIndex index = this->currentIndex();
|
QModelIndex index=this->currentIndex();
|
||||||
QVariant var = listmodel->data(index, Qt::DisplayRole);
|
QVariant var=listmodel->data(index, Qt::DisplayRole);
|
||||||
QString desktopfp = var.value<QString>();
|
QString desktopfp=var.value<QString>();
|
||||||
RightClickMenu menu;
|
RightClickMenu menu;
|
||||||
int ret = menu.showAppBtnMenu(this->mapToGlobal(pos), desktopfp);
|
int ret=menu.showAppBtnMenu(this->mapToGlobal(pos), desktopfp);
|
||||||
|
if(module>0)
|
||||||
if (module > 0) {
|
{
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 6:
|
case 6:
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
case 7:
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
break;
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
default:
|
}
|
||||||
break;
|
}
|
||||||
}
|
else{
|
||||||
} else {
|
switch (ret) {
|
||||||
switch (ret) {
|
case 1:
|
||||||
case 1:
|
Q_EMIT sendUpdateAppListSignal();
|
||||||
Q_EMIT sendUpdateAppListSignal();
|
break;
|
||||||
break;
|
case 2:
|
||||||
|
Q_EMIT sendUpdateAppListSignal();
|
||||||
case 2:
|
break;
|
||||||
Q_EMIT sendUpdateAppListSignal();
|
case 6:
|
||||||
break;
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
|
break;
|
||||||
case 6:
|
case 7:
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
case 7:
|
break;
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//this->selectionModel()->clear();
|
//this->selectionModel()->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,24 +183,25 @@ void FullListView::leaveEvent(QEvent *e)
|
||||||
Q_UNUSED(e);
|
Q_UNUSED(e);
|
||||||
this->verticalScrollBar()->setVisible(false);
|
this->verticalScrollBar()->setVisible(false);
|
||||||
// QWidget *current_focus_widget;
|
// QWidget *current_focus_widget;
|
||||||
// current_focus_widget = QApplication::focusWidget();
|
// current_focus_widget = QApplication::focusWidget();
|
||||||
// current_focus_widget = QWidget::focusWidget();
|
// current_focus_widget = QWidget::focusWidget();
|
||||||
// QPushButton *le= qobject_cast<QPushButton*>(current_focus_widget);
|
// QPushButton *le= qobject_cast<QPushButton*>(current_focus_widget);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullListView::selectFirstItem()
|
void FullListView::selectFirstItem()
|
||||||
{
|
{
|
||||||
qDebug() << "void FullListView::selectFirstItem()";
|
qDebug() << "void FullListView::selectFirstItem()";
|
||||||
|
if(this->currentIndex().row() == -1)
|
||||||
if (this->currentIndex().row() == -1) {
|
{
|
||||||
this->setCurrentIndex(this->model()->index(0, 0));
|
this->setCurrentIndex(this->model()->index(0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//void FullListView::paintEvent(QPaintEvent *e)
|
void FullListView::paintEvent(QPaintEvent *e)
|
||||||
//{
|
{
|
||||||
// double transparency=getTransparency();
|
double transparency=getTransparency();
|
||||||
// QPainter painter(this->viewport());
|
QPainter painter(this->viewport());
|
||||||
|
|
||||||
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
|
// if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
|
||||||
// {
|
// {
|
||||||
|
@ -236,93 +233,91 @@ void FullListView::selectFirstItem()
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// painter.setBrush(this->palette().base());
|
painter.setBrush(this->palette().base());
|
||||||
// painter.setPen(Qt::transparent);
|
painter.setPen(Qt::transparent);
|
||||||
// painter.setOpacity(transparency);
|
painter.setOpacity(transparency);
|
||||||
// painter.drawRect(this->rect());
|
painter.drawRect(this->rect());
|
||||||
// }
|
// }
|
||||||
// QListView::paintEvent(e);
|
QListView::paintEvent(e);
|
||||||
//}
|
}
|
||||||
|
|
||||||
void FullListView::keyPressEvent(QKeyEvent *e)
|
void FullListView::keyPressEvent(QKeyEvent* e)
|
||||||
{
|
{
|
||||||
if (flag) { //避免长按按键界面滚动过快
|
QRect center = visualRect(currentIndex());
|
||||||
flag = false;
|
if(e->type() == QEvent::KeyPress)
|
||||||
time->start(100);
|
{
|
||||||
QRect center = visualRect(currentIndex());
|
switch(e->key())
|
||||||
|
{
|
||||||
if (e->type() == QEvent::KeyPress) {
|
case Qt::Key_Enter:
|
||||||
switch (e->key()) {
|
case Qt::Key_Return:
|
||||||
case Qt::Key_Enter:
|
{
|
||||||
case Qt::Key_Return: {
|
QModelIndex index = this->currentIndex();
|
||||||
QModelIndex index = this->currentIndex();
|
Q_EMIT clicked(index);
|
||||||
Q_EMIT clicked(index);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case Qt::Key_Left:
|
||||||
|
{
|
||||||
case Qt::Key_Left: {
|
this->clearFocus();
|
||||||
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);
|
||||||
Q_EMIT sendSetslidebar(-Style::AppListGridSizeWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setFocus();
|
|
||||||
return QListView::keyPressEvent(e);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Qt::Key_Right: {
|
|
||||||
this->clearFocus();
|
|
||||||
|
|
||||||
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();
|
|
||||||
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();
|
|
||||||
Q_EMIT sendSetslidebar(Style::AppListGridSizeWidth);
|
|
||||||
this->setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QListView::keyPressEvent(e);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return QListView::keyPressEvent(e);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
this->setFocus();
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Qt::Key_Right:
|
||||||
|
{
|
||||||
|
|
||||||
|
this->clearFocus();
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
Q_EMIT sendSetslidebar(-Style::AppListGridSizeWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Qt::Key_Down:
|
||||||
|
{
|
||||||
|
if(module == 0)
|
||||||
|
{
|
||||||
|
if(mapToGlobal(center.bottomRight()).y() > (1080 - Style::AppListGridSizeWidth))
|
||||||
|
{
|
||||||
|
Q_EMIT sendSetslidebar(Style::AppListGridSizeWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullListView::mousePressEvent(QMouseEvent *event)
|
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();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return QListView::mousePressEvent(event);
|
return QListView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class FullListView : public QListView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FullListView(QWidget *parent, int module);
|
FullListView(QWidget *parent,int module);
|
||||||
~FullListView();
|
~FullListView();
|
||||||
|
|
||||||
void addData(QStringList data);//字母排序模块添加数据
|
void addData(QStringList data);//字母排序模块添加数据
|
||||||
|
@ -41,25 +41,23 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initWidget();
|
void initWidget();
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent* e);
|
||||||
void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent* e) Q_DECL_OVERRIDE;
|
||||||
void leaveEvent(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 focusInEvent(QFocusEvent *event);
|
||||||
void focusOutEvent(QFocusEvent *event);
|
void focusOutEvent(QFocusEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FullItemDelegate *m_delegate = nullptr;
|
FullItemDelegate* m_delegate=nullptr;
|
||||||
QStandardItemModel *listmodel = nullptr;
|
QStandardItemModel* listmodel=nullptr;
|
||||||
int module = 0;
|
int module=0;
|
||||||
double transparency;
|
double transparency;
|
||||||
RightClickMenu *menu = nullptr; //右键菜单
|
RightClickMenu* menu=nullptr;//右键菜单
|
||||||
QStringList data;
|
QStringList data;
|
||||||
QGSettings *gsetting;
|
QGSettings* gsetting;
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
|
||||||
bool flag;
|
|
||||||
QTimer *time = nullptr;
|
|
||||||
|
|
||||||
// bool inCurView;
|
// bool inCurView;
|
||||||
|
|
||||||
|
|
|
@ -22,30 +22,30 @@
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include "src/UtilityFunction/utility.h"
|
#include "src/UtilityFunction/utility.h"
|
||||||
|
|
||||||
ItemDelegate::ItemDelegate(QObject *parent, int module):
|
ItemDelegate::ItemDelegate(QObject* parent, int module):
|
||||||
QStyledItemDelegate(parent)
|
QStyledItemDelegate(parent)
|
||||||
{
|
{
|
||||||
this->module = module;
|
this->module=module;
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
pUkuiMenuInterface=new UkuiMenuInterface;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemDelegate::~ItemDelegate()
|
ItemDelegate::~ItemDelegate()
|
||||||
{
|
{
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
delete pUkuiMenuInterface;
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isValid()) {
|
if(index.isValid())
|
||||||
|
{
|
||||||
// QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
|
// QStyleOptionViewItem viewOption(option);//用来在视图中画一个item
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
rect.setX(option.rect.x());
|
rect.setX(option.rect.x());
|
||||||
rect.setY(option.rect.y());
|
rect.setY(option.rect.y());
|
||||||
rect.setWidth(option.rect.width());
|
rect.setWidth(option.rect.width());
|
||||||
rect.setHeight(option.rect.height() - 2);
|
rect.setHeight(option.rect.height()-2);
|
||||||
|
|
||||||
//QPainterPath画圆角矩形
|
//QPainterPath画圆角矩形
|
||||||
const qreal radius = 4;
|
const qreal radius = 4;
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
@ -58,10 +58,11 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
|
path.quadTo(rect.bottomRight(), rect.bottomRight() + QPointF(0, -radius));
|
||||||
path.lineTo(rect.topRight() + QPointF(0, radius));
|
path.lineTo(rect.topRight() + QPointF(0, radius));
|
||||||
path.quadTo(rect.topRight(), rect.topRight() + QPointF(-radius, -0));
|
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)) {
|
QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
|
if((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus))
|
||||||
|
{
|
||||||
QColor color = option.palette.text().color();
|
QColor color = option.palette.text().color();
|
||||||
color.setAlphaF(0.15);
|
color.setAlphaF(0.15);
|
||||||
painter->save();
|
painter->save();
|
||||||
|
@ -70,185 +71,168 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
painter->drawPath(path);
|
painter->drawPath(path);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->setOpacity(1);
|
painter->setOpacity(1);
|
||||||
|
|
||||||
if (module > 0) {
|
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);
|
if(strlist.at(1).toInt()==1)
|
||||||
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
|
{
|
||||||
|
QRect iconRect=QRect(rect.x()+11,rect.y()+(rect.height()-32)/2,32,32);
|
||||||
|
QString iconstr=pUkuiMenuInterface->getAppIcon(strlist.at(0));
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
QFileInfo iconFileInfo(iconstr);
|
QFileInfo iconFileInfo(iconstr);
|
||||||
|
if(iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg")))
|
||||||
if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) {
|
icon=QIcon(iconstr);
|
||||||
icon = QIcon(iconstr);
|
else
|
||||||
} else {
|
{
|
||||||
iconstr.remove(".png");
|
iconstr.remove(".png");
|
||||||
iconstr.remove(".svg");
|
iconstr.remove(".svg");
|
||||||
icon = QIcon::fromTheme(iconstr);
|
icon=QIcon::fromTheme(iconstr);
|
||||||
|
if(icon.isNull())
|
||||||
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(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"));
|
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"));
|
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"));
|
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"));
|
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"))) {
|
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png")))
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"));
|
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"));
|
||||||
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"))) {
|
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg")))
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"));
|
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"));
|
||||||
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"))) {
|
else
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"));
|
icon=QIcon::fromTheme(QString("application-x-desktop"));
|
||||||
} 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"))) {
|
|
||||||
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"))) {
|
|
||||||
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 {
|
|
||||||
icon = QIcon::fromTheme(QString("application-x-desktop"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
icon.paint(painter, iconRect, Qt::AlignCenter);
|
icon.paint(painter,iconRect,Qt::AlignLeft);
|
||||||
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
|
QString appname=pUkuiMenuInterface->getAppName(strlist.at(0));
|
||||||
QFontMetrics fm = painter->fontMetrics();
|
QFontMetrics fm=painter->fontMetrics();
|
||||||
QString appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 62, Qt::TextShowMnemonic);
|
QString appnameElidedText=fm.elidedText(appname,Qt::ElideRight,rect.width()-62,Qt::TextShowMnemonic);
|
||||||
painter->drawText(QRect(iconRect.right() + 15, rect.y(),
|
painter->drawText(QRect(iconRect.right()+15,rect.y(),
|
||||||
rect.width() - 62, rect.height()), Qt::AlignVCenter, appnameElidedText);
|
rect.width()-62,rect.height()),Qt::AlignVCenter,appnameElidedText);
|
||||||
painter->restore();
|
painter->restore();
|
||||||
painter->save();
|
painter->save();
|
||||||
QFileInfo fileInfo(strlist.at(0));
|
QFileInfo fileInfo(strlist.at(0));
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
|
if(checkIfRecent(desktopfn))
|
||||||
if (checkIfRecent(desktopfn)) {
|
{
|
||||||
painter->setPen(QPen(Qt::NoPen));
|
painter->setPen(QPen(Qt::NoPen));
|
||||||
painter->setBrush(QColor("#4d94ff"));
|
painter->setBrush(QColor("#4d94ff"));
|
||||||
painter->drawEllipse(QPoint(rect.topRight().x() - 22, 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->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();
|
{
|
||||||
|
int len=fm.boundingRect(appname).width();
|
||||||
if (len > rect.width() - 62) {
|
if(len>rect.width()-62)
|
||||||
QToolTip::showText(QCursor::pos(), appname);
|
{
|
||||||
} else {
|
QToolTip::showText(QCursor::pos(),appname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
QToolTip::hideText();
|
QToolTip::hideText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//绘制分割线
|
//绘制分割线
|
||||||
painter->save();
|
painter->save();
|
||||||
// QRect textRect=QRect(rect.x()+11,rect.y()+12,rect.width(),rect.height());
|
// QRect textRect=QRect(rect.x()+11,rect.y()+12,rect.width(),rect.height());
|
||||||
QRect textRect = QRect(rect.x() + 11, rect.y(), rect.width(), rect.height());
|
QRect textRect=QRect(rect.x()+11,rect.y(),rect.width(),rect.height());
|
||||||
painter->drawText(textRect, Qt::AlignVCenter, strlist.at(0));
|
painter->drawText(textRect,Qt::AlignVCenter,strlist.at(0));
|
||||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||||
painter->setPen(QPen(QColor(option.palette.text().color()), 1));
|
painter->setPen(QPen(QColor(option.palette.text().color()),1));
|
||||||
painter->setOpacity(0.1);
|
painter->setOpacity(0.1);
|
||||||
painter->drawLine(QPoint(5, rect.bottom()), QPoint(rect.right(), rect.bottom()));
|
painter->drawLine(QPoint(5,rect.bottom()),QPoint(rect.right(),rect.bottom()));
|
||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
QRect iconRect = QRect(rect.left() + 11, rect.y() + (rect.height() - 32) / 2, 32, 32);
|
}
|
||||||
QString iconstr = m_ukuiMenuInterface->getAppIcon(strlist.at(0));
|
else
|
||||||
|
{
|
||||||
|
QRect iconRect=QRect(rect.left()+11,rect.y()+(rect.height()-32)/2,32,32);
|
||||||
|
QString iconstr=pUkuiMenuInterface->getAppIcon(strlist.at(0));
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
QFileInfo iconFileInfo(iconstr);
|
QFileInfo iconFileInfo(iconstr);
|
||||||
|
if(iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg")))
|
||||||
if (iconFileInfo.isFile() && (iconstr.endsWith(".png") || iconstr.endsWith(".svg"))) {
|
icon=QIcon(iconstr);
|
||||||
icon = QIcon(iconstr);
|
else
|
||||||
} else {
|
{
|
||||||
iconstr.remove(".png");
|
iconstr.remove(".png");
|
||||||
iconstr.remove(".svg");
|
iconstr.remove(".svg");
|
||||||
icon = QIcon::fromTheme(iconstr);
|
icon=QIcon::fromTheme(iconstr);
|
||||||
|
if(icon.isNull())
|
||||||
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(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"));
|
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"));
|
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"));
|
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"));
|
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"))) {
|
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png")))
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("svg"));
|
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("png"));
|
||||||
} else if (QFile::exists(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"))) {
|
else if(QFile::exists(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg")))
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/48x48/apps/%1.%2").arg(iconstr).arg("png"));
|
icon=QIcon(QString("/usr/share/pixmaps/%1.%2").arg(iconstr).arg("svg"));
|
||||||
} else if (QFile::exists(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"))) {
|
else
|
||||||
icon = QIcon(QString("/usr/share/icons/hicolor/64x64/apps/%1.%2").arg(iconstr).arg("svg"));
|
icon=QIcon::fromTheme(QString("application-x-desktop"));
|
||||||
} 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"))) {
|
|
||||||
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"))) {
|
|
||||||
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 {
|
|
||||||
icon = QIcon::fromTheme(QString("application-x-desktop"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
icon.paint(painter,iconRect,Qt::AlignLeft);
|
||||||
icon.paint(painter, iconRect, Qt::AlignCenter);
|
QString appname=pUkuiMenuInterface->getAppName(strlist.at(0));
|
||||||
QString appname = m_ukuiMenuInterface->getAppName(strlist.at(0));
|
|
||||||
QFileInfo fileInfo(strlist.at(0));
|
QFileInfo fileInfo(strlist.at(0));
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
|
if(checkIfLocked(desktopfn))
|
||||||
if (checkIfLocked(desktopfn)) {
|
{
|
||||||
QIcon icon(QString(":/data/img/mainviewwidget/lock.svg"));
|
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->setOpacity(1);
|
||||||
painter->save();
|
painter->save();
|
||||||
|
if(checkIfRecent(desktopfn) && !checkIfLocked(desktopfn))
|
||||||
if (checkIfRecent(desktopfn) && !checkIfLocked(desktopfn)) {
|
{
|
||||||
painter->setPen(QPen(Qt::NoPen));
|
painter->setPen(QPen(Qt::NoPen));
|
||||||
painter->setBrush(QColor("#4d94ff"));
|
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->restore();
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setPen(QPen(option.palette.text().color()));
|
painter->setPen(QPen(option.palette.text().color()));
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
painter->setOpacity(1);
|
painter->setOpacity(1);
|
||||||
QFontMetrics fm = painter->fontMetrics();
|
QFontMetrics fm=painter->fontMetrics();
|
||||||
QString appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 62, Qt::TextShowMnemonic);
|
QString appnameElidedText=fm.elidedText(appname,Qt::ElideRight,rect.width()-62,Qt::TextShowMnemonic);
|
||||||
painter->drawText(QRect(iconRect.right() + 15, rect.y(),
|
painter->drawText(QRect(iconRect.right()+15,rect.y(),
|
||||||
rect.width() - 62, rect.height()), Qt::AlignVCenter, appnameElidedText);
|
rect.width()-62,rect.height()),Qt::AlignVCenter,appnameElidedText);
|
||||||
painter->restore();
|
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();
|
{
|
||||||
|
int len=fm.boundingRect(appname).width();
|
||||||
if (len > rect.width() - 62) {
|
if(len>rect.width()-62)
|
||||||
QToolTip::showText(QCursor::pos(), appname);
|
{
|
||||||
} else {
|
QToolTip::showText(QCursor::pos(),appname);
|
||||||
|
}
|
||||||
|
else {
|
||||||
QToolTip::hideText();
|
QToolTip::hideText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
// QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
|
// QStringList strlist=index.model()->data(index,Qt::DisplayRole).toStringList();
|
||||||
// if(strlist.at(1).toInt()==1)
|
// if(strlist.at(1).toInt()==1)
|
||||||
return QSize(298, 44);
|
return QSize(310,44);
|
||||||
// else
|
// else
|
||||||
// return QSize(310,48);
|
// return QSize(310,48);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,14 @@ public:
|
||||||
/**
|
/**
|
||||||
* @param module为0时为常用模块,1为字母模块、2为功能模块、3为搜索模块
|
* @param module为0时为常用模块,1为字母模块、2为功能模块、3为搜索模块
|
||||||
*/
|
*/
|
||||||
ItemDelegate(QObject *parent, int module);
|
ItemDelegate(QObject* parent,int module);
|
||||||
~ItemDelegate();
|
~ItemDelegate();
|
||||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int module = 0;
|
int module=0;
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ LetterClassifyButton::LetterClassifyButton(QWidget *parent,
|
||||||
this->setText(letter);
|
this->setText(letter);
|
||||||
this->setFocusPolicy(Qt::NoFocus);
|
this->setFocusPolicy(Qt::NoFocus);
|
||||||
this->setCheckable(true);
|
this->setCheckable(true);
|
||||||
this->setStyleSheet("padding: 0px;");
|
|
||||||
connect(this,&LetterClassifyButton::toggled,this,&LetterClassifyButton::reactToToggle);
|
connect(this,&LetterClassifyButton::toggled,this,&LetterClassifyButton::reactToToggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,21 +24,18 @@
|
||||||
ListView::ListView(QWidget *parent, int width, int height, int module):
|
ListView::ListView(QWidget *parent, int width, int height, int module):
|
||||||
QListView(parent)
|
QListView(parent)
|
||||||
{
|
{
|
||||||
this->w = width;
|
this->w=width;
|
||||||
this->h = height;
|
this->h=height;
|
||||||
this->module = module;
|
this->module=module;
|
||||||
initWidget();
|
initWidget();
|
||||||
m_ukuiMenuInterface = new UkuiMenuInterface;
|
|
||||||
menu = new RightClickMenu;
|
pUkuiMenuInterface=new UkuiMenuInterface;
|
||||||
|
menu=new RightClickMenu;
|
||||||
}
|
}
|
||||||
ListView::~ListView()
|
ListView::~ListView()
|
||||||
{
|
{
|
||||||
delete menu;
|
delete menu;
|
||||||
|
delete pUkuiMenuInterface;
|
||||||
if (m_ukuiMenuInterface != nullptr) {
|
|
||||||
delete m_ukuiMenuInterface;
|
|
||||||
m_ukuiMenuInterface = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::initWidget()
|
void ListView::initWidget()
|
||||||
|
@ -62,100 +59,94 @@ void ListView::initWidget()
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
|
this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
this->setFrameShape(QFrame::NoFrame);
|
this->setFrameShape(QFrame::NoFrame);
|
||||||
this->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
|
this->verticalScrollBar()->setProperty("drawScrollBarGroove",false);
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
connect(this, &ListView::customContextMenuRequested, this, &ListView::rightClickedSlot);
|
connect(this,&ListView::customContextMenuRequested,this,&ListView::rightClickedSlot);
|
||||||
connect(this, &ListView::clicked, this, &ListView::onClicked);
|
connect(this,&ListView::clicked,this,&ListView::onClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::addData(QVector<QStringList> data)
|
void ListView::addData(QVector<QStringList> data)
|
||||||
{
|
{
|
||||||
listmodel = new QStandardItemModel(this);
|
listmodel=new QStandardItemModel(this);
|
||||||
this->setModel(listmodel);
|
this->setModel(listmodel);
|
||||||
|
Q_FOREACH(QStringList desktopfp,data)
|
||||||
Q_FOREACH (QStringList desktopfp, data) {
|
{
|
||||||
QStandardItem *item = new QStandardItem;
|
QStandardItem* item=new QStandardItem;
|
||||||
item->setData(QVariant::fromValue<QStringList>(desktopfp), Qt::DisplayRole);
|
item->setData(QVariant::fromValue<QStringList>(desktopfp),Qt::DisplayRole);
|
||||||
listmodel->appendRow(item);
|
listmodel->appendRow(item);
|
||||||
}
|
}
|
||||||
|
m_delegate= new ItemDelegate(this,module);
|
||||||
m_delegate = new ItemDelegate(this, module);
|
|
||||||
this->setItemDelegate(m_delegate);
|
this->setItemDelegate(m_delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::updateData(QVector<QStringList> data)
|
void ListView::updateData(QVector<QStringList> data)
|
||||||
{
|
{
|
||||||
listmodel->clear();
|
listmodel->clear();
|
||||||
|
Q_FOREACH(QStringList desktopfp,data)
|
||||||
Q_FOREACH (QStringList desktopfp, data) {
|
{
|
||||||
QStandardItem *item = new QStandardItem;
|
QStandardItem* item=new QStandardItem;
|
||||||
item->setData(QVariant::fromValue<QStringList>(desktopfp), Qt::DisplayRole);
|
item->setData(QVariant::fromValue<QStringList>(desktopfp),Qt::DisplayRole);
|
||||||
listmodel->appendRow(item);
|
listmodel->appendRow(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Q_EMIT dataChanged(createIndex(0,0), createIndex(listmodel->rowCount()-1,0));
|
// Q_EMIT dataChanged(createIndex(0,0), createIndex(listmodel->rowCount()-1,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::onClicked(QModelIndex index)
|
void ListView::onClicked(QModelIndex index)
|
||||||
{
|
{
|
||||||
QVariant var = listmodel->data(index, Qt::DisplayRole);
|
QVariant var = listmodel->data(index, Qt::DisplayRole);
|
||||||
|
if(var.isValid())
|
||||||
if (var.isValid()) {
|
{
|
||||||
Q_EMIT sendItemClickedSignal(var.value<QStringList>());
|
Q_EMIT sendItemClickedSignal(var.value<QStringList>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::rightClickedSlot(const QPoint &pos)
|
void ListView::rightClickedSlot(const QPoint &pos)
|
||||||
{
|
{
|
||||||
if (!this->selectionModel()->selectedIndexes().isEmpty()) {
|
if(!this->selectionModel()->selectedIndexes().isEmpty())
|
||||||
QModelIndex index = this->currentIndex();
|
{
|
||||||
|
QModelIndex index=this->currentIndex();
|
||||||
// QRect center = visualRect(index);
|
// QRect center = visualRect(index);
|
||||||
QVariant var = listmodel->data(index, Qt::DisplayRole);
|
QVariant var=listmodel->data(index, Qt::DisplayRole);
|
||||||
QStringList strlist = var.value<QStringList>();
|
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));
|
int ret = menu->showAppBtnMenu(this->mapToGlobal(pos), strlist.at(0));
|
||||||
Q_EMIT sendMainWinActiveSignal(false);
|
if(module>0)
|
||||||
|
{
|
||||||
if (module > 0) {
|
if(strlist.at(1).toInt()==1)
|
||||||
if (strlist.at(1).toInt() == 1) {
|
{
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 6:
|
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7:
|
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (ret) {
|
|
||||||
case 1:
|
|
||||||
Q_EMIT sendUpdateAppListSignal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
Q_EMIT sendUpdateAppListSignal();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
Q_EMIT sendHideMainWindowSignal();
|
Q_EMIT sendHideMainWindowSignal();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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();
|
// this->selectionModel()->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,18 +176,19 @@ void ListView::leaveEvent(QEvent *e)
|
||||||
|
|
||||||
void ListView::paintEvent(QPaintEvent *e)
|
void ListView::paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
double transparency = getTransparency();
|
double transparency=getTransparency();
|
||||||
QPainter painter(this->viewport());
|
QPainter painter(this->viewport());
|
||||||
painter.setOpacity(transparency);
|
painter.setOpacity(transparency);
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
painter.setBrush(this->palette().base());
|
painter.setBrush(this->palette().base());
|
||||||
painter.fillRect(this->rect(), this->palette().base());
|
painter.fillRect(this->rect(), this->palette().base());
|
||||||
|
|
||||||
//滚动条
|
//滚动条
|
||||||
QPalette p = this->verticalScrollBar()->palette();
|
QPalette p=this->verticalScrollBar()->palette();
|
||||||
QColor color(255, 255, 255);
|
QColor color(255, 255, 255);
|
||||||
// QColor color=p.color(QPalette::Active,QPalette::Button);
|
// QColor color=p.color(QPalette::Active,QPalette::Button);
|
||||||
color.setAlphaF(0.25);
|
color.setAlphaF(0.25);
|
||||||
p.setColor(QPalette::Active, QPalette::Button, color);
|
p.setColor(QPalette::Active,QPalette::Button,color);
|
||||||
this->verticalScrollBar()->setPalette(p);
|
this->verticalScrollBar()->setPalette(p);
|
||||||
QListView::paintEvent(e);
|
QListView::paintEvent(e);
|
||||||
}
|
}
|
||||||
|
@ -207,14 +199,14 @@ void ListView::dragLeaveEvent(QDragLeaveEvent *e)
|
||||||
QStringList m_desktopfp = pressApp.value<QStringList>();
|
QStringList m_desktopfp = pressApp.value<QStringList>();
|
||||||
QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QFileInfo fileInfo(m_desktopfp.at(0));
|
QFileInfo fileInfo(m_desktopfp.at(0));
|
||||||
QString desktopfn = fileInfo.fileName();
|
QString desktopfn=fileInfo.fileName();
|
||||||
QFile file(m_desktopfp.at(0));
|
QFile file(m_desktopfp.at(0));
|
||||||
QString newname = QString(path + "/" + desktopfn);
|
QString newname=QString(path+"/"+desktopfn);
|
||||||
bool ret = file.copy(QString(path + "/" + desktopfn));
|
bool ret=file.copy(QString(path+"/"+desktopfn));
|
||||||
|
if(ret)
|
||||||
if (ret) {
|
{
|
||||||
char command[200];
|
char command[200];
|
||||||
sprintf(command, "chmod a+x %s", newname.toLocal8Bit().data());
|
sprintf(command,"chmod a+x %s",newname.toLocal8Bit().data());
|
||||||
QProcess::startDetached(QString::fromLocal8Bit(command));
|
QProcess::startDetached(QString::fromLocal8Bit(command));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,40 +217,42 @@ void ListView::mousePressEvent(QMouseEvent *event)
|
||||||
return QListView::mousePressEvent(event);
|
return QListView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::keyPressEvent(QKeyEvent *e)
|
void ListView::keyPressEvent(QKeyEvent* e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::KeyPress) {
|
if(e->type()==QEvent::KeyPress)
|
||||||
switch (e->key()) {
|
{
|
||||||
case Qt::Key_Enter:
|
switch(e->key())
|
||||||
case Qt::Key_Return: {
|
{
|
||||||
QModelIndex index = this->currentIndex();
|
case Qt::Key_Enter:
|
||||||
Q_EMIT clicked(index);
|
case Qt::Key_Return:
|
||||||
}
|
{
|
||||||
|
QModelIndex index=this->currentIndex();
|
||||||
|
Q_EMIT clicked(index);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
case Qt::Key_Down:
|
||||||
case Qt::Key_Down: {
|
{
|
||||||
if (currentIndex().row() == this->model()->rowCount() - 1) {
|
if(currentIndex().row() == this->model()->rowCount() - 1)
|
||||||
setCurrentIndex(this->model()->index(0, 0));
|
{
|
||||||
break;
|
setCurrentIndex(this->model()->index(0,0));
|
||||||
}
|
|
||||||
|
|
||||||
return QListView::keyPressEvent(e);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
case Qt::Key_Up: {
|
break;
|
||||||
if (currentIndex().row() == 0) {
|
}
|
||||||
setCurrentIndex(this->model()->index(this->model()->rowCount() - 1, 0));
|
case Qt::Key_Up:
|
||||||
break;
|
{
|
||||||
}
|
if(currentIndex().row() == 0)
|
||||||
|
{
|
||||||
return QListView::keyPressEvent(e);
|
setCurrentIndex(this->model()->index(this->model()->rowCount()-1,0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
default:
|
break;
|
||||||
return QListView::keyPressEvent(e);
|
}
|
||||||
break;
|
default:
|
||||||
|
return QListView::keyPressEvent(e);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,25 +43,25 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initWidget();
|
void initWidget();
|
||||||
void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
|
void enterEvent(QEvent* e) Q_DECL_OVERRIDE;
|
||||||
void leaveEvent(QEvent *e) Q_DECL_OVERRIDE;
|
void leaveEvent(QEvent* e) Q_DECL_OVERRIDE;
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent* e);
|
||||||
void dropEvent(QDropEvent *event);
|
void dropEvent(QDropEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void dragLeaveEvent(QDragLeaveEvent *e);
|
void dragLeaveEvent(QDragLeaveEvent *e);
|
||||||
void dragMoveEvent(QDragMoveEvent *event);
|
void dragMoveEvent(QDragMoveEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStandardItemModel *listmodel = nullptr;
|
QStandardItemModel* listmodel=nullptr;
|
||||||
int w = 0;
|
int w=0;
|
||||||
int h = 0;
|
int h=0;
|
||||||
int module = 0;
|
int module=0;
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface* pUkuiMenuInterface=nullptr;
|
||||||
|
|
||||||
RightClickMenu *menu = nullptr; //右键菜单
|
RightClickMenu* menu=nullptr;//右键菜单
|
||||||
QVector<QStringList> data;
|
QVector<QStringList> data;
|
||||||
ItemDelegate *m_delegate = nullptr;
|
ItemDelegate* m_delegate=nullptr;
|
||||||
int m_preRowCount;
|
int m_preRowCount;
|
||||||
QPoint startPos;
|
QPoint startPos;
|
||||||
// QMimeData *mimeData = nullptr;
|
// QMimeData *mimeData = nullptr;
|
||||||
|
@ -75,7 +75,6 @@ Q_SIGNALS:
|
||||||
void sendItemClickedSignal(QStringList arg);//发送item点击信号
|
void sendItemClickedSignal(QStringList arg);//发送item点击信号
|
||||||
void sendHideMainWindowSignal();
|
void sendHideMainWindowSignal();
|
||||||
void sendUpdateAppListSignal();
|
void sendUpdateAppListSignal();
|
||||||
void sendMainWinActiveSignal(bool flag);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LISTVIEW_H
|
#endif // LISTVIEW_H
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include "proxystyle.h"
|
#include "proxystyle.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
|
@ -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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef INTERNALSTYLE_H
|
#ifndef INTERNALSTYLE_H
|
||||||
#define INTERNALSTYLE_H
|
#define INTERNALSTYLE_H
|
||||||
#include <QProxyStyle>
|
#include <QProxyStyle>
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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
|
|
@ -30,9 +30,6 @@
|
||||||
|
|
||||||
#define DATABASENAME QDir::homePath()+"/.config/ukui/"+"UkuiMenu.db"
|
#define DATABASENAME QDir::homePath()+"/.config/ukui/"+"UkuiMenu.db"
|
||||||
|
|
||||||
bool isHuaWeiPC = false;
|
|
||||||
bool isPANGU = false;
|
|
||||||
|
|
||||||
const QPixmap loadSvg(const QString &fileName, const int size)
|
const QPixmap loadSvg(const QString &fileName, const int size)
|
||||||
{
|
{
|
||||||
QPixmap pixmap(size, size);
|
QPixmap pixmap(size, size);
|
||||||
|
@ -98,76 +95,6 @@ QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source)
|
||||||
return QPixmap::fromImage(img);
|
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 getTransparency()
|
||||||
{
|
{
|
||||||
double transparency=0.0;
|
double transparency=0.0;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
#include <QScreen>
|
|
||||||
#include <gio/gdesktopappinfo.h>
|
#include <gio/gdesktopappinfo.h>
|
||||||
#include "src/Interface/ukuimenuinterface.h"
|
#include "src/Interface/ukuimenuinterface.h"
|
||||||
|
|
||||||
|
@ -31,8 +30,12 @@
|
||||||
#define DBUS_PATH "/panel/position"
|
#define DBUS_PATH "/panel/position"
|
||||||
#define DBUS_INTERFACE "org.ukui.panel"
|
#define DBUS_INTERFACE "org.ukui.panel"
|
||||||
|
|
||||||
extern bool isHuaWeiPC;
|
enum PanelPositon{
|
||||||
extern bool isPANGU;
|
BOTTOM = 0,
|
||||||
|
TOP = 1,
|
||||||
|
LEFT = 2,
|
||||||
|
RIGHT = 3
|
||||||
|
};
|
||||||
|
|
||||||
const QPixmap loadSvg(const QString &fileName, const int size);
|
const QPixmap loadSvg(const QString &fileName, const int size);
|
||||||
|
|
||||||
|
@ -45,8 +48,6 @@ QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source);
|
||||||
//调试日志
|
//调试日志
|
||||||
void debugLog(QString strMsg);
|
void debugLog(QString strMsg);
|
||||||
|
|
||||||
QVariantList getScreenGeometry();
|
|
||||||
QRect getScreenAvailableGeometry();
|
|
||||||
double getTransparency();
|
double getTransparency();
|
||||||
QString getEnvOverriddenDesktopFile(int pid);
|
QString getEnvOverriddenDesktopFile(int pid);
|
||||||
//数据库操作
|
//数据库操作
|
||||||
|
|
|
@ -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>
|
|
@ -65,7 +65,6 @@ SOURCES += \
|
||||||
src/SideBarWidget/sidebarwidget.cpp \
|
src/SideBarWidget/sidebarwidget.cpp \
|
||||||
src/Style/style.cpp \
|
src/Style/style.cpp \
|
||||||
src/UtilityFunction/classifybtnscrollarea.cpp \
|
src/UtilityFunction/classifybtnscrollarea.cpp \
|
||||||
src/UtilityFunction/convertdesktoptowinid.cpp \
|
|
||||||
src/UtilityFunction/fullitemdelegate.cpp \
|
src/UtilityFunction/fullitemdelegate.cpp \
|
||||||
src/UtilityFunction/fulllistview.cpp \
|
src/UtilityFunction/fulllistview.cpp \
|
||||||
src/UtilityFunction/functionclassifybutton.cpp \
|
src/UtilityFunction/functionclassifybutton.cpp \
|
||||||
|
@ -104,7 +103,6 @@ HEADERS += \
|
||||||
src/SideBarWidget/sidebarwidget.h \
|
src/SideBarWidget/sidebarwidget.h \
|
||||||
src/Style/style.h \
|
src/Style/style.h \
|
||||||
src/UtilityFunction/classifybtnscrollarea.h \
|
src/UtilityFunction/classifybtnscrollarea.h \
|
||||||
src/UtilityFunction/convertdesktoptowinid.h \
|
|
||||||
src/UtilityFunction/fullitemdelegate.h \
|
src/UtilityFunction/fullitemdelegate.h \
|
||||||
src/UtilityFunction/fulllistview.h \
|
src/UtilityFunction/fulllistview.h \
|
||||||
src/UtilityFunction/functionclassifybutton.h \
|
src/UtilityFunction/functionclassifybutton.h \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!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>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="int">0</value>
|
<value type="qlonglong">0</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</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="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||||
<value type="int" key="EditorConfiguration.IndentSize">4</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.MouseHiding">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||||
<value type="int" key="EditorConfiguration.PaddingMode">1</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.ScrollWheelZooming">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</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.TabKeyBehavior">0</value>
|
||||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</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="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">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.inEntireDocument">false</value>
|
||||||
|
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
<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>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
|
<value type="QString" key="DeviceType">Desktop</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{9d9f9a2c-403b-48c4-83ee-e52b4e889b83}</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="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<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.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</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.QMakeForced">false</value>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</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>
|
</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.DefaultDisplayName">Build</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.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">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</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.MakeArguments">clean</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
|
||||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
|
||||||
</valuemap>
|
</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.DefaultDisplayName">Clean</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</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"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
<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.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</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.QMakeForced">false</value>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</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>
|
</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.DefaultDisplayName">Build</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.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">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</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.MakeArguments">clean</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
|
||||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
|
||||||
</valuemap>
|
</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.DefaultDisplayName">Clean</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</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"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
<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.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</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.QMakeForced">false</value>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
|
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</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>
|
</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.DefaultDisplayName">Build</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.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">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</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.MakeArguments">clean</value>
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
|
||||||
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
|
|
||||||
</valuemap>
|
</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.DefaultDisplayName">Clean</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</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"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
|
<value type="int" key="SeparateDebugInfo">0</value>
|
||||||
</valuemap>
|
</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.Target.DeployConfiguration.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.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.DefaultDisplayName">Deploy</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
<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>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
<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="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>
|
<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.Settings.UseGlobalSettings">true</value>
|
||||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||||
<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>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<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.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-menu9X0/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="QString" key="RunConfiguration.Arguments"></value>
|
|
||||||
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
|
|
||||||
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">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.UseQmlDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</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>
|
</valuemap>
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||||
<value type="int">1</value>
|
<value type="qlonglong">1</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
|
|
Loading…
Reference in New Issue