diff --git a/debian/changelog b/debian/changelog index b4d18d9..7f17c1f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +ukui-search (0.4.0+0520) v101; urgency=medium + + * Bug 55034,55545,55326,55496 + * 任务29459 + * 其他改动: + * Fix:Seletion is cleared when paletted changed. + - 修复收到palettechanged信号时列表选中状态消失的问题。 + * Fix:Icon in detail view will not refresh when icon-theme changed. + - 修复主题图标改变时详情页图标未更新的问题。 + * Fix:Index process crashed when parsing some wps templates. + - 修复了解析某些wps模板文件时索引崩溃的问题。 + * Fix:Block list conf won't work. + - 修复了在控制面板设置黑名单不能及时生效的问题。 + * Fix:Automatic completion won't work in next search after clicked actions in detial widget. + - 修复了点击详情页不会保存搜索历史记录的bug。 + + -- zhangpengfei Thu, 20 May 2021 09:08:15 +0800 + ukui-search (0.4.0+0508) v101; urgency=medium * Bug 49153. diff --git a/libchinese-segmentation/chinese-segmentation.cpp b/libchinese-segmentation/chinese-segmentation.cpp index ea80a67..477f5b7 100644 --- a/libchinese-segmentation/chinese-segmentation.cpp +++ b/libchinese-segmentation/chinese-segmentation.cpp @@ -52,10 +52,10 @@ ChineseSegmentation *ChineseSegmentation::getInstance() { return global_instance_chinese_segmentation; } -QVector ChineseSegmentation::callSegement(QString str) { - std::string s; - s = str.toStdString(); - str.squeeze(); +QVector ChineseSegmentation::callSegement(std::string s) { +// std::string s; +// s = str.toStdString(); +// str.squeeze(); const size_t topk = -1; std::vector keywordres; diff --git a/libchinese-segmentation/chinese-segmentation.h b/libchinese-segmentation/chinese-segmentation.h index 0950e84..b3c8090 100644 --- a/libchinese-segmentation/chinese-segmentation.h +++ b/libchinese-segmentation/chinese-segmentation.h @@ -47,7 +47,7 @@ class CHINESESEGMENTATION_EXPORT ChineseSegmentation { public: static ChineseSegmentation *getInstance(); ~ChineseSegmentation(); - QVector callSegement(QString str); + QVector callSegement(std::string s); void convert(std::vector& keywordres, QVector& kw); private: static QMutex m_mutex; diff --git a/libsearch/appsearch/app-match.cpp b/libsearch/appsearch/app-match.cpp index 5b0b55c..0e0269e 100644 --- a/libsearch/appsearch/app-match.cpp +++ b/libsearch/appsearch/app-match.cpp @@ -102,12 +102,12 @@ void AppMatch::getAllDesktopFilePath(QString path) { } else { //过滤LXQt、KDE QString filePathStr = fileInfo.filePath(); - if(filePathStr.contains("KDE", Qt::CaseInsensitive) || +// if(filePathStr.contains("KDE", Qt::CaseInsensitive) || // filePathStr.contains("mate",Qt::CaseInsensitive)|| - filePathStr.contains("LX", Qt::CaseInsensitive)) { - i++; - continue; - } +// filePathStr.contains("LX", Qt::CaseInsensitive)) { +// i++; +// continue; +// } //过滤后缀不是.desktop的文件 if(!filePathStr.endsWith(".desktop")) { i++; diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 8644fcf..2a441da 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -37,6 +37,14 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { // m_settings->setAtomicSyncRequired(false); m_block_dirs_settings = new QSettings(BLOCK_DIRS, QSettings::IniFormat, this); m_block_dirs_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); +// m_block_dirs_settings->setValue("These_are_block_dirs_conf_for_ukui_search","0"); +// m_block_dirs_settings->sync(); +// m_confWatcher = new QFileSystemWatcher(this); +// m_confWatcher->addPath(BLOCK_DIRS); +// connect(m_confWatcher, &QFileSystemWatcher::fileChanged, this, [ & ]() { +// m_block_dirs_settings->sync(); +// m_confWatcher->addPath(BLOCK_DIRS); +// }); m_search_record_settings = new QSettings(SEARCH_HISTORY, QSettings::IniFormat, this); m_search_record_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); diff --git a/libsearch/global-settings.h b/libsearch/global-settings.h index 3de9ded..7cc977a 100644 --- a/libsearch/global-settings.h +++ b/libsearch/global-settings.h @@ -26,6 +26,7 @@ #include #include #include +#include //#include //If use pkg_config, it wont build succes,why????????? //My demo can build access yet. @@ -49,9 +50,13 @@ #define PATH_NOT_IN_HOME 2; #define PATH_PARENT_BLOCKED 3; -#define MAIN_SETTINGS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search.conf" -#define BLOCK_DIRS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf" -#define SEARCH_HISTORY QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-history.conf" +//#define MAIN_SETTINGS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search.conf" +//#define BLOCK_DIRS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf" +//#define SEARCH_HISTORY QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-history.conf" + +#define MAIN_SETTINGS "/media/用户保险箱/.ukui-search/ukui-search.conf" +#define BLOCK_DIRS "/media/用户保险箱/.ukui-search/ukui-search-block-dirs.conf" +#define SEARCH_HISTORY "/media/用户保险箱/.ukui-search/ukui-search-history.conf" //#define CLOUD_HISTORY "history" //#define CLOUD_APPLICATIONS "applications" @@ -102,6 +107,7 @@ private: QSettings *m_search_record_settings; QMap m_cache; QStringList m_history; + QFileSystemWatcher *m_confWatcher; QMutex m_mutex; // size_t test = 0; diff --git a/libsearch/index/construct-document.cpp b/libsearch/index/construct-document.cpp index a479ba2..5be7af1 100644 --- a/libsearch/index/construct-document.cpp +++ b/libsearch/index/construct-document.cpp @@ -111,7 +111,7 @@ void ConstructDocumentForContent::run() { QString uniqueterm = QString::fromStdString(FileUtils::makeDocUterm(m_path)); QString upTerm = QString::fromStdString(FileUtils::makeDocUterm(m_path.section("/", 0, -2, QString::SectionIncludeLeadingSep))); - QVector term = ChineseSegmentation::getInstance()->callSegement(content.left(20480000)); + QVector term = ChineseSegmentation::getInstance()->callSegement(content.left(20480000).toStdString()); Document doc; doc.setData(content); diff --git a/libsearch/index/document.cpp b/libsearch/index/document.cpp index 6200c0c..68b21df 100644 --- a/libsearch/index/document.cpp +++ b/libsearch/index/document.cpp @@ -20,7 +20,7 @@ #include "document.h" #include using namespace Zeeker; -void Document::setData(QString data) { +void Document::setData(QString &data) { if(data.isEmpty()) return; m_document.set_data(data.toStdString()); diff --git a/libsearch/index/document.h b/libsearch/index/document.h index f6b8c20..d4549e8 100644 --- a/libsearch/index/document.h +++ b/libsearch/index/document.h @@ -39,7 +39,7 @@ public: m_index_text = other.m_index_text; m_unique_term = other.m_unique_term; } - void setData(QString data); + void setData(QString &data); void addPosting(std::string term, QVector offset, int weight = 1); void addPosting(std::string term, unsigned int offset, int weight = 1); void addTerm(QString term); diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index f60aaab..a170270 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -138,7 +138,12 @@ void FirstIndex::run() { // QtConcurrent::run([&](){ sem.acquire(1); mutex1.unlock(); - this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + QStringList pathList; + pathList.append("/media/用户保险箱"); + pathList.append("/media/邮件保险箱"); + pathList.append("/media/公共保险箱"); + pathList.append("/media/备份保险箱"); + this->setPath(pathList); this->Traverse(); FileUtils::_max_index_count = this->q_index->length(); qDebug() << "max_index_count:" << FileUtils::_max_index_count; diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index e650271..666d12c 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -32,8 +32,10 @@ #include -#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() -#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +//#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() +//#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +#define INDEX_PATH "/media/用户保险箱/.ukui-search/index_data" +#define CONTENT_INDEX_PATH "/media/用户保险箱/.ukui-search/content_index_data" using namespace Zeeker; @@ -354,7 +356,7 @@ Document IndexGenerator::GenerateContentDocument(const QString &path) { QString upTerm; FileReader::getTextContent(path, content); - term = ChineseSegmentation::getInstance()->callSegement(content); + term = ChineseSegmentation::getInstance()->callSegement(content.toStdString()); // QStringList term = content.split(""); doc.setData(content); diff --git a/libsearch/index/index-status-recorder.h b/libsearch/index/index-status-recorder.h index 25f8009..44dbd35 100644 --- a/libsearch/index/index-status-recorder.h +++ b/libsearch/index/index-status-recorder.h @@ -7,7 +7,7 @@ #define CONTENT_INDEX_DATABASE_STATE "content_index_database_state" #define INDEX_DATABASE_STATE "index_database_state" #define INOTIFY_NORMAL_EXIT "inotify_normal_exit" -#define INDEX_STATUS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-index-status.conf" +#define INDEX_STATUS "/media/用户保险箱/.ukui-search/ukui-search-index-status.conf" namespace Zeeker { //fixme: we need a better way to record index status. class IndexStatusRecorder : public QObject diff --git a/libsearch/index/inotify-index.cpp b/libsearch/index/inotify-index.cpp index 0396f9e..fd82521 100644 --- a/libsearch/index/inotify-index.cpp +++ b/libsearch/index/inotify-index.cpp @@ -37,7 +37,7 @@ QFileInfo fi(tmp); \ if(!fi.isSymLink()){ \ AddWatch(tmp); \ - setPath(tmp); \ + setPath(QStringList(tmp)); \ Traverse(); \ } @@ -46,7 +46,7 @@ CREATE_FILE_NAME_INDEX \ CREATE_FILE_CONTENT_INDEX using namespace Zeeker; -InotifyIndex::InotifyIndex(const QString& path) : Traverse_BFS(path) { +InotifyIndex::InotifyIndex(const QStringList &pathList) : Traverse_BFS(pathList) { qDebug() << "setInotifyMaxUserWatches start"; UkuiSearchQDBus usQDBus; usQDBus.setInotifyMaxUserWatches(); @@ -61,18 +61,21 @@ InotifyIndex::~InotifyIndex() { void InotifyIndex::firstTraverse() { QQueue bfs; - bfs.enqueue(this->path); - QFileInfoList list; - QDir dir; - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - this->AddWatch(i.absoluteFilePath()); - bfs.enqueue(i.absoluteFilePath()); + for(QString path : this->m_pathList) { + this->AddWatch(path); + bfs.enqueue(path); + QFileInfoList list; + QDir dir; + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + this->AddWatch(i.absoluteFilePath()); + bfs.enqueue(i.absoluteFilePath()); + } } } } @@ -248,8 +251,8 @@ void InotifyIndex::run() { m_fd = inotify_init(); qDebug() << "m_fd----------->" << m_fd; - this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); - this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); +// this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); +// this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); this->firstTraverse(); int fifo_fd; diff --git a/libsearch/index/inotify-index.h b/libsearch/index/inotify-index.h index fe3dd7b..5b5f72c 100644 --- a/libsearch/index/inotify-index.h +++ b/libsearch/index/inotify-index.h @@ -40,13 +40,13 @@ static InotifyIndex* global_instance_of_index = nullptr; class InotifyIndex : public QThread, public Traverse_BFS { Q_OBJECT public: - static InotifyIndex* getInstance(const QString& path) { + static InotifyIndex* getInstance(const QStringList &pathList) { if(!global_instance_of_index) { - global_instance_of_index = new InotifyIndex(path); + global_instance_of_index = new InotifyIndex(pathList); } return global_instance_of_index; } - InotifyIndex(const QString&); + InotifyIndex(const QStringList &pathList); ~InotifyIndex(); bool AddWatch(const QString&); diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index 70c1071..09a8577 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -301,7 +301,7 @@ int FileContentSearch::keywordSearchContent() { ret.erase(ret.begin(), ret.end()); ::friso::ResultMap().swap(ret); */ - QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword); + QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword.toStdString()); //Creat a query std::string words; for(int i = 0; i < sKeyWord.size(); i++) { @@ -645,7 +645,7 @@ int FileContentSearchV4::keywordSearchContent() ret.erase(ret.begin(), ret.end()); ::friso::ResultMap().swap(ret); */ - QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword); + QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword.toStdString()); //Creat a query std::string words; for(int i=0;igetBlockDirs(); while(!bfs.empty()) { dir.setPath(bfs.dequeue()); list = dir.entryInfoList(); @@ -810,8 +811,6 @@ void DirectSearch::run() { if (i.isDir() && (!(i.isSymLink()))) { bool findIndex = false; - - QStringList blockList = GlobalSettings::getInstance()->getBlockDirs(); for (QString j : blockList) { if (i.absoluteFilePath().startsWith(j.prepend("/"))) { findIndex = true; diff --git a/libsearch/index/search-manager.h b/libsearch/index/search-manager.h index bdb6404..2711450 100644 --- a/libsearch/index/search-manager.h +++ b/libsearch/index/search-manager.h @@ -44,9 +44,11 @@ #include "chinese-segmentation.h" -#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() -#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +//#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() +//#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +#define INDEX_PATH "/media/用户保险箱/.ukui-search/index_data" +#define CONTENT_INDEX_PATH "/media/用户保险箱/.ukui-search/content_index_data" namespace Zeeker { struct SearchResultInfo{ std::string filePath; diff --git a/libsearch/index/searchmethodmanager.cpp b/libsearch/index/searchmethodmanager.cpp index 0726abd..3f53581 100644 --- a/libsearch/index/searchmethodmanager.cpp +++ b/libsearch/index/searchmethodmanager.cpp @@ -15,7 +15,12 @@ void SearchMethodManager::searchMethod(FileUtils::SearchMethod sm) { qWarning() << "start inotify index"; // InotifyIndex ii("/home"); // ii.start(); - this->m_ii = InotifyIndex::getInstance("/home"); + QStringList pathList; + pathList.append("/media/用户保险箱"); + pathList.append("/media/邮件保险箱"); + pathList.append("/media/公共保险箱"); + pathList.append("/media/备份保险箱"); + this->m_ii = InotifyIndex::getInstance(pathList); if(!this->m_ii->isRunning()) { this->m_ii->start(); } diff --git a/libsearch/index/traverse_bfs.cpp b/libsearch/index/traverse_bfs.cpp index 97a5f13..e8c99c7 100644 --- a/libsearch/index/traverse_bfs.cpp +++ b/libsearch/index/traverse_bfs.cpp @@ -19,31 +19,36 @@ */ #include "traverse_bfs.h" using namespace Zeeker; -Traverse_BFS::Traverse_BFS(const QString& path) { - Q_ASSERT('/' == path.at(0)); - this->path = path; +Traverse_BFS::Traverse_BFS(const QStringList& pathList) { + for(QString path : pathList) { + Q_ASSERT('/' == path.at(0)); + } + + this->m_pathList = pathList; } void Traverse_BFS::Traverse() { QQueue bfs; - bfs.enqueue(this->path); - QFileInfoList list; - QDir dir; - // QDir::Hidden - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - bfs.enqueue(i.absoluteFilePath()); + for(QString path : m_pathList) { + bfs.enqueue(path); + QFileInfoList list; + QDir dir; + // QDir::Hidden + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + bfs.enqueue(i.absoluteFilePath()); + } + DoSomething(i); } - DoSomething(i); } } } -void Traverse_BFS::setPath(const QString& path) { - this->path = path; +void Traverse_BFS::setPath(const QStringList &pathList) { + this->m_pathList = pathList; } diff --git a/libsearch/index/traverse_bfs.h b/libsearch/index/traverse_bfs.h index a3388d0..e7e21ac 100644 --- a/libsearch/index/traverse_bfs.h +++ b/libsearch/index/traverse_bfs.h @@ -31,10 +31,10 @@ public: void Traverse(); virtual ~Traverse_BFS() = default; virtual void DoSomething(const QFileInfo&) = 0; - void setPath(const QString&); + void setPath(const QStringList &pathList); protected: - Traverse_BFS(const QString&); - QString path = "/home"; + Traverse_BFS(const QStringList &pathList); + QStringList m_pathList; private: Traverse_BFS(const Traverse_BFS&) = delete; void operator=(const Traverse_BFS&) = delete; diff --git a/libsearch/index/ukui-search-qdbus.cpp b/libsearch/index/ukui-search-qdbus.cpp index 05b3900..b03f340 100644 --- a/libsearch/index/ukui-search-qdbus.cpp +++ b/libsearch/index/ukui-search-qdbus.cpp @@ -38,7 +38,7 @@ UkuiSearchQDBus::~UkuiSearchQDBus() { //一键三连 void UkuiSearchQDBus::setInotifyMaxUserWatches() { // /proc/sys/fs/inotify/max_user_watches - this->tmpSystemQDBusInterface->call("setInotifyMaxUserWatchesStep1"); +// this->tmpSystemQDBusInterface->call("setInotifyMaxUserWatchesStep1"); // sysctl this->tmpSystemQDBusInterface->call("setInotifyMaxUserWatchesStep2"); // /etc/sysctl.conf diff --git a/libsearch/parser/binary-parser.cpp b/libsearch/parser/binary-parser.cpp index 698297a..0f927c5 100644 --- a/libsearch/parser/binary-parser.cpp +++ b/libsearch/parser/binary-parser.cpp @@ -4457,15 +4457,14 @@ bool bReadBuffer(FILE *pFile, ULONG ulStartBlock, ULONG ulBegin, ulIndex; size_t tLen; - for(ulIndex = ulStartBlock; - ulIndex != END_OF_CHAIN && tToRead != 0; - ulIndex = aulBlockDepot[ulIndex]) { + for(ulIndex = ulStartBlock;ulIndex != END_OF_CHAIN && tToRead != 0;ulIndex = aulBlockDepot[ulIndex]) { if(ulIndex >= (ULONG)tBlockDepotLen) { if(tBlockSize >= BIG_BLOCK_SIZE) { qWarning() << "The Big Block Depot is damaged"; } else { qWarning() << "The Small Block Depot is damaged"; } + return (tToRead == 0); } if(ulOffset >= (ULONG)tBlockSize) { ulOffset -= tBlockSize; diff --git a/libsearch/plugininterface/search-plugin-iface.h b/libsearch/plugininterface/search-plugin-iface.h index a2cb769..4b1345a 100644 --- a/libsearch/plugininterface/search-plugin-iface.h +++ b/libsearch/plugininterface/search-plugin-iface.h @@ -24,12 +24,13 @@ public: QIcon icon; QString name; QVector description; - QMap actionMap;//action name and action key + QStringList actionList; //all actions, take fist for double click action. + QString key; }; virtual ~SearchPluginIface() {} virtual QString getPluginName() = 0; virtual void KeywordSearch(QString keyword,QQueue *searchResult) = 0; - virtual void openAction(QString name, QString key) = 0; + virtual void openAction(QString action, QString key) = 0; }; } diff --git a/libsearch/settingsearch/setting-match.cpp b/libsearch/settingsearch/setting-match.cpp index d9635d2..89b3c9e 100644 --- a/libsearch/settingsearch/setting-match.cpp +++ b/libsearch/settingsearch/setting-match.cpp @@ -19,6 +19,7 @@ */ #include "setting-match.h" #include "file-utils.h" +#include using namespace Zeeker; SettingsMatch::SettingsMatch(QObject *parent) : QObject(parent) { xmlElement(); @@ -44,6 +45,8 @@ QStringList SettingsMatch::startMatchApp(const QString &source) { void SettingsMatch::xmlElement() { QString ChineseIndex; QString EnglishIndex; + QString path = QProcessEnvironment::systemEnvironment().value("XDG_SESSION_TYPE"); + QString version; QFile file(QString::fromLocal8Bit("/usr/share/ukui-control-center/shell/res/search.xml")); if(!file.open(QIODevice::ReadOnly)) { return; @@ -62,6 +65,12 @@ void SettingsMatch::xmlElement() { QDomNodeList list = element.childNodes(); for(int i = 0; i < list.count(); ++i) { QDomNode n = list.at(i); + if(n.nodeName()==QString::fromLocal8Bit("Environment")){ + version=n.toElement().text(); + if((version=="v101"&&path=="wayland")||(version=="hw990"&&path=="x11")){ + break; + } + } if(n.nodeName() == QString::fromLocal8Bit("ChinesePlugin")) { ChineseIndex = n.toElement().text(); } diff --git a/src/content-widget.cpp b/src/content-widget.cpp index 532c6c6..e289b41 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -52,6 +52,9 @@ ContentWidget::~ContentWidget() { * @brief initUI 初始化homepage和resultpage */ void ContentWidget::initUI() { + QPalette pal = palette(); + pal.setColor(QPalette::Base, QColor(0, 0, 0, 0)); + pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); //使用此palette的窗口背景将为透明 m_homePage = new QWidget(this); m_homePageLyt = new QVBoxLayout(m_homePage); m_homePageLyt->setSpacing(0); @@ -79,7 +82,6 @@ void ContentWidget::initUI() { m_detailLyt = new QVBoxLayout(m_resultDetail); m_resultList->setFixedWidth(236); m_resultList->setFixedHeight(0); - m_resultList->setStyleSheet("QWidget{background:transparent;}"); m_listLyt->setContentsMargins(0, 0, 12, 0); m_listLyt->setSpacing(0); m_resultListArea->setWidget(m_resultList); @@ -89,10 +91,13 @@ void ContentWidget::initUI() { clearLayout(m_homePageLyt); initHomePage(); }); + connect(m_detailView, &SearchDetailView::actionTriggerd, this, &ContentWidget::effectiveSearch); m_resultDetailArea->setWidget(m_detailView); m_resultDetailArea->setWidgetResizable(true); - m_resultListArea->setStyleSheet("QScrollArea{background: transparent;}"); - m_resultDetailArea->setStyleSheet("QScrollArea{background: transparent; border-radius: 4px;}"); + m_resultListArea->setFrameShape(QFrame::NoFrame); + m_resultDetailArea->setFrameShape(QFrame::NoFrame); + m_resultListArea->setPalette(pal); + m_resultDetailArea->setPalette(pal); this->addWidget(m_homePage); this->addWidget(m_resultPage); @@ -226,7 +231,7 @@ void ContentWidget::initListView() { this->resetListHeight(); }); - connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) { + connect(qApp, &QApplication::paletteChanged, this, [ = ]() { m_fileListView->refresh(); m_dirListView->refresh(); m_contentListView->refresh(); @@ -279,7 +284,7 @@ void ContentWidget::setupConnect(SearchListView * listview) { connect(listview, &SearchListView::currentSelectPos, [ = ](QPoint pos) { m_resultListArea->ensureVisible(pos.x(), pos.y()); }); - connect(listview, &SearchListView::mousePressed, this, &ContentWidget::mousePressed); + connect(listview, &SearchListView::mousePressed, this, &ContentWidget::effectiveSearch); connect(listview, &SearchListView::currentRowChanged, this, &ContentWidget::onListViewRowChanged); connect(listview, &SearchListView::onRowDoubleClicked, this, &ContentWidget::onListViewRowDoubleClicked); } diff --git a/src/content-widget.h b/src/content-widget.h index 5f5132b..d57e956 100644 --- a/src/content-widget.h +++ b/src/content-widget.h @@ -109,7 +109,7 @@ private: Q_SIGNALS: void currentItemChanged(); - void mousePressed(); + void effectiveSearch(); private Q_SLOTS: void clearLayout(QLayout *); diff --git a/src/control/config-file.h b/src/control/config-file.h index 41bb24d..e7ec5a6 100644 --- a/src/control/config-file.h +++ b/src/control/config-file.h @@ -25,7 +25,7 @@ #include #include #include -#define HOMEPAGE_SETTINGS QDir::homePath()+"/.config/org.ukui/ukui-search/ukui-search-homepage.conf" +#define HOMEPAGE_SETTINGS "media/用户保险箱/.ukui-search/ukui-search-homepage.conf" namespace Zeeker { class ConfigFile : public QObject { Q_OBJECT diff --git a/src/control/folder-list-item.cpp b/src/control/folder-list-item.cpp index bc50e72..318d5b4 100644 --- a/src/control/folder-list-item.cpp +++ b/src/control/folder-list-item.cpp @@ -53,8 +53,9 @@ void FolderListItem::initUi() { m_iconLabel->setPixmap(QIcon::fromTheme("inode-directory").pixmap(QSize(16, 16))); m_pathLabel->setText(m_path); m_delLabel->setText(tr("Delete the folder out of blacklist")); - m_pathLabel->setStyleSheet("QLabel{color: palette(text); background: transparent;}"); - m_delLabel->setStyleSheet("QLabel{color: #3790FA; background: transparent;}"); + QPalette pal = palette(); + pal.setColor(QPalette::WindowText, QColor(55, 144, 250, 255)); + m_delLabel->setPalette(pal); m_delLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_delLabel->installEventFilter(this); m_delLabel->hide(); diff --git a/src/control/home-page-item.cpp b/src/control/home-page-item.cpp index 5fe596d..0201d97 100644 --- a/src/control/home-page-item.cpp +++ b/src/control/home-page-item.cpp @@ -56,7 +56,6 @@ void HomePageItem::setupUi(const int& type, const QString& path) { m_type = type; m_widget = new QWidget(this); m_widget->setObjectName("MainWidget"); -// m_widget->setStyleSheet("QWidget#MainWidget{background: rgba(0, 0, 0, 0.05); border-radius: 4px;}"); m_widget->installEventFilter(this); m_iconlabel = new QLabel(m_widget); m_namelabel = new QLabel(m_widget); diff --git a/src/control/option-view.cpp b/src/control/option-view.cpp index fb9117f..e188a0f 100644 --- a/src/control/option-view.cpp +++ b/src/control/option-view.cpp @@ -91,48 +91,52 @@ void OptionView::setupOptions(const int& type, bool is_appInstalled) { void OptionView::initUI() { + QPalette pal = palette(); + pal.setColor(QPalette::WindowText, NORMAL_COLOR); + pal.setColor(QPalette::Light, HOVER_COLOR); + pal.setColor(QPalette::Dark, PRESS_COLOR); m_optionFrame = new QFrame(this); m_optionLyt = new QVBoxLayout(m_optionFrame); m_optionLyt->setContentsMargins(8, 0, 0, 0); m_openLabel = new QLabel(m_optionFrame); m_openLabel->setText(tr("Open")); //打开 - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openLabel->setPalette(pal); m_openLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_openLabel->installEventFilter(this); m_optionLyt->addWidget(m_openLabel); m_shortcutLabel = new QLabel(m_optionFrame); m_shortcutLabel->setText(tr("Add Shortcut to Desktop")); //添加到桌面快捷方式 - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_shortcutLabel->setPalette(pal); m_shortcutLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_shortcutLabel->installEventFilter(this); m_optionLyt->addWidget(m_shortcutLabel); m_panelLabel = new QLabel(m_optionFrame); m_panelLabel->setText(tr("Add Shortcut to Panel")); //添加到任务栏快捷方式 - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_panelLabel->setPalette(pal); m_panelLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_panelLabel->installEventFilter(this); m_optionLyt->addWidget(m_panelLabel); m_openPathLabel = new QLabel(m_optionFrame); m_openPathLabel->setText(tr("Open path")); //打开所在路径 - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openPathLabel->setPalette(pal); m_openPathLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_openPathLabel->installEventFilter(this); m_optionLyt->addWidget(m_openPathLabel); m_copyPathLabel = new QLabel(m_optionFrame); m_copyPathLabel->setText(tr("Copy path")); //复制所在路径 - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_copyPathLabel->setPalette(pal); m_copyPathLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_copyPathLabel->installEventFilter(this); m_optionLyt->addWidget(m_copyPathLabel); m_installLabel = new QLabel(m_optionFrame); m_installLabel->setText(tr("Install")); //复制所在路径 - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_installLabel->setPalette(pal); m_installLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_installLabel->installEventFilter(this); m_optionLyt->addWidget(m_installLabel); @@ -235,92 +239,92 @@ void OptionView::setupSettingOptions() { bool OptionView::eventFilter(QObject *watched, QEvent *event) { if(m_openLabel && watched == m_openLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_openLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Open); return true; } else if(event->type() == QEvent::Enter) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_openLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_shortcutLabel && watched == m_shortcutLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_shortcutLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_shortcutLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Shortcut); return true; } else if(event->type() == QEvent::Enter) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_shortcutLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_shortcutLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_panelLabel && watched == m_panelLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_panelLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_panelLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Panel); return true; } else if(event->type() == QEvent::Enter) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_panelLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_panelLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_openPathLabel && watched == m_openPathLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_openPathLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openPathLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::OpenPath); return true; } else if(event->type() == QEvent::Enter) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_openPathLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openPathLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_copyPathLabel && watched == m_copyPathLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_copyPathLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_copyPathLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::CopyPath); return true; } else if(event->type() == QEvent::Enter) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_copyPathLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_copyPathLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_installLabel && watched == m_installLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_installLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_installLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Install); return true; } else if(event->type() == QEvent::Enter) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_installLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_installLabel->setForegroundRole(QPalette::WindowText); return true; } } diff --git a/src/control/option-view.h b/src/control/option-view.h index bc368e0..4ac1319 100644 --- a/src/control/option-view.h +++ b/src/control/option-view.h @@ -28,6 +28,10 @@ #include #include "search-list-view.h" +#define NORMAL_COLOR QColor(55, 144, 250, 255) +#define HOVER_COLOR QColor(64, 169, 251, 255) +#define PRESS_COLOR QColor(41, 108, 217, 255) + namespace Zeeker { class OptionView : public QWidget { Q_OBJECT diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index 319cbeb..291547f 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -217,7 +217,8 @@ void SearchDetailView::setAppWidget(const QString &appname, const QString &path, QFontMetrics fontMetrics = m_nameLabel->fontMetrics(); QString showname = fontMetrics.elidedText(m_name, Qt::ElideRight, 274); //当字体长度超过215时显示为省略号 - m_nameLabel->setText(showname); +// m_nameLabel->setText(showname); + m_nameLabel->setText(QString("

%1

").arg(escapeHtml(showname))); if(QString::compare(showname, m_name)) { m_nameLabel->setToolTip(m_name); } @@ -350,18 +351,19 @@ void SearchDetailView::setupWidget(const int& type, const QString& path) { QFontMetrics fontMetrics = m_nameLabel->fontMetrics(); QString wholeName = FileUtils::getFileName(path); QString name = fontMetrics.elidedText(wholeName, Qt::ElideRight, 274); - m_nameLabel->setText(name); +// m_nameLabel->setText(name); + m_nameLabel->setText(QString("

%1

").arg(escapeHtml(name))); if(QString::compare(name, wholeName)) { m_nameLabel->setToolTip(wholeName); } - m_nameLabel->setTextFormat(Qt::PlainText); //显示纯文本 m_typeLabel->setText(tr("Document")); break; } case SearchListView::ResType::Setting : { setIcon(path); QString settingType = path.mid(path.indexOf("/") + 1, path.lastIndexOf("/") - path.indexOf("/") - 1); //配置项所属控制面板插件名 - m_nameLabel->setText(settingType); +// m_nameLabel->setText(settingType); + m_nameLabel->setText(QString("

%1

").arg(escapeHtml(settingType))); m_typeLabel->setText(FileUtils::getSettingName(path)); break; } @@ -404,6 +406,7 @@ void SearchDetailView::execActions(const int& type, const int& option, const QSt default: break; } + Q_EMIT this->actionTriggerd(); } /** @@ -462,8 +465,6 @@ void SearchDetailView::initUI() { m_layout = new QVBoxLayout(this); this->setLayout(m_layout); m_layout->setContentsMargins(16, 60, 16, 24); - this->setObjectName("detailView"); - this->setStyleSheet("QWidget#detailView{background:transparent;}"); this->setFixedWidth(378); //没有网络的时候的提示信息 @@ -491,8 +492,7 @@ void SearchDetailView::initUI() { m_nameLayout = new QHBoxLayout(m_nameFrame); m_nameLabel = new QLabel(m_nameFrame); m_typeLabel = new QLabel(m_nameFrame); - m_nameLabel->setStyleSheet("QLabel{font-size: 18px;}"); - m_typeLabel->setStyleSheet("QLabel{font-size: 14px; color: palette(mid);}"); + m_typeLabel->setEnabled(false); m_nameFrame->setFixedHeight(48); m_nameLabel->setMaximumWidth(280); m_nameLayout->addWidget(m_nameLabel); diff --git a/src/control/search-detail-view.h b/src/control/search-detail-view.h index a06cf87..0d5770a 100644 --- a/src/control/search-detail-view.h +++ b/src/control/search-detail-view.h @@ -105,6 +105,7 @@ private: Q_SIGNALS: void configFileChanged(); + void actionTriggerd(); private Q_SLOTS: void execActions(const int&, const int&, const QString&); void refreshIcon(); diff --git a/src/control/search-list-view.cpp b/src/control/search-list-view.cpp index 53989ab..fb923fc 100644 --- a/src/control/search-list-view.cpp +++ b/src/control/search-list-view.cpp @@ -21,12 +21,11 @@ #include "search-list-view.h" #include #include -#include "custom-style.h" using namespace Zeeker; SearchListView::SearchListView(QWidget * parent, const QStringList& list, const int& type) : QTreeView(parent) { -// CustomStyle * style = new CustomStyle(GlobalSettings::getInstance()->getValue(STYLE_NAME_KEY).toString()); - this->setStyle(CustomStyle::getStyle()); + this->setFrameShape(QFrame::NoFrame); + this->viewport()->setAutoFillBackground(false); setRootIsDecorated(false); this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -43,7 +42,6 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const // this->setFixedHeight(list.count() * rowheight + 4); this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAutoFillBackground(false); -// this->setStyleSheet("QWidget{background:transparent;}"); m_styleDelegate = new HighlightItemDelegate(this); // m_styleDelegate->setSearchKeyword(keyword); this->setItemDelegate(m_styleDelegate); @@ -130,13 +128,6 @@ void SearchListView::clear() { */ void SearchListView::refresh() { - QModelIndex index = this->currentIndex(); - m_model->refresh(); - if(index.row() >= 0 && index.row() < m_model->length() && m_isSelected) { - this->blockSignals(true); - this->setCurrentIndex(index); - this->blockSignals(false); - } rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())) + 1; this->setFixedHeight(m_item->getCurrentSize() * rowheight + 4); } diff --git a/src/control/show-more-label.cpp b/src/control/show-more-label.cpp index f9888f4..ae0d880 100644 --- a/src/control/show-more-label.cpp +++ b/src/control/show-more-label.cpp @@ -47,6 +47,8 @@ bool ShowMoreLabel::getExpanded() { } void ShowMoreLabel::initUi() { + QPalette pal = palette(); + pal.setColor(QPalette::WindowText, QColor(55, 144, 250, 255)); m_layout = new QHBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 6); m_textLabel = new QLabel(this); @@ -58,7 +60,7 @@ void ShowMoreLabel::initUi() { // m_loadingIconLabel->hide(); m_layout->setAlignment(Qt::AlignRight); m_layout->addWidget(m_textLabel); - m_textLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_textLabel->setPalette(pal); // m_layout->addWidget(m_loadingIconLabel); } diff --git a/src/create-index-ask-dialog.cpp b/src/create-index-ask-dialog.cpp index 0d1fc1e..517510c 100644 --- a/src/create-index-ask-dialog.cpp +++ b/src/create-index-ask-dialog.cpp @@ -126,8 +126,6 @@ void CreateIndexAskDialog::initUi() { * @brief CreateIndexAskDialog::paintEvent 绘制窗口背景(默认背景较暗) */ void CreateIndexAskDialog::paintEvent(QPaintEvent *event) { - Q_UNUSED(event) - QPainter p(this); p.setRenderHint(QPainter::Antialiasing); QPainterPath rectPath; diff --git a/src/custom-style.cpp b/src/custom-style.cpp deleted file mode 100644 index d3be980..0000000 --- a/src/custom-style.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright (C) 2020, KylinSoft 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 of the License, 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 . - * - * Authors: zhangjiaping - * - */ - -#include "custom-style.h" - -using namespace Zeeker; -static CustomStyle *customstyle_global_instance = nullptr; -CustomStyle::CustomStyle(QStyle *style) { - -} -CustomStyle *CustomStyle::getStyle() -{ - if (!customstyle_global_instance) - customstyle_global_instance = new CustomStyle; - return customstyle_global_instance; -} - -QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const { - switch(type) { - case CT_ItemViewItem: { - QSize size(0, GlobalSettings::getInstance()->getValue(FONT_SIZE_KEY).toDouble() * 2); - return size; - } - break; - default: - break; - } - return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); -} - - diff --git a/src/custom-style.h b/src/custom-style.h deleted file mode 100644 index b3b1ab6..0000000 --- a/src/custom-style.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (C) 2020, KylinSoft 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 of the License, 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 . - * - * Authors: zhangjiaping - * - */ - -#ifndef CUSTOMSTYLE_H -#define CUSTOMSTYLE_H -#include -#include "global-settings.h" - -namespace Zeeker { -class CustomStyle : public QProxyStyle { - Q_OBJECT -public: - static CustomStyle *getStyle(); - virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const; -private: - explicit CustomStyle(QStyle *style = nullptr); - ~CustomStyle() override {} -}; -} - -#endif // CUSTOMSTYLE_H diff --git a/src/input-box.cpp b/src/input-box.cpp index 9dc404e..416c69a 100644 --- a/src/input-box.cpp +++ b/src/input-box.cpp @@ -98,7 +98,6 @@ void SearchBarHLayout::initUI() { m_queryWidget = new QWidget(m_queryLineEdit); m_queryWidget->setFocusPolicy(Qt::NoFocus); - m_queryWidget->setStyleSheet("border:0px;background:transparent"); QHBoxLayout* queryWidLayout = new QHBoxLayout; queryWidLayout->setContentsMargins(8, 4, 0, 0); @@ -109,13 +108,12 @@ void SearchBarHLayout::initUI() { QPixmap pixmap(QIcon::fromTheme("system-search-symbolic").pixmap(QSize(20, 20))); m_queryIcon = new QLabel; - m_queryIcon->setStyleSheet("background:transparent"); m_queryIcon->setFixedSize(pixmap.size()); m_queryIcon->setPixmap(pixmap); m_queryText = new QLabel; m_queryText->setText(tr("Search")); - m_queryText->setStyleSheet("background:transparent;color:#626c6e;"); + m_queryText->setEnabled(false); m_queryText->setContentsMargins(0, 0, 0, 4); m_queryText->adjustSize(); @@ -215,7 +213,6 @@ SearchLineEdit::SearchLineEdit() { // popView->setProperty("customShadowMargins", QVector4D(20, 20, 20, 20)); // popView->setAttribute(Qt::WA_TranslucentBackground); // m_completer->setPopup(popView); -// m_completer->popup()->setStyle(CustomStyle::getStyle()); m_completer->setMaxVisibleItems(14); setCompleter(m_completer); diff --git a/src/main.cpp b/src/main.cpp index 332dda1..9dac608 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,6 +174,13 @@ int main(int argc, char *argv[]) { syslog(LOG_ERR, "Home is not exits!!\n"); ::sleep(1); } + while(!QDir("/media/用户保险箱").exists()) { + qWarning() << "集中管控目录未挂载!!"; + printf("集中管控目录未挂载!!"); + syslog(LOG_ERR, "集中管控目录未挂载!!\n"); + ::sleep(1); + } + // Output log to file qInstallMessageHandler(messageOutput); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e143a6a..6b29824 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -263,7 +263,7 @@ void MainWindow::initUi() { mainlayout->addWidget(m_titleFrame); mainlayout->addWidget(m_contentFrame); mainlayout->addWidget(m_searchWidget); - connect(m_contentFrame, &ContentWidget::mousePressed, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord); + connect(m_contentFrame, &ContentWidget::effectiveSearch, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord); connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, &MainWindow::monitorResolutionChange); @@ -287,7 +287,7 @@ void MainWindow::initUi() { if(! m_search_result_thread->isRunning()) { m_search_result_thread->start(); } - searchContent(text); + startSearch(text); // //允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索 // if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH) // m_askTimer->start(); @@ -389,10 +389,10 @@ void MainWindow::primaryScreenChangedSlot(QScreen *screen) { } /** - * @brief searchContent 搜索关键字 - * @param searchcontent + * @brief startSearch 搜索关键字 + * @param keyword */ -void MainWindow::searchContent(QString keyword) { +void MainWindow::startSearch(QString keyword) { m_contentFrame->setKeyword(keyword); //设置搜索 diff --git a/src/mainwindow.h b/src/mainwindow.h index e131cc8..63f3f83 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -81,7 +81,7 @@ public: */ // The parameter:keyword is the word or sentence which users want to search. - void searchContent(QString keyword); + void startSearch(QString keyword); // The position which mainwindow shows follow the ukui-panel. void moveToPanel(); diff --git a/src/model/search-item-model.cpp b/src/model/search-item-model.cpp index 021f577..9ec3197 100644 --- a/src/model/search-item-model.cpp +++ b/src/model/search-item-model.cpp @@ -182,12 +182,6 @@ void SearchItemModel::setBestAppIcon(const QString &str, const bool & is_install } } -void SearchItemModel::refresh() -{ - this->beginResetModel(); - this->endResetModel(); -} - int SearchItemModel::length() { return m_item->m_pathlist.length(); diff --git a/src/model/search-item-model.h b/src/model/search-item-model.h index 396c77e..087bb09 100644 --- a/src/model/search-item-model.h +++ b/src/model/search-item-model.h @@ -59,7 +59,6 @@ public: void removeItem(QString); void clear(); void setBestAppIcon(const QString &, const bool &); - void refresh(); int length(); private : diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index 520784d..36b2226 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -57,6 +57,8 @@ SettingsWidget::~SettingsWidget() { * @brief SettingsWidget::initUi 初始化界面UI */ void SettingsWidget::initUi() { + QPalette pal = palette(); + pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); // this->setFixedWidth(528); // this->setMinimumHeight(460); // this->setMaximumHeight(680); @@ -81,8 +83,6 @@ void SettingsWidget::initUi() { m_closeBtn = new QPushButton(m_titleFrame); m_closeBtn->setFixedSize(24, 24); // m_closeBtn->setIcon(QIcon(":/res/icons/close.svg")); -// m_closeBtn->setStyleSheet("QPushButton{background: transparent;}" -// "QPushButton:hover:!pressed{background: transparent;}"); m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); m_closeBtn->setProperty("isWindowButton", 0x02); m_closeBtn->setProperty("useIconHighlightEffect", 0x08); @@ -139,9 +139,9 @@ void SettingsWidget::initUi() { m_indexBtnLyt->addWidget(m_addDirBtn); m_indexBtnLyt->addStretch(); m_dirListArea = new QScrollArea(m_contentFrame); - m_dirListArea->setStyleSheet("QScrollArea{background:transparent;}"); + m_dirListArea->setPalette(pal); + m_dirListArea->setFrameShape(QFrame::Shape::NoFrame); m_dirListWidget = new QWidget(m_contentFrame); - m_dirListWidget->setStyleSheet("QWidget{background:transparent;}"); m_dirListLyt = new QVBoxLayout(m_dirListWidget); m_dirListLyt->setContentsMargins(0, 0, 0, 0); m_dirListLyt->setSpacing(0); diff --git a/src/src.pro b/src/src.pro index 1786c22..2c0ecdf 100644 --- a/src/src.pro +++ b/src/src.pro @@ -28,7 +28,6 @@ include(singleapplication/qt-single-application.pri) SOURCES += \ content-widget.cpp \ create-index-ask-dialog.cpp \ - custom-style.cpp \ input-box.cpp \ main.cpp \ mainwindow.cpp \ @@ -41,7 +40,6 @@ SOURCES += \ HEADERS += \ content-widget.h \ create-index-ask-dialog.h \ - custom-style.h \ input-box.h \ mainwindow.h \ search-app-thread.h \