Modified index path.
This commit is contained in:
parent
db105cf4ca
commit
fdcb6e66ff
|
@ -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 <zhangpengfei@kylinos.cn> Thu, 20 May 2021 09:08:15 +0800
|
||||
|
||||
ukui-search (0.4.0+0508) v101; urgency=medium
|
||||
|
||||
* Bug 49153.
|
||||
|
|
|
@ -52,10 +52,10 @@ ChineseSegmentation *ChineseSegmentation::getInstance() {
|
|||
return global_instance_chinese_segmentation;
|
||||
}
|
||||
|
||||
QVector<SKeyWord> ChineseSegmentation::callSegement(QString str) {
|
||||
std::string s;
|
||||
s = str.toStdString();
|
||||
str.squeeze();
|
||||
QVector<SKeyWord> ChineseSegmentation::callSegement(std::string s) {
|
||||
// std::string s;
|
||||
// s = str.toStdString();
|
||||
// str.squeeze();
|
||||
|
||||
const size_t topk = -1;
|
||||
std::vector<cppjieba::KeywordExtractor::Word> keywordres;
|
||||
|
|
|
@ -47,7 +47,7 @@ class CHINESESEGMENTATION_EXPORT ChineseSegmentation {
|
|||
public:
|
||||
static ChineseSegmentation *getInstance();
|
||||
~ChineseSegmentation();
|
||||
QVector<SKeyWord> callSegement(QString str);
|
||||
QVector<SKeyWord> callSegement(std::string s);
|
||||
void convert(std::vector<cppjieba::KeywordExtractor::Word>& keywordres, QVector<SKeyWord>& kw);
|
||||
private:
|
||||
static QMutex m_mutex;
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <QMutex>
|
||||
#include <QVector>
|
||||
#include <QDir>
|
||||
#include <QFileSystemWatcher>
|
||||
//#include <QGSettings>
|
||||
//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<QString, QVariant> m_cache;
|
||||
QStringList m_history;
|
||||
QFileSystemWatcher *m_confWatcher;
|
||||
|
||||
QMutex m_mutex;
|
||||
// size_t test = 0;
|
||||
|
|
|
@ -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<SKeyWord> term = ChineseSegmentation::getInstance()->callSegement(content.left(20480000));
|
||||
QVector<SKeyWord> term = ChineseSegmentation::getInstance()->callSegement(content.left(20480000).toStdString());
|
||||
|
||||
Document doc;
|
||||
doc.setData(content);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "document.h"
|
||||
#include <QDebug>
|
||||
using namespace Zeeker;
|
||||
void Document::setData(QString data) {
|
||||
void Document::setData(QString &data) {
|
||||
if(data.isEmpty())
|
||||
return;
|
||||
m_document.set_data(data.toStdString());
|
||||
|
|
|
@ -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<size_t> offset, int weight = 1);
|
||||
void addPosting(std::string term, unsigned int offset, int weight = 1);
|
||||
void addTerm(QString term);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -32,8 +32,10 @@
|
|||
#include <QStandardPaths>
|
||||
|
||||
|
||||
#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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,7 +61,9 @@ InotifyIndex::~InotifyIndex() {
|
|||
|
||||
void InotifyIndex::firstTraverse() {
|
||||
QQueue<QString> bfs;
|
||||
bfs.enqueue(this->path);
|
||||
for(QString path : this->m_pathList) {
|
||||
this->AddWatch(path);
|
||||
bfs.enqueue(path);
|
||||
QFileInfoList list;
|
||||
QDir dir;
|
||||
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
@ -77,6 +79,7 @@ void InotifyIndex::firstTraverse() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InotifyIndex::DoSomething(const QFileInfo& fileInfo) {
|
||||
qDebug() << fileInfo.fileName() << "-------" << fileInfo.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;
|
||||
|
|
|
@ -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&);
|
||||
|
|
|
@ -301,7 +301,7 @@ int FileContentSearch::keywordSearchContent() {
|
|||
ret.erase(ret.begin(), ret.end());
|
||||
::friso::ResultMap().swap(ret);
|
||||
*/
|
||||
QVector<SKeyWord> sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword);
|
||||
QVector<SKeyWord> 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> sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword);
|
||||
QVector<SKeyWord> sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword.toStdString());
|
||||
//Creat a query
|
||||
std::string words;
|
||||
for(int i=0;i<sKeyWord.size();i++)
|
||||
|
@ -803,6 +803,7 @@ void DirectSearch::run() {
|
|||
// QDir::Hidden
|
||||
dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
dir.setSorting(QDir::DirsFirst);
|
||||
QStringList blockList = GlobalSettings::getInstance()->getBlockDirs();
|
||||
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -19,14 +19,18 @@
|
|||
*/
|
||||
#include "traverse_bfs.h"
|
||||
using namespace Zeeker;
|
||||
Traverse_BFS::Traverse_BFS(const QString& path) {
|
||||
Traverse_BFS::Traverse_BFS(const QStringList& pathList) {
|
||||
for(QString path : pathList) {
|
||||
Q_ASSERT('/' == path.at(0));
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
this->m_pathList = pathList;
|
||||
}
|
||||
|
||||
void Traverse_BFS::Traverse() {
|
||||
QQueue<QString> bfs;
|
||||
bfs.enqueue(this->path);
|
||||
for(QString path : m_pathList) {
|
||||
bfs.enqueue(path);
|
||||
QFileInfoList list;
|
||||
QDir dir;
|
||||
// QDir::Hidden
|
||||
|
@ -43,7 +47,8 @@ void Traverse_BFS::Traverse() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Traverse_BFS::setPath(const QString& path) {
|
||||
this->path = path;
|
||||
}
|
||||
|
||||
void Traverse_BFS::setPath(const QStringList &pathList) {
|
||||
this->m_pathList = pathList;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -24,12 +24,13 @@ public:
|
|||
QIcon icon;
|
||||
QString name;
|
||||
QVector<DescriptionInfo> description;
|
||||
QMap<QString,QString> 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<ResultInfo> *searchResult) = 0;
|
||||
virtual void openAction(QString name, QString key) = 0;
|
||||
virtual void openAction(QString action, QString key) = 0;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
#include "setting-match.h"
|
||||
#include "file-utils.h"
|
||||
#include <QProcessEnvironment>
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ private:
|
|||
|
||||
Q_SIGNALS:
|
||||
void currentItemChanged();
|
||||
void mousePressed();
|
||||
void effectiveSearch();
|
||||
|
||||
private Q_SLOTS:
|
||||
void clearLayout(QLayout *);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
#include <QHBoxLayout>
|
||||
#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
|
||||
|
|
|
@ -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("<h3 style=\"font-weight:normal;\">%1</h3>").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("<h3 style=\"font-weight:normal;\">%1</h3>").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("<h3 style=\"font-weight:normal;\">%1</h3>").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);
|
||||
|
|
|
@ -105,6 +105,7 @@ private:
|
|||
|
||||
Q_SIGNALS:
|
||||
void configFileChanged();
|
||||
void actionTriggerd();
|
||||
private Q_SLOTS:
|
||||
void execActions(const int&, const int&, const QString&);
|
||||
void refreshIcon();
|
||||
|
|
|
@ -21,12 +21,11 @@
|
|||
#include "search-list-view.h"
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: zhangjiaping <zhangjiaping@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: zhangjiaping <zhangjiaping@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CUSTOMSTYLE_H
|
||||
#define CUSTOMSTYLE_H
|
||||
#include <QProxyStyle>
|
||||
#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
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
//设置搜索
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
void removeItem(QString);
|
||||
void clear();
|
||||
void setBestAppIcon(const QString &, const bool &);
|
||||
void refresh();
|
||||
int length();
|
||||
|
||||
private :
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in New Issue