Merge pull request #205 from MouseZhangZh/0420-shit

Add change search method in ukui-search.
This commit is contained in:
iaom 2021-04-20 18:40:11 +08:00 committed by GitHub
commit 53c07dd9c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 986 additions and 359 deletions

View File

@ -0,0 +1,9 @@
<schemalist gettext-domain="ukui-search">
<schema id="org.ukui.search.settings" path="/org/ukui/ukui-search/settings/">
<key name="index-search" type="b">
<default>false</default>
<summary>search method</summary>
<description>Is current search-method index-search.</description>
</key>
</schema>
</schemalist>

View File

@ -25,6 +25,7 @@
size_t FileUtils::_max_index_count = 0; size_t FileUtils::_max_index_count = 0;
size_t FileUtils::_current_index_count = 0; size_t FileUtils::_current_index_count = 0;
unsigned short FileUtils::_index_status = 0; unsigned short FileUtils::_index_status = 0;
FileUtils::SearchMethod FileUtils::searchMethod = FileUtils::SearchMethod::DIRECTSEARCH;
QMap<QString, QStringList> FileUtils::map_chinese2pinyin = QMap<QString, QStringList>(); QMap<QString, QStringList> FileUtils::map_chinese2pinyin = QMap<QString, QStringList>();
FileUtils::FileUtils() FileUtils::FileUtils()

View File

@ -88,8 +88,8 @@ public:
static size_t _current_index_count; //this one has been Abandoned,do not use it. static size_t _current_index_count; //this one has been Abandoned,do not use it.
static unsigned short _index_status; static unsigned short _index_status;
// enum class SearchMethod{ DIRECTSEARCH = 0, INDEXSEARCH = 1}; enum class SearchMethod{ DIRECTSEARCH = 0, INDEXSEARCH = 1};
// static SearchMethod searchMethod = FileUtils::SearchMethod::DIRECTSEARCH; static SearchMethod searchMethod;
private: private:
FileUtils(); FileUtils();

View File

@ -44,6 +44,7 @@
#define CONTENT_INDEX_DATABASE_STATE "content_index_database_state" #define CONTENT_INDEX_DATABASE_STATE "content_index_database_state"
#define INDEX_GENERATOR_NORMAL_EXIT "index_generator_normal_exit" #define INDEX_GENERATOR_NORMAL_EXIT "index_generator_normal_exit"
#define INOTIFY_NORMAL_EXIT "inotify_normal_exit" #define INOTIFY_NORMAL_EXIT "inotify_normal_exit"
#define ENABLE_CREATE_INDEX_ASK_DIALOG "enable_create_index_ask_dialog"
#define WEB_ENGINE "web_engine" #define WEB_ENGINE "web_engine"
#define PATH_EMPTY 1; #define PATH_EMPTY 1;
#define PATH_NOT_IN_HOME 2; #define PATH_NOT_IN_HOME 2;

View File

@ -25,8 +25,52 @@
#define NEW_QUEUE(a) a = new QQueue<QString>(); qDebug("---------------------------%s %s %s new at %d..",__FILE__,__FUNCTION__,#a,__LINE__); #define NEW_QUEUE(a) a = new QQueue<QString>(); qDebug("---------------------------%s %s %s new at %d..",__FILE__,__FUNCTION__,#a,__LINE__);
//#define DELETE_QUEUE(a ) //#define DELETE_QUEUE(a )
FirstIndex::FirstIndex(const QString& path) : Traverse_BFS(path) FirstIndex::FirstIndex()
{ {
}
FirstIndex::~FirstIndex()
{
qDebug() << "~FirstIndex";
if(this->q_index)
delete this->q_index;
this->q_index = nullptr;
if(this->q_content_index)
delete this->q_content_index;
this->q_content_index = nullptr;
if (this->p_indexGenerator)
delete this->p_indexGenerator;
this->p_indexGenerator = nullptr;
qDebug() << "~FirstIndex end";
}
void FirstIndex::DoSomething(const QFileInfo& fileInfo){
// qDebug() << "there are some shit here"<<fileInfo.fileName() << fileInfo.absoluteFilePath() << QString(fileInfo.isDir() ? "1" : "0");
this->q_index->enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
if ((fileInfo.fileName().split(".", QString::SkipEmptyParts).length() > 1) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
this->q_content_index->enqueue(fileInfo.absoluteFilePath());
}
}
void FirstIndex::run(){
QTime t1 = QTime::currentTime();
// Create a fifo at ~/.config/org.ukui/ukui-search, the fifo is used to control the order of child processes' running.
QDir fifoDir = QDir(QDir::homePath()+"/.config/org.ukui/ukui-search");
if(!fifoDir.exists())
qDebug()<<"create fifo path"<<fifoDir.mkpath(fifoDir.absolutePath());
unlink(UKUI_SEARCH_PIPE_PATH);
int retval = mkfifo(UKUI_SEARCH_PIPE_PATH, 0777);
if(retval == -1)
{
qCritical()<<"creat fifo error!!";
syslog(LOG_ERR,"creat fifo error!!\n");
assert(false);
return;
}
qDebug()<<"create fifo success\n";
QString indexDataBaseStatus = GlobalSettings::getInstance()->getValue(INDEX_DATABASE_STATE).toString(); QString indexDataBaseStatus = GlobalSettings::getInstance()->getValue(INDEX_DATABASE_STATE).toString();
QString contentIndexDataBaseStatus = GlobalSettings::getInstance()->getValue(CONTENT_INDEX_DATABASE_STATE).toString(); QString contentIndexDataBaseStatus = GlobalSettings::getInstance()->getValue(CONTENT_INDEX_DATABASE_STATE).toString();
QString inotifyIndexStatus = GlobalSettings::getInstance()->getValue(INOTIFY_NORMAL_EXIT).toString(); QString inotifyIndexStatus = GlobalSettings::getInstance()->getValue(INOTIFY_NORMAL_EXIT).toString();
@ -53,35 +97,6 @@ FirstIndex::FirstIndex(const QString& path) : Traverse_BFS(path)
//this->q_content_index = new QQueue<QString>(); //this->q_content_index = new QQueue<QString>();
NEW_QUEUE(this->q_content_index); NEW_QUEUE(this->q_content_index);
// this->mlm = new MessageListManager(); // this->mlm = new MessageListManager();
}
FirstIndex::~FirstIndex()
{
qDebug() << "~FirstIndex";
if(this->q_index)
delete this->q_index;
this->q_index = nullptr;
if(this->q_content_index)
delete this->q_content_index;
this->q_content_index = nullptr;
if (this->p_indexGenerator)
delete this->p_indexGenerator;
this->p_indexGenerator = nullptr;
qDebug() << "~FirstIndex end";
// delete this->mlm;
// this->mlm = nullptr;
}
void FirstIndex::DoSomething(const QFileInfo& fileInfo){
// qDebug() << "there are some shit here"<<fileInfo.fileName() << fileInfo.absoluteFilePath() << QString(fileInfo.isDir() ? "1" : "0");
this->q_index->enqueue(QVector<QString>() << fileInfo.fileName() << fileInfo.absoluteFilePath() << QString((fileInfo.isDir() && (!fileInfo.isSymLink())) ? "1" : "0"));
if ((fileInfo.fileName().split(".", QString::SkipEmptyParts).length() > 1) && (true == targetFileTypeMap[fileInfo.fileName().split(".").last()])){
this->q_content_index->enqueue(fileInfo.absoluteFilePath());
}
}
void FirstIndex::run(){
QTime t1 = QTime::currentTime();
int fifo_fd; int fifo_fd;
char buffer[2]; char buffer[2];
@ -189,7 +204,7 @@ void FirstIndex::run(){
if (p_indexGenerator) if (p_indexGenerator)
delete p_indexGenerator; delete p_indexGenerator;
p_indexGenerator = nullptr; p_indexGenerator = nullptr;
GlobalSettings::getInstance()->forceSync(); // GlobalSettings::getInstance()->forceSync();
::_exit(0); ::_exit(0);
} }
else if(pid < 0) else if(pid < 0)
@ -204,8 +219,8 @@ void FirstIndex::run(){
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "2"); GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "2");
int retval = write(fifo_fd, buffer, strlen(buffer)); int retval1 = write(fifo_fd, buffer, strlen(buffer));
if(retval == -1) if(retval1 == -1)
{ {
qWarning("write error\n"); qWarning("write error\n");
} }

View File

@ -34,6 +34,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/prctl.h> #include <sys/prctl.h>
#include <syslog.h>
//#include <QtConcurrent> //#include <QtConcurrent>
#include "traverse_bfs.h" #include "traverse_bfs.h"
#include "global-settings.h" #include "global-settings.h"
@ -44,7 +45,7 @@
class FirstIndex : public QThread, public Traverse_BFS class FirstIndex : public QThread, public Traverse_BFS
{ {
public: public:
FirstIndex(const QString&); FirstIndex();
~FirstIndex(); ~FirstIndex();
virtual void DoSomething(const QFileInfo &) final; virtual void DoSomething(const QFileInfo &) final;
protected: protected:

View File

@ -8,6 +8,7 @@ HEADERS += \
$$PWD/index-generator.h \ $$PWD/index-generator.h \
$$PWD/inotify-index.h \ $$PWD/inotify-index.h \
$$PWD/search-manager.h \ $$PWD/search-manager.h \
$$PWD/searchmethodmanager.h \
$$PWD/traverse_bfs.h \ $$PWD/traverse_bfs.h \
$$PWD/ukui-search-qdbus.h $$PWD/ukui-search-qdbus.h
@ -19,6 +20,7 @@ SOURCES += \
$$PWD/index-generator.cpp \ $$PWD/index-generator.cpp \
$$PWD/inotify-index.cpp \ $$PWD/inotify-index.cpp \
$$PWD/search-manager.cpp \ $$PWD/search-manager.cpp \
$$PWD/searchmethodmanager.cpp \
$$PWD/traverse_bfs.cpp \ $$PWD/traverse_bfs.cpp \
$$PWD/ukui-search-qdbus.cpp $$PWD/ukui-search-qdbus.cpp

View File

@ -53,17 +53,12 @@ InotifyIndex::InotifyIndex(const QString& path) : Traverse_BFS(path)
usQDBus.setInotifyMaxUserWatches(); usQDBus.setInotifyMaxUserWatches();
qDebug() << "setInotifyMaxUserWatches end"; qDebug() << "setInotifyMaxUserWatches end";
m_fd = inotify_init();
qDebug() << "m_fd----------->" <<m_fd;
this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
this->firstTraverse();
} }
InotifyIndex::~InotifyIndex() InotifyIndex::~InotifyIndex()
{ {
IndexGenerator::getInstance()->~IndexGenerator(); IndexGenerator::getInstance()->~IndexGenerator();
qWarning() << "~InotifyIndex";
} }
void InotifyIndex::firstTraverse(){ void InotifyIndex::firstTraverse(){
@ -113,7 +108,7 @@ bool InotifyIndex::AddWatch(const QString &path){
return true; return true;
} }
bool InotifyIndex::RemoveWatch(const QString &path){ bool InotifyIndex::RemoveWatch(const QString &path, bool removeFromDatabase){
int ret = inotify_rm_watch(m_fd, currentPath.key(path)); int ret = inotify_rm_watch(m_fd, currentPath.key(path));
if (ret){ if (ret){
qDebug() << "remove path error"; qDebug() << "remove path error";
@ -122,6 +117,7 @@ bool InotifyIndex::RemoveWatch(const QString &path){
// Q_ASSERT(ret == 0); // Q_ASSERT(ret == 0);
assert(ret == 0); assert(ret == 0);
if (removeFromDatabase) {
for (QMap<int, QString>::Iterator i = currentPath.begin(); i != currentPath.end();) { for (QMap<int, QString>::Iterator i = currentPath.begin(); i != currentPath.end();) {
// qDebug() << i.value(); // qDebug() << i.value();
if (i.value().length() > path.length()){ if (i.value().length() > path.length()){
@ -151,6 +147,32 @@ bool InotifyIndex::RemoveWatch(const QString &path){
i++; i++;
} }
} }
} else {
for (QMap<int, QString>::Iterator i = currentPath.begin(); i != currentPath.end();) {
// qDebug() << i.value();
if (i.value().length() > path.length()){
// if (i.value().mid(0, path.length()) == path){
// if (path.startsWith(i.value())){
if (i.value().startsWith(path)){
qDebug() << "remove path: " << i.value();
ret = inotify_rm_watch(m_fd, currentPath.key(path));
if (ret){
qDebug() << "remove path error";
// return false;
}
// assert(ret == 0);
currentPath.erase(i++);
// i++;
}
else{
i++;
}
}
else{
i++;
}
}
}
// qDebug() << path; // qDebug() << path;
//这个貌似不用删先mark一下 //这个貌似不用删先mark一下
// currentPath.remove(currentPath.key(path)); // currentPath.remove(currentPath.key(path));
@ -228,6 +250,13 @@ next:
} }
void InotifyIndex::run(){ 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->firstTraverse();
int fifo_fd; int fifo_fd;
char buffer[2]; char buffer[2];
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
@ -256,8 +285,8 @@ void InotifyIndex::run(){
ssize_t numRead; ssize_t numRead;
for (;;) { /* Read events forever */ while (FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) {
read: // for (;;) { /* Read events forever */
memset(buf, 0x00, BUF_LEN); memset(buf, 0x00, BUF_LEN);
numRead = read(m_fd, buf, BUF_LEN); numRead = read(m_fd, buf, BUF_LEN);
@ -276,14 +305,14 @@ read:
// qDebug() << "Read Event: " << currentPath[event->wd] << QString(event->name) << event->cookie << event->wd << event->mask; // qDebug() << "Read Event: " << currentPath[event->wd] << QString(event->name) << event->cookie << event->wd << event->mask;
if(event->name[0] != '.'){ if(event->name[0] != '.'){
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0"); GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0");
goto fork; break;
} }
tmp += sizeof(struct inotify_event) + event->len; tmp += sizeof(struct inotify_event) + event->len;
} }
goto read; if (tmp >= buf + numRead) {
continue;
}
fork:
++FileUtils::_index_status; ++FileUtils::_index_status;
pid_t pid; pid_t pid;
@ -323,7 +352,7 @@ fork:
qDebug() << "select timeout!"; qDebug() << "select timeout!";
::free(read_timeout); ::free(read_timeout);
IndexGenerator::getInstance()->~IndexGenerator(); IndexGenerator::getInstance()->~IndexGenerator();
GlobalSettings::getInstance()->forceSync(); // GlobalSettings::getInstance()->forceSync();
::_exit(0); ::_exit(0);
}else{ }else{
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0"); GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0");
@ -343,7 +372,6 @@ fork:
else if (pid > 0){ else if (pid > 0){
memset(buf, 0x00, BUF_LEN); memset(buf, 0x00, BUF_LEN);
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
--FileUtils::_index_status; --FileUtils::_index_status;
} }
else{ else{
@ -351,4 +379,11 @@ fork:
} }
} }
if (FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) {
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "3");
RemoveWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation), false);
}
} }

View File

@ -48,7 +48,7 @@ public:
~InotifyIndex(); ~InotifyIndex();
bool AddWatch(const QString&); bool AddWatch(const QString&);
bool RemoveWatch(const QString&); bool RemoveWatch(const QString&, bool removeFromDatabase = true);
virtual void DoSomething(const QFileInfo &) final; virtual void DoSomething(const QFileInfo &) final;
void eventProcess(const char*, ssize_t); void eventProcess(const char*, ssize_t);
@ -56,7 +56,6 @@ public:
protected: protected:
void run() override; void run() override;
private: private:
QString* m_watch_path;
int m_fd; int m_fd;
QMap<int, QString> currentPath; QMap<int, QString> currentPath;

View File

@ -37,13 +37,10 @@ SearchManager::~SearchManager()
int SearchManager::getCurrentIndexCount() int SearchManager::getCurrentIndexCount()
{ {
try try {
{
Xapian::Database db(INDEX_PATH); Xapian::Database db(INDEX_PATH);
return db.get_doccount(); return db.get_doccount();
} } catch(const Xapian::Error &e) {
catch(const Xapian::Error &e)
{
qWarning() << QString::fromStdString(e.get_description()); qWarning() << QString::fromStdString(e.get_description());
return 0; return 0;
} }
@ -62,8 +59,11 @@ void SearchManager::onKeywordSearch(QString keyword,QQueue<QString> *searchResul
++uniqueSymbol3; ++uniqueSymbol3;
m_mutex3.unlock(); m_mutex3.unlock();
if (FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) {
DirectSearch *directSearch;
directSearch = new DirectSearch(keyword, searchResultFile, searchResultDir, uniqueSymbol1);
m_pool.start(directSearch);
} else if (FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) {
FileSearch *filesearch; FileSearch *filesearch;
filesearch = new FileSearch(searchResultFile,uniqueSymbol1,keyword,"0",1,0,5); filesearch = new FileSearch(searchResultFile,uniqueSymbol1,keyword,"0",1,0,5);
m_pool.start(filesearch); m_pool.start(filesearch);
@ -75,6 +75,9 @@ void SearchManager::onKeywordSearch(QString keyword,QQueue<QString> *searchResul
FileContentSearch *contentSearch; FileContentSearch *contentSearch;
contentSearch = new FileContentSearch(searchResultContent,uniqueSymbol3,keyword,0,5); contentSearch = new FileContentSearch(searchResultContent,uniqueSymbol3,keyword,0,5);
m_pool.start(contentSearch); m_pool.start(contentSearch);
} else {
qWarning() << "Unknown search method! FileUtils::searchMethod: " << static_cast<int>(FileUtils::searchMethod);
}
return; return;
} }
@ -109,12 +112,12 @@ FileSearch::~FileSearch()
void FileSearch::run() void FileSearch::run()
{ {
if(!m_search_result->isEmpty()) if (!m_search_result->isEmpty()){
m_search_result->clear(); m_search_result->clear();
}
int resultCount = 0; int resultCount = 0;
int total = 0; int total = 0;
while(total < 100) while (total < 100) {
{
resultCount = keywordSearchfile(); resultCount = keywordSearchfile();
if (resultCount == 0 || resultCount == -1) if (resultCount == 0 || resultCount == -1)
break; break;
@ -126,22 +129,18 @@ void FileSearch::run()
int FileSearch::keywordSearchfile() int FileSearch::keywordSearchfile()
{ {
try try {
{
qDebug() << "--keywordSearchfile start--"; qDebug() << "--keywordSearchfile start--";
Xapian::Database db(INDEX_PATH); Xapian::Database db(INDEX_PATH);
Xapian::Query query = creatQueryForFileSearch(db); Xapian::Query query = creatQueryForFileSearch(db);
Xapian::Enquire enquire(db); Xapian::Enquire enquire(db);
Xapian::Query queryFile; Xapian::Query queryFile;
if(!m_value.isEmpty()) if (!m_value.isEmpty()) {
{
std::string slotValue = m_value.toStdString(); std::string slotValue = m_value.toStdString();
Xapian::Query queryValue = Xapian::Query(Xapian::Query::OP_VALUE_RANGE,m_slot,slotValue,slotValue); Xapian::Query queryValue = Xapian::Query(Xapian::Query::OP_VALUE_RANGE,m_slot,slotValue,slotValue);
queryFile = Xapian::Query(Xapian::Query::OP_AND,query,queryValue); queryFile = Xapian::Query(Xapian::Query::OP_AND,query,queryValue);
} } else {
else
{
queryFile = query; queryFile = query;
} }
@ -158,9 +157,7 @@ int FileSearch::keywordSearchfile()
qDebug() << "--keywordSearchfile finish--"; qDebug() << "--keywordSearchfile finish--";
return resultCount; return resultCount;
} } catch (const Xapian::Error &e) {
catch(const Xapian::Error &e)
{
qWarning() <<QString::fromStdString(e.get_description()); qWarning() <<QString::fromStdString(e.get_description());
qDebug() << "--keywordSearchfile finish--"; qDebug() << "--keywordSearchfile finish--";
return -1; return -1;
@ -171,8 +168,7 @@ Xapian::Query FileSearch::creatQueryForFileSearch(Xapian::Database &db)
{ {
auto userInput = m_keyword.toLower(); auto userInput = m_keyword.toLower();
std::vector<Xapian::Query> v; std::vector<Xapian::Query> v;
for(int i=0;i<userInput.size();i++) for (int i=0;i<userInput.size();i++) {
{
v.push_back(Xapian::Query(QUrl::toPercentEncoding(userInput.at(i)).toStdString())); v.push_back(Xapian::Query(QUrl::toPercentEncoding(userInput.at(i)).toStdString()));
// qDebug()<<QString::fromStdString(Xapian::Query(QString(userInput.at(i)).toStdString()).get_description()); // qDebug()<<QString::fromStdString(Xapian::Query(QString(userInput.at(i)).toStdString()).get_description());
} }
@ -182,8 +178,7 @@ Xapian::Query FileSearch::creatQueryForFileSearch(Xapian::Database &db)
int FileSearch::getResult(Xapian::MSet &result) int FileSearch::getResult(Xapian::MSet &result)
{ {
for (auto it = result.begin(); it != result.end(); ++it) for (auto it = result.begin(); it != result.end(); ++it) {
{
Xapian::Document doc = it.get_document(); Xapian::Document doc = it.get_document();
std::string data = doc.get_data(); std::string data = doc.get_data();
Xapian::weight docScoreWeight = it.get_weight(); Xapian::weight docScoreWeight = it.get_weight();
@ -191,29 +186,23 @@ int FileSearch::getResult(Xapian::MSet &result)
QString path = QString::fromStdString(data); QString path = QString::fromStdString(data);
std::string().swap(data); std::string().swap(data);
if(SearchManager::isBlocked(path)) if (SearchManager::isBlocked(path)) {
continue; continue;
}
QFileInfo info(path); QFileInfo info(path);
if(!info.exists()) if (!info.exists()) {
{
// pathTobeDelete->append(QString::fromStdString(data)); // pathTobeDelete->append(QString::fromStdString(data));
qDebug()<<path<<"is not exist!!"; qDebug()<<path<<"is not exist!!";
} } else {
else switch (m_value.toInt()) {
{
switch (m_value.toInt())
{
case 1: case 1:
SearchManager::m_mutex1.lock(); SearchManager::m_mutex1.lock();
if(m_uniqueSymbol == SearchManager::uniqueSymbol2) if (m_uniqueSymbol == SearchManager::uniqueSymbol2) {
{
m_search_result->enqueue(path); m_search_result->enqueue(path);
SearchManager::m_mutex1.unlock(); SearchManager::m_mutex1.unlock();
} } else {
else
{
SearchManager::m_mutex1.unlock(); SearchManager::m_mutex1.unlock();
return -1; return -1;
} }
@ -221,13 +210,10 @@ int FileSearch::getResult(Xapian::MSet &result)
break; break;
case 0: case 0:
SearchManager::m_mutex2.lock(); SearchManager::m_mutex2.lock();
if(m_uniqueSymbol == SearchManager::uniqueSymbol1) if(m_uniqueSymbol == SearchManager::uniqueSymbol1) {
{
m_search_result->enqueue(path); m_search_result->enqueue(path);
SearchManager::m_mutex2.unlock(); SearchManager::m_mutex2.unlock();
} } else {
else
{
SearchManager::m_mutex2.unlock(); SearchManager::m_mutex2.unlock();
return -1; return -1;
} }
@ -261,16 +247,17 @@ FileContentSearch::~FileContentSearch()
void FileContentSearch::run() void FileContentSearch::run()
{ {
if(!m_search_result->isEmpty()) if (!m_search_result->isEmpty()) {
m_search_result->clear(); m_search_result->clear();
}
int resultCount = 0; int resultCount = 0;
int total = 0; int total = 0;
while(total<50) while (total<50) {
{
resultCount = keywordSearchContent(); resultCount = keywordSearchContent();
if(resultCount == 0 || resultCount == -1) if (resultCount == 0 || resultCount == -1) {
break; break;
}
total += resultCount; total += resultCount;
m_begin += m_num; m_begin += m_num;
} }
@ -279,8 +266,7 @@ void FileContentSearch::run()
int FileContentSearch::keywordSearchContent() int FileContentSearch::keywordSearchContent()
{ {
try try {
{
qDebug()<<"--keywordSearchContent search start--"; qDebug()<<"--keywordSearchContent search start--";
Xapian::Database db(CONTENT_INDEX_PATH); Xapian::Database db(CONTENT_INDEX_PATH);
@ -305,8 +291,7 @@ int FileContentSearch::keywordSearchContent()
QVector<SKeyWord> sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword); QVector<SKeyWord> sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword);
//Creat a query //Creat a query
std::string words; std::string words;
for(int i=0;i<sKeyWord.size();i++) for (int i=0; i<sKeyWord.size(); i++) {
{
words.append(sKeyWord.at(i).word).append(" "); words.append(sKeyWord.at(i).word).append(" ");
} }
@ -339,18 +324,18 @@ int FileContentSearch::keywordSearchContent()
Xapian::MSet result = enquire.get_mset(m_begin, m_num); Xapian::MSet result = enquire.get_mset(m_begin, m_num);
int resultCount = result.size(); int resultCount = result.size();
if(result.size() == 0) if (result.size() == 0) {
return 0; return 0;
}
qDebug() << "keywordSearchContent results count=" << resultCount; qDebug() << "keywordSearchContent results count=" << resultCount;
if(getResult(result,words) == -1) if (getResult(result,words) == -1){
return -1; return -1;
}
qDebug()<< "--keywordSearchContent search finish--"; qDebug()<< "--keywordSearchContent search finish--";
return resultCount; return resultCount;
} } catch(const Xapian::Error &e) {
catch(const Xapian::Error &e)
{
qWarning() << QString::fromStdString(e.get_description()); qWarning() << QString::fromStdString(e.get_description());
qDebug() << "--keywordSearchContent search finish--"; qDebug() << "--keywordSearchContent search finish--";
return -1; return -1;
@ -359,21 +344,20 @@ int FileContentSearch::keywordSearchContent()
int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord) int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord)
{ {
for (auto it = result.begin(); it != result.end(); ++it) for (auto it = result.begin(); it != result.end(); ++it) {
{
Xapian::Document doc = it.get_document(); Xapian::Document doc = it.get_document();
std::string data = doc.get_data(); std::string data = doc.get_data();
double docScoreWeight = it.get_weight(); double docScoreWeight = it.get_weight();
Xapian::percent docScorePercent = it.get_percent(); Xapian::percent docScorePercent = it.get_percent();
QString path = QString::fromStdString(doc.get_value(1)); QString path = QString::fromStdString(doc.get_value(1));
if(SearchManager::isBlocked(path)) if (SearchManager::isBlocked(path)){
continue; continue;
}
QFileInfo info(path); QFileInfo info(path);
if(!info.exists()) if (!info.exists()) {
{
// pathTobeDelete->append(QString::fromStdString(data)); // pathTobeDelete->append(QString::fromStdString(data));
qDebug() << path << "is not exist!!"; qDebug() << path << "is not exist!!";
continue; continue;
@ -387,14 +371,14 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord)
int size = wordTobeFound.length(); int size = wordTobeFound.length();
term.skip_to(wordTobeFound); term.skip_to(wordTobeFound);
int count =0; int count =0;
for(auto pos = term.positionlist_begin();pos != term.positionlist_end()&&count < 6;++pos) for (auto pos = term.positionlist_begin();pos != term.positionlist_end()&&count < 6;++pos) {
{
std::string s = data.substr((*pos < 60)? 0: (*pos - 60) , size + 120); std::string s = data.substr((*pos < 60)? 0: (*pos - 60) , size + 120);
QString snippet = QString::fromStdString(s); QString snippet = QString::fromStdString(s);
if(snippet.size() > 6 + QString::fromStdString(keyWord).size()) if (snippet.size() > 6 + QString::fromStdString(keyWord).size()){
snippet.replace(0,3,"...").replace(snippet.size()-3,3,"..."); snippet.replace(0,3,"...").replace(snippet.size()-3,3,"...");
else } else {
snippet.append("...").prepend("..."); snippet.append("...").prepend("...");
}
snippets.append(snippet); snippets.append(snippet);
QString().swap(snippet); QString().swap(snippet);
std::string().swap(s); std::string().swap(s);
@ -418,16 +402,12 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord)
// } // }
SearchManager::m_mutex3.lock(); SearchManager::m_mutex3.lock();
if(m_uniqueSymbol == SearchManager::uniqueSymbol3) if (m_uniqueSymbol == SearchManager::uniqueSymbol3) {
{
m_search_result->enqueue(qMakePair(path,snippets)); m_search_result->enqueue(qMakePair(path,snippets));
SearchManager::m_mutex3.unlock(); SearchManager::m_mutex3.unlock();
snippets.clear(); snippets.clear();
QStringList().swap(snippets); QStringList().swap(snippets);
} } else {
else
{
SearchManager::m_mutex3.unlock(); SearchManager::m_mutex3.unlock();
return -1; return -1;
} }
@ -438,3 +418,55 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord)
// // deleteAllIndex(pathTobeDelete) // // deleteAllIndex(pathTobeDelete)
return 0; return 0;
} }
DirectSearch::DirectSearch(QString keyword, QQueue<QString> *searchResultFile, QQueue<QString> *searchResultDir, size_t uniqueSymbol)
{
this->setAutoDelete(true);
m_keyword = keyword;
m_searchResultFile = searchResultFile;
m_searchResultDir = searchResultDir;
m_uniqueSymbol = uniqueSymbol;
}
void DirectSearch::run()
{
QQueue<QString> bfs;
bfs.enqueue(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
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());
}
if (i.fileName().contains(m_keyword)) {
SearchManager::m_mutex1.lock();
// qWarning() << i.fileName() << m_keyword;
if (m_uniqueSymbol == SearchManager::uniqueSymbol1) {
// TODO
if (i.isDir() && m_searchResultDir->length() < 51) {
m_searchResultDir->enqueue(i.absoluteFilePath());
} else if (m_searchResultFile->length() < 51) {
m_searchResultFile->enqueue(i.absoluteFilePath());
}
SearchManager::m_mutex1.unlock();
if (m_searchResultDir->length() > 49 && m_searchResultFile->length() > 49) {
return;
}
} else {
// TODO
// More suitable method?
m_searchResultFile->clear();
m_searchResultDir->clear();
SearchManager::m_mutex1.unlock();
return;
}
}
}
}
}

View File

@ -116,6 +116,7 @@ private:
int m_begin = 0; int m_begin = 0;
int m_num = 20; int m_num = 20;
}; };
class FileContentSearch : public QRunnable class FileContentSearch : public QRunnable
{ {
public: public:
@ -133,4 +134,17 @@ private:
int m_begin = 0; int m_begin = 0;
int m_num = 20; int m_num = 20;
}; };
class DirectSearch : public QRunnable
{
public:
explicit DirectSearch(QString keyword, QQueue<QString> *searchResultFile, QQueue<QString> *searchResultDir, size_t uniqueSymbol);
protected:
void run();
private:
QString m_keyword;
QQueue<QString>* m_searchResultFile = nullptr;
QQueue<QString>* m_searchResultDir = nullptr;
size_t m_uniqueSymbol;
};
#endif // SEARCHMANAGER_H #endif // SEARCHMANAGER_H

View File

@ -0,0 +1,26 @@
#include "searchmethodmanager.h"
void SearchMethodManager::searchMethod(FileUtils::SearchMethod sm)
{
qWarning() << "searchMethod start: " << static_cast<int>(sm);
if (FileUtils::SearchMethod::INDEXSEARCH == sm || FileUtils::SearchMethod::DIRECTSEARCH == sm) {
FileUtils::searchMethod = sm;
} else {
printf("enum class error!!!\n");
qWarning("enum class error!!!\n");
}
if (FileUtils::SearchMethod::INDEXSEARCH == sm && 0 == FileUtils::_index_status) {
qWarning() << "start first index";
// m_fi = FirstIndex("/home/zhangzihao/Desktop");
m_fi.start();
qWarning() << "start inotify index";
// InotifyIndex ii("/home");
// ii.start();
this->m_ii = InotifyIndex::getInstance("/home");
if (!this->m_ii->isRunning()) {
this->m_ii->start();
}
qDebug()<<"Search method has been set to INDEXSEARCH";
}
qWarning() << "searchMethod end: " << static_cast<int>(FileUtils::searchMethod);
}

View File

@ -0,0 +1,17 @@
#ifndef SEARCHMETHODMANAGER_H
#define SEARCHMETHODMANAGER_H
#include "first-index.h"
#include "inotify-index.h"
class SearchMethodManager
{
public:
SearchMethodManager() = default;
void searchMethod(FileUtils::SearchMethod sm);
private:
FirstIndex m_fi;
InotifyIndex* m_ii;
};
#endif // SEARCHMETHODMANAGER_H

View File

@ -28,12 +28,13 @@
class Traverse_BFS class Traverse_BFS
{ {
public: public:
Traverse_BFS() = default;
void Traverse(); void Traverse();
virtual ~Traverse_BFS() = default; virtual ~Traverse_BFS() = default;
virtual void DoSomething(const QFileInfo&) = 0; virtual void DoSomething(const QFileInfo&) = 0;
void setPath(const QString&); void setPath(const QString&);
protected: protected:
explicit Traverse_BFS(const QString&); Traverse_BFS(const QString&);
QString path = "/home"; QString path = "/home";
private: private:
Traverse_BFS(const Traverse_BFS&) = delete; Traverse_BFS(const Traverse_BFS&) = delete;

View File

@ -21,15 +21,16 @@
#define LIBSEARCH_H #define LIBSEARCH_H
#include "libsearch_global.h" #include "libsearch_global.h"
#include "index/search-manager.h"
#include "appsearch/app-match.h" #include "appsearch/app-match.h"
#include "settingsearch/setting-match.h" #include "settingsearch/setting-match.h"
#include "file-utils.h" #include "file-utils.h"
#include "global-settings.h" #include "global-settings.h"
#include "index/first-index.h"
#include "index/searchmethodmanager.h"
#include "index/first-index.h"
#include "index/ukui-search-qdbus.h" #include "index/ukui-search-qdbus.h"
#include "index/inotify-index.h" #include "index/inotify-index.h"
#include "index/search-manager.h"
class LIBSEARCH_EXPORT GlobalSearch class LIBSEARCH_EXPORT GlobalSearch
{ {

View File

@ -0,0 +1,131 @@
/*
*
* 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 "create-index-ask-dialog.h"
#include <QPainter>
CreateIndexAskDialog::CreateIndexAskDialog(QWidget *parent) : QDialog(parent)
{
this->setWindowIcon(QIcon::fromTheme("kylin-search"));
this->setWindowTitle(tr("ukui-search"));
initUi();
}
void CreateIndexAskDialog::initUi()
{
this->setFixedSize(380, 202);
m_mainLyt = new QVBoxLayout(this);
this->setLayout(m_mainLyt);
m_mainLyt->setContentsMargins(0, 0, 0, 0);
//标题栏
m_titleFrame = new QFrame(this);
m_titleFrame->setFixedHeight(40);
m_titleLyt = new QHBoxLayout(m_titleFrame);
m_titleLyt->setContentsMargins(8, 8, 8, 8);
m_titleFrame->setLayout(m_titleLyt);
m_iconLabel = new QLabel(m_titleFrame);
m_iconLabel->setFixedSize(24, 24);
m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24)));
m_titleLabel = new QLabel(m_titleFrame);
m_titleLabel->setText(tr("Search"));
m_closeBtn = new QPushButton(m_titleFrame);
m_closeBtn->setFixedSize(24, 24);
m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic"));
m_closeBtn->setProperty("isWindowButton", 0x02);
m_closeBtn->setProperty("useIconHighlightEffect", 0x08);
m_closeBtn->setFlat(true);
connect(m_closeBtn, &QPushButton::clicked, this, [ = ]() {
this->hide();
Q_EMIT this->closed();
});
m_titleLyt->addWidget(m_iconLabel);
m_titleLyt->addWidget(m_titleLabel);
m_titleLyt->addStretch();
m_titleLyt->addWidget(m_closeBtn);
m_mainLyt->addWidget(m_titleFrame);
//内容区域
m_contentFrame = new QFrame(this);
m_contentLyt = new QVBoxLayout(m_contentFrame);
m_contentFrame->setLayout(m_contentLyt);
m_contentLyt->setContentsMargins(32, 16, 32, 24);
m_tipLabel = new QLabel(m_contentFrame);
m_tipLabel->setText(tr("Creating index can help you getting results quickly, whether to create or not?"));
m_tipLabel->setWordWrap(true);
m_contentLyt->addWidget(m_tipLabel);
m_checkFrame = new QFrame(m_contentFrame);
m_checkLyt = new QHBoxLayout(m_checkFrame);
m_checkLyt->setContentsMargins(0, 0, 0, 0);
m_checkFrame->setLayout(m_checkLyt);
m_checkBox = new QCheckBox(m_checkFrame);
m_checkBox->setText(tr("Don't remind"));
m_checkLyt->addWidget(m_checkBox);
m_checkLyt->addStretch();
m_contentLyt->addWidget(m_checkFrame);
m_contentLyt->addStretch();
m_btnFrame = new QFrame(m_contentFrame);
m_btnLyt = new QHBoxLayout(m_btnFrame);
m_btnFrame->setLayout(m_btnLyt);
m_btnLyt->setContentsMargins(0, 0, 0, 0);
m_cancelBtn = new QPushButton(m_btnFrame);
m_cancelBtn->setText(tr("No"));
m_confirmBtn = new QPushButton(m_btnFrame);
m_confirmBtn->setText(tr("Yes"));
connect(m_cancelBtn, &QPushButton::clicked, this, [ = ]() {
Q_EMIT this->btnClicked(false, m_checkBox->isChecked());
this->hide();
Q_EMIT this->closed();
});
connect(m_confirmBtn, &QPushButton::clicked, this, [ = ]() {
Q_EMIT this->btnClicked(true, m_checkBox->isChecked());
this->hide();
Q_EMIT this->closed();
});
m_btnLyt->addStretch();
m_btnLyt->addWidget(m_cancelBtn);
m_btnLyt->addWidget(m_confirmBtn);
m_contentLyt->addWidget(m_btnFrame);
m_mainLyt->addWidget(m_contentFrame);
}
/**
* @brief CreateIndexAskDialog::paintEvent
*/
void CreateIndexAskDialog::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event)
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
QPainterPath rectPath;
rectPath.addRect(this->rect());
p.save();
p.fillPath(rectPath,palette().color(QPalette::Base));
p.restore();
return QDialog::paintEvent(event);
}

View File

@ -0,0 +1,72 @@
/*
*
* 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 CREATEINDEXASKDIALOG_H
#define CREATEINDEXASKDIALOG_H
#include <QDialog>
#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QLabel>
#include <QPushButton>
#include <QStyleOption>
class CreateIndexAskDialog : public QDialog
{
Q_OBJECT
public:
CreateIndexAskDialog(QWidget *parent = nullptr);
~CreateIndexAskDialog() = default;
private:
void initUi();
QVBoxLayout * m_mainLyt = nullptr;
//标题栏
QFrame * m_titleFrame = nullptr;
QHBoxLayout * m_titleLyt = nullptr;
QLabel * m_iconLabel = nullptr;
QLabel * m_titleLabel = nullptr;
QPushButton * m_closeBtn = nullptr;
//内容区域
QFrame * m_contentFrame = nullptr;
QVBoxLayout * m_contentLyt = nullptr;
QLabel * m_tipLabel = nullptr; //提示语
QFrame * m_checkFrame = nullptr; //"不再提示"选项框区域
QHBoxLayout * m_checkLyt = nullptr;
QCheckBox * m_checkBox = nullptr;
QFrame * m_btnFrame = nullptr; //底部按钮区域
QHBoxLayout * m_btnLyt = nullptr;
QPushButton * m_cancelBtn = nullptr;
QPushButton * m_confirmBtn = nullptr;
void paintEvent(QPaintEvent *);
Q_SIGNALS:
void closed();
void btnClicked(const bool&, const bool&);
};
#endif // CREATEINDEXASKDIALOG_H

View File

@ -117,7 +117,31 @@ void centerToScreen(QWidget* widget) {
int y = widget->height(); int y = widget->height();
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top()); widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
} }
/*
void searchMethod(FileUtils::SearchMethod sm){
qWarning() << "searchMethod start: " << static_cast<int>(sm);
if (FileUtils::SearchMethod::INDEXSEARCH == sm || FileUtils::SearchMethod::DIRECTSEARCH == sm) {
FileUtils::searchMethod = sm;
} else {
printf("enum class error!!!\n");
qWarning("enum class error!!!\n");
}
if (FileUtils::SearchMethod::INDEXSEARCH == sm && 0 == FileUtils::_index_status) {
qWarning() << "start first index";
FirstIndex fi("/home/zhangzihao/Desktop");
fi.start();
qWarning() << "start inotify index";
// InotifyIndex ii("/home");
// ii.start();
InotifyIndex* ii = InotifyIndex::getInstance("/home");
if (!ii->isRunning()) {
ii->start();
}
qDebug()<<"Search method has been set to INDEXSEARCH";
}
qWarning() << "searchMethod end: " << static_cast<int>(FileUtils::searchMethod);
}
*/
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// Determine whether the home directory has been created, and if not, keep waiting. // Determine whether the home directory has been created, and if not, keep waiting.
@ -178,7 +202,7 @@ int main(int argc, char *argv[])
parser.addOptions({debugOption, showsearch}); parser.addOptions({debugOption, showsearch});
parser.process(app); parser.process(app);
}*/ }*/
/*
// Create a fifo at ~/.config/org.ukui/ukui-search, the fifo is used to control the order of child processes' running. // Create a fifo at ~/.config/org.ukui/ukui-search, the fifo is used to control the order of child processes' running.
QDir fifoDir = QDir(QDir::homePath()+"/.config/org.ukui/ukui-search"); QDir fifoDir = QDir(QDir::homePath()+"/.config/org.ukui/ukui-search");
if(!fifoDir.exists()) if(!fifoDir.exists())
@ -194,7 +218,7 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
qDebug()<<"create fifo success\n"; qDebug()<<"create fifo success\n";
*/
// Set max_user_watches to a number which is enough big. // Set max_user_watches to a number which is enough big.
UkuiSearchQDBus usQDBus; UkuiSearchQDBus usQDBus;
usQDBus.setInotifyMaxUserWatches(); usQDBus.setInotifyMaxUserWatches();
@ -249,6 +273,9 @@ int main(int argc, char *argv[])
// w->moveToPanel(); // w->moveToPanel();
centerToScreen(w); centerToScreen(w);
//请务必在connect之后初始化mainwindow的Gsettings为了保证gsettings第一次读取到的配置值能成功应用
w->initGsettings();
//使用窗管的无边框策略 //使用窗管的无边框策略
// w->setProperty("useStyleWindowManager", false); //禁用拖动 // w->setProperty("useStyleWindowManager", false); //禁用拖动
// MotifWmHints hints; // MotifWmHints hints;
@ -278,13 +305,13 @@ int main(int argc, char *argv[])
// TODO // TODO
// First insdex start, the parameter us useless, should remove the parameter // First insdex start, the parameter us useless, should remove the parameter
FirstIndex fi("/home/zhangzihao/Desktop"); // FirstIndex fi("/home/zhangzihao/Desktop");
fi.start(); // fi.start();
// TODO // TODO
// Inotify index start, the parameter us useless, should remove the parameter // Inotify index start, the parameter us useless, should remove the parameter
InotifyIndex* ii = InotifyIndex::getInstance("/home"); // InotifyIndex* ii = InotifyIndex::getInstance("/home");
ii->start(); // ii->start();
return app.exec(); return app.exec();
} }

View File

@ -65,6 +65,7 @@ MainWindow::MainWindow(QWidget *parent) :
this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
this->setWindowTitle(tr("ukui-search")); this->setWindowTitle(tr("ukui-search"));
initUi(); initUi();
initTimer();
// setProperty("useStyleWindowManager", false); //禁止拖动 // setProperty("useStyleWindowManager", false); //禁止拖动
m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
@ -80,11 +81,6 @@ MainWindow::MainWindow(QWidget *parent) :
setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon()));
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon()));
const QByteArray id("org.ukui.control-center.personalise");
if (QGSettings::isSchemaInstalled(id)) {
m_transparency_gsettings = new QGSettings(id);
}
connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) { connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) {
this->setPalette(pal); this->setPalette(pal);
this->update(); this->update();
@ -144,6 +140,10 @@ MainWindow::MainWindow(QWidget *parent) :
} }
} }
}); });
QObject::connect(this, &MainWindow::searchMethodChanged, this, [ = ](FileUtils::SearchMethod sm) {
this->m_searchMethodManager.searchMethod(sm);
});
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -160,6 +160,18 @@ MainWindow::~MainWindow()
delete m_settingsWidget; delete m_settingsWidget;
m_settingsWidget = NULL; m_settingsWidget = NULL;
} }
if (m_askDialog) {
delete m_askDialog;
m_askDialog = NULL;
}
if (m_askTimer) {
delete m_askTimer;
m_askTimer = NULL;
}
if (m_search_gsettings) {
delete m_search_gsettings;
m_search_gsettings = NULL;
}
} }
/** /**
@ -243,6 +255,7 @@ void MainWindow::initUi()
} }
// m_seach_app_thread->stop(); // m_seach_app_thread->stop();
m_contentFrame->setCurrentIndex(0); m_contentFrame->setCurrentIndex(0);
m_askTimer->stop();
} else { } else {
m_contentFrame->setCurrentIndex(1); m_contentFrame->setCurrentIndex(1);
QTimer::singleShot(10,this,[=](){ QTimer::singleShot(10,this,[=](){
@ -253,13 +266,45 @@ void MainWindow::initUi()
m_search_result_thread->start(); m_search_result_thread->start();
} }
searchContent(text); searchContent(text);
//允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索
if (GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH)
m_askTimer->start();
}); });
} }
m_researchTimer->stop(); //如果搜索内容发生改变,则停止建索引后重新搜索的倒计时
}); });
//初始化homepage //初始化homepage
// m_contentFrame->setQuicklyOpenList(list); //如需自定义快捷打开使用本函数 // m_contentFrame->setQuicklyOpenList(list); //如需自定义快捷打开使用本函数
m_contentFrame->initHomePage(); m_contentFrame->initHomePage();
//创建索引询问弹窗
m_askDialog = new CreateIndexAskDialog(this);
MotifWmHints ask_dialog_hints;
ask_dialog_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
ask_dialog_hints.functions = MWM_FUNC_ALL;
ask_dialog_hints.decorations = MWM_DECOR_BORDER;
XAtomHelper::getInstance()->setWindowMotifHint(m_askDialog->winId(), ask_dialog_hints);
connect(m_askDialog, &CreateIndexAskDialog::closed, this, [ = ]() {
m_isAskDialogVisible = false;
});
connect(m_askDialog, &CreateIndexAskDialog::btnClicked, this, [ = ](const bool &create_index, const bool &no_longer_ask) {
if (no_longer_ask) {
GlobalSettings::getInstance()->setValue(ENABLE_CREATE_INDEX_ASK_DIALOG, "false");
} else {
GlobalSettings::getInstance()->setValue(ENABLE_CREATE_INDEX_ASK_DIALOG, "true");
}
if (create_index) {
if (m_search_gsettings && m_search_gsettings->keys().contains(SEARCH_METHOD_KEY)) {
m_search_gsettings->set(SEARCH_METHOD_KEY, true);
} else {
//调用创建索引接口
Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::INDEXSEARCH);
//创建索引十秒后重新搜索一次(如果用户十秒内没有退出搜索界面且没有重新搜索)
m_researchTimer->start();
}
}
});
} }
/** /**
@ -289,6 +334,13 @@ void MainWindow::clearSearchResult() {
m_searchLayout->focusOut(); m_searchLayout->focusOut();
} }
/**
* @brief MainWindow::createIndexSlot
*/
void MainWindow::createIndexSlot()
{
}
/** /**
* @brief loadMainWindow * @brief loadMainWindow
* main函数里面需要用 * main函数里面需要用
@ -414,12 +466,69 @@ void MainWindow::centerToScreen(QWidget* widget) {
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top()); widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
} }
void MainWindow::initGsettings()
{
const QByteArray id(UKUI_SEARCH_SCHEMAS);
if (QGSettings::isSchemaInstalled(id)) {
m_search_gsettings = new QGSettings(id);
connect(m_search_gsettings, &QGSettings::changed, this, [ = ](const QString &key) {
if (key == SEARCH_METHOD_KEY) {
bool is_index_search = m_search_gsettings->get(SEARCH_METHOD_KEY).toBool();
this->setSearchMethod(is_index_search);
}
});
if (m_search_gsettings->keys().contains(SEARCH_METHOD_KEY)) {
bool is_index_search = m_search_gsettings->get(SEARCH_METHOD_KEY).toBool();
this->setSearchMethod(is_index_search);
}
}
}
//使用GSetting获取当前窗口应该使用的透明度 //使用GSetting获取当前窗口应该使用的透明度
double MainWindow::getTransparentData() double MainWindow::getTransparentData()
{ {
return GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble(); return GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble();
} }
void MainWindow::initTimer()
{
m_askTimer = new QTimer;
m_askTimer->setInterval(5 * 1000);
connect(m_askTimer, &QTimer::timeout, this, [ = ]() {
if (this->isVisible()) {
m_isAskDialogVisible = true;
m_askDialog->show();
m_currentSearchAsked = true;
}
m_askTimer->stop();
});
m_researchTimer = new QTimer;
m_researchTimer->setInterval(10 * 1000);
connect(m_researchTimer, &QTimer::timeout, this, [ = ]() {
if (this->isVisible()) {
searchContent(m_searchLayout->text());
}
m_researchTimer->stop();
});
}
/**
* @brief MainWindow::setSearchMethod
* @param is_index_search true为索引搜索false为暴力搜索
*/
void MainWindow::setSearchMethod(const bool &is_index_search)
{
if (is_index_search) {
//调用创建索引接口
Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::INDEXSEARCH);
//创建索引十秒后重新搜索一次(如果用户十秒内没有退出搜索界面且没有重新搜索)
m_researchTimer->start();
} else {
Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::DIRECTSEARCH);
m_researchTimer->stop();
}
}
/** /**
* @brief MainWindow::nativeEvent * @brief MainWindow::nativeEvent
* @param eventType * @param eventType
@ -438,10 +547,15 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
switch (event->response_type & ~0x80) { switch (event->response_type & ~0x80) {
case XCB_FOCUS_OUT: case XCB_FOCUS_OUT:
if (!m_isAskDialogVisible) {
m_currentSearchAsked = false;
this->hide(); this->hide();
m_askTimer->stop();
m_researchTimer->stop();
m_contentFrame->closeWebView(); m_contentFrame->closeWebView();
m_search_result_thread->requestInterruption(); m_search_result_thread->requestInterruption();
m_search_result_thread->quit(); m_search_result_thread->quit();
}
// m_seach_app_thread->stop(); // m_seach_app_thread->stop();
break; break;
default: default:

View File

@ -43,6 +43,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QGSettings/QGSettings> #include <QGSettings/QGSettings>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QTimer>
#include "content-widget.h" #include "content-widget.h"
#include "input-box.h" #include "input-box.h"
@ -51,6 +52,11 @@
#include "libsearch.h" #include "libsearch.h"
#include "search-app-thread.h" #include "search-app-thread.h"
#include "xatom-helper.h" #include "xatom-helper.h"
#include "create-index-ask-dialog.h"
#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings"
#define SEARCH_METHOD_KEY "indexSearch"
class SearchResult; class SearchResult;
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
@ -73,6 +79,7 @@ public:
// The position which mainwindow shows in the center of screen where the cursor in. // The position which mainwindow shows in the center of screen where the cursor in.
void centerToScreen(QWidget* widget); void centerToScreen(QWidget* widget);
void initGsettings();
MotifWmHints m_hints; MotifWmHints m_hints;
@ -92,8 +99,7 @@ private:
SearchBarHLayout * m_searchLayout = nullptr; // Search bar layout SearchBarHLayout * m_searchLayout = nullptr; // Search bar layout
SeachBarWidget * m_searchWidget = nullptr; // Search bar SeachBarWidget * m_searchWidget = nullptr; // Search bar
QGSettings * m_transparency_gsettings = nullptr;
double getTransparentData();
QStringList m_dirList; QStringList m_dirList;
@ -105,13 +111,29 @@ private:
SearchManager* m_searcher = nullptr; SearchManager* m_searcher = nullptr;
SettingsMatch *m_settingsMatch = nullptr; SettingsMatch *m_settingsMatch = nullptr;
QSystemTrayIcon *m_sys_tray_icon; QSystemTrayIcon *m_sys_tray_icon = nullptr;
CreateIndexAskDialog * m_askDialog = nullptr;
bool m_isAskDialogVisible = false;
QTimer * m_askTimer = nullptr; //询问是否创建索引弹窗弹出的计时器
QTimer * m_researchTimer = nullptr; //创建索引后重新执行一次搜索的计时器
bool m_currentSearchAsked = false; //本次搜索是否已经询问过是否创建索引了
QGSettings * m_search_gsettings = nullptr;
SearchMethodManager m_searchMethodManager;
void setSearchMethod(const bool&);
double getTransparentData();
void initTimer();
protected: protected:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
void initUi(); void initUi();
Q_SIGNALS:
void searchMethodChanged(FileUtils::SearchMethod);
public Q_SLOTS: public Q_SLOTS:
/** /**
* @brief Monitor screen resolution * @brief Monitor screen resolution
@ -126,6 +148,7 @@ public Q_SLOTS:
void bootOptionsFilter(QString opt); // 过滤终端命令 void bootOptionsFilter(QString opt); // 过滤终端命令
void clearSearchResult(); //清空搜索结果 void clearSearchResult(); //清空搜索结果
void createIndexSlot();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -26,6 +26,7 @@ include(singleapplication/qt-single-application.pri)
SOURCES += \ SOURCES += \
content-widget.cpp \ content-widget.cpp \
create-index-ask-dialog.cpp \
custom-style.cpp \ custom-style.cpp \
input-box.cpp \ input-box.cpp \
main.cpp \ main.cpp \
@ -38,6 +39,7 @@ SOURCES += \
HEADERS += \ HEADERS += \
content-widget.h \ content-widget.h \
create-index-ask-dialog.h \
custom-style.h \ custom-style.h \
input-box.h \ input-box.h \
mainwindow.h \ mainwindow.h \
@ -55,7 +57,9 @@ data-menu.path = /usr/share/applications
data-menu.files += ../data/ukui-search-menu.desktop data-menu.files += ../data/ukui-search-menu.desktop
data.path = /etc/xdg/autostart data.path = /etc/xdg/autostart
data.files += ../data/ukui-search.desktop data.files += ../data/ukui-search.desktop
INSTALLS += data data-menu schemes.path = /usr/share/glib-2.0/schemas/
schemes.files += ../data/org.ukui.search.data.gschema.xml
INSTALLS += data data-menu schemes
RESOURCES += \ RESOURCES += \
resource.qrc resource.qrc
@ -84,3 +88,6 @@ DEPENDPATH += $$PWD/../libsearch
# $$OUT_PWD/.qm/bo.qm \ # $$OUT_PWD/.qm/bo.qm \
# $$OUT_PWD/.qm/tr.qm \ # $$OUT_PWD/.qm/tr.qm \
# $$OUT_PWD/.qm/zh_CN.qm # $$OUT_PWD/.qm/zh_CN.qm
DISTFILES += \
../data/org.ukui.search.data.gschema.xml

View File

@ -4,61 +4,94 @@
<context> <context>
<name>ContentWidget</name> <name>ContentWidget</name>
<message> <message>
<location filename="../../src/content-widget.cpp" line="377"/> <location filename="../../src/content-widget.cpp" line="364"/>
<source>Recently Opened</source> <source>Recently Opened</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="413"/> <location filename="../../src/content-widget.cpp" line="400"/>
<source>Open Quickly</source> <source>Open Quickly</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="414"/> <location filename="../../src/content-widget.cpp" line="401"/>
<source>Commonly Used</source> <source>Commonly Used</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="681"/> <location filename="../../src/content-widget.cpp" line="668"/>
<source>Apps</source> <source>Apps</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="683"/> <location filename="../../src/content-widget.cpp" line="670"/>
<source>Settings</source> <source>Settings</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="685"/> <location filename="../../src/content-widget.cpp" line="672"/>
<source>Files</source> <source>Files</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="687"/> <location filename="../../src/content-widget.cpp" line="674"/>
<source>Dirs</source> <source>Dirs</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="689"/> <location filename="../../src/content-widget.cpp" line="676"/>
<source>File Contents</source> <source>File Contents</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="691"/> <location filename="../../src/content-widget.cpp" line="678"/>
<source>Best Matches</source> <source>Best Matches</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="693"/> <location filename="../../src/content-widget.cpp" line="680"/>
<source>Web Pages</source> <source>Web Pages</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="695"/> <location filename="../../src/content-widget.cpp" line="682"/>
<source>Unknown</source> <source>Unknown</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>CreateIndexAskDialog</name>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="28"/>
<source>ukui-search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="50"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="75"/>
<source>Creating index can help you getting results quickly, whether to create or not?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="84"/>
<source>Don&apos;t remind</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="95"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="97"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>FolderListItem</name> <name>FolderListItem</name>
<message> <message>
@ -70,17 +103,17 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="75"/> <location filename="../../src/mainwindow.cpp" line="66"/>
<source>ukui-search</source> <source>ukui-search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="126"/> <location filename="../../src/mainwindow.cpp" line="120"/>
<source>Global Search</source> <source>Global Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="188"/> <location filename="../../src/mainwindow.cpp" line="196"/>
<source>Search</source> <source>Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -121,7 +154,7 @@
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../../src/main.cpp" line="182"/> <location filename="../../src/main.cpp" line="191"/>
<source>ukui-search is already running!</source> <source>ukui-search is already running!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -129,7 +162,7 @@
<context> <context>
<name>SearchBarHLayout</name> <name>SearchBarHLayout</name>
<message> <message>
<location filename="../../src/input-box.cpp" line="120"/> <location filename="../../src/input-box.cpp" line="126"/>
<source>Search</source> <source>Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -137,32 +170,32 @@
<context> <context>
<name>SearchDetailView</name> <name>SearchDetailView</name>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="525"/> <location filename="../../src/control/search-detail-view.cpp" line="545"/>
<source>Path</source> <source>Path</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="533"/> <location filename="../../src/control/search-detail-view.cpp" line="553"/>
<source>Last time modified</source> <source>Last time modified</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="234"/> <location filename="../../src/control/search-detail-view.cpp" line="235"/>
<source>Application</source> <source>Application</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="215"/> <location filename="../../src/control/search-detail-view.cpp" line="216"/>
<source>Introduction: %1</source> <source>Introduction: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="353"/> <location filename="../../src/control/search-detail-view.cpp" line="373"/>
<source>Document</source> <source>Document</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="475"/> <location filename="../../src/control/search-detail-view.cpp" line="495"/>
<source>Preview is not avaliable</source> <source>Preview is not avaliable</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -170,55 +203,55 @@
<context> <context>
<name>SettingsWidget</name> <name>SettingsWidget</name>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="69"/> <location filename="../../src/settings-widget.cpp" line="75"/>
<location filename="../../src/settings-widget.cpp" line="286"/> <location filename="../../src/settings-widget.cpp" line="292"/>
<location filename="../../src/settings-widget.cpp" line="519"/> <location filename="../../src/settings-widget.cpp" line="526"/>
<source>Search</source> <source>Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="105"/> <location filename="../../src/settings-widget.cpp" line="111"/>
<location filename="../../src/settings-widget.cpp" line="107"/> <location filename="../../src/settings-widget.cpp" line="113"/>
<source>...</source> <source>...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="117"/> <location filename="../../src/settings-widget.cpp" line="123"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source> <source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="126"/> <location filename="../../src/settings-widget.cpp" line="132"/>
<source>Add ignored folders</source> <source>Add ignored folders</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="149"/> <location filename="../../src/settings-widget.cpp" line="155"/>
<source>Please select search engine you preferred.</source> <source>Please select search engine you preferred.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="162"/> <location filename="../../src/settings-widget.cpp" line="168"/>
<source>baidu</source> <source>baidu</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="164"/> <location filename="../../src/settings-widget.cpp" line="170"/>
<source>sougou</source> <source>sougou</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="166"/> <location filename="../../src/settings-widget.cpp" line="172"/>
<source>360</source> <source>360</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="408"/> <location filename="../../src/settings-widget.cpp" line="415"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="347"/> <location filename="../../src/settings-widget.cpp" line="353"/>
<source>Creating ...</source> <source>Creating ...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -228,102 +261,102 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="98"/> <location filename="../../src/settings-widget.cpp" line="104"/>
<source>&lt;h2&gt;Settings&lt;/h2&gt;</source> <source>&lt;h2&gt;Settings&lt;/h2&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="103"/> <location filename="../../src/settings-widget.cpp" line="109"/>
<source>&lt;h3&gt;Index State&lt;/h3&gt;</source> <source>&lt;h3&gt;Index State&lt;/h3&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="115"/> <location filename="../../src/settings-widget.cpp" line="121"/>
<source>&lt;h3&gt;File Index Settings&lt;/h3&gt;</source> <source>&lt;h3&gt;File Index Settings&lt;/h3&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="147"/> <location filename="../../src/settings-widget.cpp" line="153"/>
<source>&lt;h3&gt;Search Engine Settings&lt;/h3&gt;</source> <source>&lt;h3&gt;Search Engine Settings&lt;/h3&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="286"/> <location filename="../../src/settings-widget.cpp" line="292"/>
<source>Whether to delete this directory?</source> <source>Whether to delete this directory?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="287"/> <location filename="../../src/settings-widget.cpp" line="293"/>
<source>Yes</source> <source>Yes</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="288"/> <location filename="../../src/settings-widget.cpp" line="294"/>
<source>No</source> <source>No</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="350"/> <location filename="../../src/settings-widget.cpp" line="356"/>
<source>Done</source> <source>Done</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="358"/> <location filename="../../src/settings-widget.cpp" line="364"/>
<source>Index Entry: %1</source> <source>Index Entry: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="402"/> <location filename="../../src/settings-widget.cpp" line="409"/>
<source>Directories</source> <source>Directories</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="403"/> <location filename="../../src/settings-widget.cpp" line="410"/>
<source>select blocked folder</source> <source>select blocked folder</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="404"/> <location filename="../../src/settings-widget.cpp" line="411"/>
<source>Select</source> <source>Select</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="405"/> <location filename="../../src/settings-widget.cpp" line="412"/>
<source>Position: </source> <source>Position: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="406"/> <location filename="../../src/settings-widget.cpp" line="413"/>
<source>FileName: </source> <source>FileName: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="407"/> <location filename="../../src/settings-widget.cpp" line="414"/>
<source>FileType: </source> <source>FileType: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="503"/> <location filename="../../src/settings-widget.cpp" line="510"/>
<source>Choosen path is Empty!</source> <source>Choosen path is Empty!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="507"/> <location filename="../../src/settings-widget.cpp" line="514"/>
<source>Choosen path is not in &quot;home&quot;!</source> <source>Choosen path is not in &quot;home&quot;!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="511"/> <location filename="../../src/settings-widget.cpp" line="518"/>
<source>Its&apos; parent folder has been blocked!</source> <source>Its&apos; parent folder has been blocked!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="515"/> <location filename="../../src/settings-widget.cpp" line="522"/>
<source>Set blocked folder failed!</source> <source>Set blocked folder failed!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="520"/> <location filename="../../src/settings-widget.cpp" line="527"/>
<source>OK</source> <source>OK</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -4,61 +4,94 @@
<context> <context>
<name>ContentWidget</name> <name>ContentWidget</name>
<message> <message>
<location filename="../../src/content-widget.cpp" line="377"/> <location filename="../../src/content-widget.cpp" line="364"/>
<source>Recently Opened</source> <source>Recently Opened</source>
<translation>Yeni ılan</translation> <translation>Yeni ılan</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="413"/> <location filename="../../src/content-widget.cpp" line="400"/>
<source>Open Quickly</source> <source>Open Quickly</source>
<translation>Hızlı </translation> <translation>Hızlı </translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="414"/> <location filename="../../src/content-widget.cpp" line="401"/>
<source>Commonly Used</source> <source>Commonly Used</source>
<translation>Genel olarak kullanılan</translation> <translation>Genel olarak kullanılan</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="681"/> <location filename="../../src/content-widget.cpp" line="668"/>
<source>Apps</source> <source>Apps</source>
<translation>Uygulamalar</translation> <translation>Uygulamalar</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="683"/> <location filename="../../src/content-widget.cpp" line="670"/>
<source>Settings</source> <source>Settings</source>
<translation>Ayarlar</translation> <translation>Ayarlar</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="685"/> <location filename="../../src/content-widget.cpp" line="672"/>
<source>Files</source> <source>Files</source>
<translation>Dosyalar</translation> <translation>Dosyalar</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="687"/> <location filename="../../src/content-widget.cpp" line="674"/>
<source>Dirs</source> <source>Dirs</source>
<translation>Dizinler</translation> <translation>Dizinler</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="689"/> <location filename="../../src/content-widget.cpp" line="676"/>
<source>File Contents</source> <source>File Contents</source>
<translation>Dosya İçeriği</translation> <translation>Dosya İçeriği</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="691"/> <location filename="../../src/content-widget.cpp" line="678"/>
<source>Best Matches</source> <source>Best Matches</source>
<translation>En İyi Eşleşen</translation> <translation>En İyi Eşleşen</translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="693"/> <location filename="../../src/content-widget.cpp" line="680"/>
<source>Web Pages</source> <source>Web Pages</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="695"/> <location filename="../../src/content-widget.cpp" line="682"/>
<source>Unknown</source> <source>Unknown</source>
<translation>Bilinmeyen</translation> <translation>Bilinmeyen</translation>
</message> </message>
</context> </context>
<context>
<name>CreateIndexAskDialog</name>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="28"/>
<source>ukui-search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="50"/>
<source>Search</source>
<translation type="unfinished">Ara</translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="75"/>
<source>Creating index can help you getting results quickly, whether to create or not?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="84"/>
<source>Don&apos;t remind</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="95"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="97"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>FolderListItem</name> <name>FolderListItem</name>
<message> <message>
@ -70,17 +103,17 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="75"/> <location filename="../../src/mainwindow.cpp" line="66"/>
<source>ukui-search</source> <source>ukui-search</source>
<translation>ukui-ara</translation> <translation>ukui-ara</translation>
</message> </message>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="126"/> <location filename="../../src/mainwindow.cpp" line="120"/>
<source>Global Search</source> <source>Global Search</source>
<translation>Genel Arama</translation> <translation>Genel Arama</translation>
</message> </message>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="188"/> <location filename="../../src/mainwindow.cpp" line="196"/>
<source>Search</source> <source>Search</source>
<translation>Ara</translation> <translation>Ara</translation>
</message> </message>
@ -121,7 +154,7 @@
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../../src/main.cpp" line="182"/> <location filename="../../src/main.cpp" line="191"/>
<source>ukui-search is already running!</source> <source>ukui-search is already running!</source>
<translation>ukui-bul zaten çalışıyor!</translation> <translation>ukui-bul zaten çalışıyor!</translation>
</message> </message>
@ -129,7 +162,7 @@
<context> <context>
<name>SearchBarHLayout</name> <name>SearchBarHLayout</name>
<message> <message>
<location filename="../../src/input-box.cpp" line="120"/> <location filename="../../src/input-box.cpp" line="126"/>
<source>Search</source> <source>Search</source>
<translation>Ara</translation> <translation>Ara</translation>
</message> </message>
@ -137,32 +170,32 @@
<context> <context>
<name>SearchDetailView</name> <name>SearchDetailView</name>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="525"/> <location filename="../../src/control/search-detail-view.cpp" line="545"/>
<source>Path</source> <source>Path</source>
<translation>Yol</translation> <translation>Yol</translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="533"/> <location filename="../../src/control/search-detail-view.cpp" line="553"/>
<source>Last time modified</source> <source>Last time modified</source>
<translation>Son değiştirilme zamanı</translation> <translation>Son değiştirilme zamanı</translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="234"/> <location filename="../../src/control/search-detail-view.cpp" line="235"/>
<source>Application</source> <source>Application</source>
<translation>Uygulama</translation> <translation>Uygulama</translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="215"/> <location filename="../../src/control/search-detail-view.cpp" line="216"/>
<source>Introduction: %1</source> <source>Introduction: %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="353"/> <location filename="../../src/control/search-detail-view.cpp" line="373"/>
<source>Document</source> <source>Document</source>
<translation>Belge</translation> <translation>Belge</translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="475"/> <location filename="../../src/control/search-detail-view.cpp" line="495"/>
<source>Preview is not avaliable</source> <source>Preview is not avaliable</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -170,55 +203,55 @@
<context> <context>
<name>SettingsWidget</name> <name>SettingsWidget</name>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="69"/> <location filename="../../src/settings-widget.cpp" line="75"/>
<location filename="../../src/settings-widget.cpp" line="286"/> <location filename="../../src/settings-widget.cpp" line="292"/>
<location filename="../../src/settings-widget.cpp" line="519"/> <location filename="../../src/settings-widget.cpp" line="526"/>
<source>Search</source> <source>Search</source>
<translation>Ara</translation> <translation>Ara</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="105"/> <location filename="../../src/settings-widget.cpp" line="111"/>
<location filename="../../src/settings-widget.cpp" line="107"/> <location filename="../../src/settings-widget.cpp" line="113"/>
<source>...</source> <source>...</source>
<translation>...</translation> <translation>...</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="117"/> <location filename="../../src/settings-widget.cpp" line="123"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source> <source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation>Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz.</translation> <translation>Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz.</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="126"/> <location filename="../../src/settings-widget.cpp" line="132"/>
<source>Add ignored folders</source> <source>Add ignored folders</source>
<translation>Göz ardı edilen klasörleri ekleyin</translation> <translation>Göz ardı edilen klasörleri ekleyin</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="149"/> <location filename="../../src/settings-widget.cpp" line="155"/>
<source>Please select search engine you preferred.</source> <source>Please select search engine you preferred.</source>
<translation>Lütfen tercih ettiğiniz arama motorunu seçin.</translation> <translation>Lütfen tercih ettiğiniz arama motorunu seçin.</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="162"/> <location filename="../../src/settings-widget.cpp" line="168"/>
<source>baidu</source> <source>baidu</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="164"/> <location filename="../../src/settings-widget.cpp" line="170"/>
<source>sougou</source> <source>sougou</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="166"/> <location filename="../../src/settings-widget.cpp" line="172"/>
<source>360</source> <source>360</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="408"/> <location filename="../../src/settings-widget.cpp" line="415"/>
<source>Cancel</source> <source>Cancel</source>
<translation>İptal</translation> <translation>İptal</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="347"/> <location filename="../../src/settings-widget.cpp" line="353"/>
<source>Creating ...</source> <source>Creating ...</source>
<translation>Oluşturuluyor...</translation> <translation>Oluşturuluyor...</translation>
</message> </message>
@ -232,102 +265,102 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="98"/> <location filename="../../src/settings-widget.cpp" line="104"/>
<source>&lt;h2&gt;Settings&lt;/h2&gt;</source> <source>&lt;h2&gt;Settings&lt;/h2&gt;</source>
<translation>&lt;h2&gt;Ayarlar&lt;/h2&gt;</translation> <translation>&lt;h2&gt;Ayarlar&lt;/h2&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="103"/> <location filename="../../src/settings-widget.cpp" line="109"/>
<source>&lt;h3&gt;Index State&lt;/h3&gt;</source> <source>&lt;h3&gt;Index State&lt;/h3&gt;</source>
<translation>&lt;h3&gt;Dizin Durumu&lt;/h3&gt;</translation> <translation>&lt;h3&gt;Dizin Durumu&lt;/h3&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="115"/> <location filename="../../src/settings-widget.cpp" line="121"/>
<source>&lt;h3&gt;File Index Settings&lt;/h3&gt;</source> <source>&lt;h3&gt;File Index Settings&lt;/h3&gt;</source>
<translation>&lt;h3&gt;Dosya Dizini Ayarları&lt;/h3&gt;</translation> <translation>&lt;h3&gt;Dosya Dizini Ayarları&lt;/h3&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="147"/> <location filename="../../src/settings-widget.cpp" line="153"/>
<source>&lt;h3&gt;Search Engine Settings&lt;/h3&gt;</source> <source>&lt;h3&gt;Search Engine Settings&lt;/h3&gt;</source>
<translation>&lt;h3&gt;SArama Motoru Ayarları&lt;/h3&gt;</translation> <translation>&lt;h3&gt;SArama Motoru Ayarları&lt;/h3&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="286"/> <location filename="../../src/settings-widget.cpp" line="292"/>
<source>Whether to delete this directory?</source> <source>Whether to delete this directory?</source>
<translation>Bu dizini silinsin mi?</translation> <translation>Bu dizini silinsin mi?</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="287"/> <location filename="../../src/settings-widget.cpp" line="293"/>
<source>Yes</source> <source>Yes</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="288"/> <location filename="../../src/settings-widget.cpp" line="294"/>
<source>No</source> <source>No</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="350"/> <location filename="../../src/settings-widget.cpp" line="356"/>
<source>Done</source> <source>Done</source>
<translation>Tamam</translation> <translation>Tamam</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="358"/> <location filename="../../src/settings-widget.cpp" line="364"/>
<source>Index Entry: %1</source> <source>Index Entry: %1</source>
<translation>Dizin Girişi: %1</translation> <translation>Dizin Girişi: %1</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="402"/> <location filename="../../src/settings-widget.cpp" line="409"/>
<source>Directories</source> <source>Directories</source>
<translation>Dizinler</translation> <translation>Dizinler</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="403"/> <location filename="../../src/settings-widget.cpp" line="410"/>
<source>select blocked folder</source> <source>select blocked folder</source>
<translation>engellenen klasörü seç</translation> <translation>engellenen klasörü seç</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="404"/> <location filename="../../src/settings-widget.cpp" line="411"/>
<source>Select</source> <source>Select</source>
<translation>Seç</translation> <translation>Seç</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="405"/> <location filename="../../src/settings-widget.cpp" line="412"/>
<source>Position: </source> <source>Position: </source>
<translation>Pozisyon: </translation> <translation>Pozisyon: </translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="406"/> <location filename="../../src/settings-widget.cpp" line="413"/>
<source>FileName: </source> <source>FileName: </source>
<translation>Dosya Adı: </translation> <translation>Dosya Adı: </translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="407"/> <location filename="../../src/settings-widget.cpp" line="414"/>
<source>FileType: </source> <source>FileType: </source>
<translation>Dosya Türü: </translation> <translation>Dosya Türü: </translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="503"/> <location filename="../../src/settings-widget.cpp" line="510"/>
<source>Choosen path is Empty!</source> <source>Choosen path is Empty!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="507"/> <location filename="../../src/settings-widget.cpp" line="514"/>
<source>Choosen path is not in &quot;home&quot;!</source> <source>Choosen path is not in &quot;home&quot;!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="511"/> <location filename="../../src/settings-widget.cpp" line="518"/>
<source>Its&apos; parent folder has been blocked!</source> <source>Its&apos; parent folder has been blocked!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="515"/> <location filename="../../src/settings-widget.cpp" line="522"/>
<source>Set blocked folder failed!</source> <source>Set blocked folder failed!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="520"/> <location filename="../../src/settings-widget.cpp" line="527"/>
<source>OK</source> <source>OK</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -4,61 +4,94 @@
<context> <context>
<name>ContentWidget</name> <name>ContentWidget</name>
<message> <message>
<location filename="../../src/content-widget.cpp" line="377"/> <location filename="../../src/content-widget.cpp" line="364"/>
<source>Recently Opened</source> <source>Recently Opened</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="413"/> <location filename="../../src/content-widget.cpp" line="400"/>
<source>Open Quickly</source> <source>Open Quickly</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="414"/> <location filename="../../src/content-widget.cpp" line="401"/>
<source>Commonly Used</source> <source>Commonly Used</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="681"/> <location filename="../../src/content-widget.cpp" line="668"/>
<source>Apps</source> <source>Apps</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="683"/> <location filename="../../src/content-widget.cpp" line="670"/>
<source>Settings</source> <source>Settings</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="685"/> <location filename="../../src/content-widget.cpp" line="672"/>
<source>Files</source> <source>Files</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="687"/> <location filename="../../src/content-widget.cpp" line="674"/>
<source>Dirs</source> <source>Dirs</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="689"/> <location filename="../../src/content-widget.cpp" line="676"/>
<source>File Contents</source> <source>File Contents</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="691"/> <location filename="../../src/content-widget.cpp" line="678"/>
<source>Best Matches</source> <source>Best Matches</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="693"/> <location filename="../../src/content-widget.cpp" line="680"/>
<source>Web Pages</source> <source>Web Pages</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/content-widget.cpp" line="695"/> <location filename="../../src/content-widget.cpp" line="682"/>
<source>Unknown</source> <source>Unknown</source>
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>CreateIndexAskDialog</name>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="28"/>
<source>ukui-search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="50"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="75"/>
<source>Creating index can help you getting results quickly, whether to create or not?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="84"/>
<source>Don&apos;t remind</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="95"/>
<source>No</source>
<translation type="unfinished">(N)</translation>
</message>
<message>
<location filename="../../src/create-index-ask-dialog.cpp" line="97"/>
<source>Yes</source>
<translation type="unfinished">(Y)</translation>
</message>
</context>
<context> <context>
<name>FolderListItem</name> <name>FolderListItem</name>
<message> <message>
@ -70,17 +103,17 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="75"/> <location filename="../../src/mainwindow.cpp" line="66"/>
<source>ukui-search</source> <source>ukui-search</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="126"/> <location filename="../../src/mainwindow.cpp" line="120"/>
<source>Global Search</source> <source>Global Search</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/mainwindow.cpp" line="188"/> <location filename="../../src/mainwindow.cpp" line="196"/>
<source>Search</source> <source>Search</source>
<translation></translation> <translation></translation>
</message> </message>
@ -121,7 +154,7 @@
<context> <context>
<name>QObject</name> <name>QObject</name>
<message> <message>
<location filename="../../src/main.cpp" line="182"/> <location filename="../../src/main.cpp" line="191"/>
<source>ukui-search is already running!</source> <source>ukui-search is already running!</source>
<translation></translation> <translation></translation>
</message> </message>
@ -129,7 +162,7 @@
<context> <context>
<name>SearchBarHLayout</name> <name>SearchBarHLayout</name>
<message> <message>
<location filename="../../src/input-box.cpp" line="120"/> <location filename="../../src/input-box.cpp" line="126"/>
<source>Search</source> <source>Search</source>
<translation></translation> <translation></translation>
</message> </message>
@ -137,32 +170,32 @@
<context> <context>
<name>SearchDetailView</name> <name>SearchDetailView</name>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="525"/> <location filename="../../src/control/search-detail-view.cpp" line="545"/>
<source>Path</source> <source>Path</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="533"/> <location filename="../../src/control/search-detail-view.cpp" line="553"/>
<source>Last time modified</source> <source>Last time modified</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="234"/> <location filename="../../src/control/search-detail-view.cpp" line="235"/>
<source>Application</source> <source>Application</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="215"/> <location filename="../../src/control/search-detail-view.cpp" line="216"/>
<source>Introduction: %1</source> <source>Introduction: %1</source>
<translation>: %1</translation> <translation>: %1</translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="353"/> <location filename="../../src/control/search-detail-view.cpp" line="373"/>
<source>Document</source> <source>Document</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/control/search-detail-view.cpp" line="475"/> <location filename="../../src/control/search-detail-view.cpp" line="495"/>
<source>Preview is not avaliable</source> <source>Preview is not avaliable</source>
<translation></translation> <translation></translation>
</message> </message>
@ -175,115 +208,115 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="69"/> <location filename="../../src/settings-widget.cpp" line="75"/>
<location filename="../../src/settings-widget.cpp" line="286"/> <location filename="../../src/settings-widget.cpp" line="292"/>
<location filename="../../src/settings-widget.cpp" line="519"/> <location filename="../../src/settings-widget.cpp" line="526"/>
<source>Search</source> <source>Search</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="98"/> <location filename="../../src/settings-widget.cpp" line="104"/>
<source>&lt;h2&gt;Settings&lt;/h2&gt;</source> <source>&lt;h2&gt;Settings&lt;/h2&gt;</source>
<translation>&lt;h2&gt;&lt;/h2&gt;</translation> <translation>&lt;h2&gt;&lt;/h2&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="103"/> <location filename="../../src/settings-widget.cpp" line="109"/>
<source>&lt;h3&gt;Index State&lt;/h3&gt;</source> <source>&lt;h3&gt;Index State&lt;/h3&gt;</source>
<translation>&lt;h3&gt;&lt;/h3&gt;</translation> <translation>&lt;h3&gt;&lt;/h3&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="105"/> <location filename="../../src/settings-widget.cpp" line="111"/>
<location filename="../../src/settings-widget.cpp" line="107"/> <location filename="../../src/settings-widget.cpp" line="113"/>
<source>...</source> <source>...</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="115"/> <location filename="../../src/settings-widget.cpp" line="121"/>
<source>&lt;h3&gt;File Index Settings&lt;/h3&gt;</source> <source>&lt;h3&gt;File Index Settings&lt;/h3&gt;</source>
<translation>&lt;h3&gt;&lt;/h3&gt;</translation> <translation>&lt;h3&gt;&lt;/h3&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="117"/> <location filename="../../src/settings-widget.cpp" line="123"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source> <source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="126"/> <location filename="../../src/settings-widget.cpp" line="132"/>
<source>Add ignored folders</source> <source>Add ignored folders</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="147"/> <location filename="../../src/settings-widget.cpp" line="153"/>
<source>&lt;h3&gt;Search Engine Settings&lt;/h3&gt;</source> <source>&lt;h3&gt;Search Engine Settings&lt;/h3&gt;</source>
<translation>&lt;h3&gt;&lt;/h3&gt;</translation> <translation>&lt;h3&gt;&lt;/h3&gt;</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="149"/> <location filename="../../src/settings-widget.cpp" line="155"/>
<source>Please select search engine you preferred.</source> <source>Please select search engine you preferred.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="162"/> <location filename="../../src/settings-widget.cpp" line="168"/>
<source>baidu</source> <source>baidu</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="164"/> <location filename="../../src/settings-widget.cpp" line="170"/>
<source>sougou</source> <source>sougou</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="166"/> <location filename="../../src/settings-widget.cpp" line="172"/>
<source>360</source> <source>360</source>
<translation>360</translation> <translation>360</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="286"/> <location filename="../../src/settings-widget.cpp" line="292"/>
<source>Whether to delete this directory?</source> <source>Whether to delete this directory?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="287"/> <location filename="../../src/settings-widget.cpp" line="293"/>
<source>Yes</source> <source>Yes</source>
<translation>(Y)</translation> <translation>(Y)</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="288"/> <location filename="../../src/settings-widget.cpp" line="294"/>
<source>No</source> <source>No</source>
<translation>(N)</translation> <translation>(N)</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="408"/> <location filename="../../src/settings-widget.cpp" line="415"/>
<source>Cancel</source> <source>Cancel</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="503"/> <location filename="../../src/settings-widget.cpp" line="510"/>
<source>Choosen path is Empty!</source> <source>Choosen path is Empty!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="507"/> <location filename="../../src/settings-widget.cpp" line="514"/>
<source>Choosen path is not in &quot;home&quot;!</source> <source>Choosen path is not in &quot;home&quot;!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="511"/> <location filename="../../src/settings-widget.cpp" line="518"/>
<source>Its&apos; parent folder has been blocked!</source> <source>Its&apos; parent folder has been blocked!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="515"/> <location filename="../../src/settings-widget.cpp" line="522"/>
<source>Set blocked folder failed!</source> <source>Set blocked folder failed!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="520"/> <location filename="../../src/settings-widget.cpp" line="527"/>
<source>OK</source> <source>OK</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="347"/> <location filename="../../src/settings-widget.cpp" line="353"/>
<source>Creating ...</source> <source>Creating ...</source>
<translation></translation> <translation></translation>
</message> </message>
@ -292,42 +325,42 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="350"/> <location filename="../../src/settings-widget.cpp" line="356"/>
<source>Done</source> <source>Done</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="358"/> <location filename="../../src/settings-widget.cpp" line="364"/>
<source>Index Entry: %1</source> <source>Index Entry: %1</source>
<translation>: %1</translation> <translation>: %1</translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="402"/> <location filename="../../src/settings-widget.cpp" line="409"/>
<source>Directories</source> <source>Directories</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="403"/> <location filename="../../src/settings-widget.cpp" line="410"/>
<source>select blocked folder</source> <source>select blocked folder</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="404"/> <location filename="../../src/settings-widget.cpp" line="411"/>
<source>Select</source> <source>Select</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="405"/> <location filename="../../src/settings-widget.cpp" line="412"/>
<source>Position: </source> <source>Position: </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="406"/> <location filename="../../src/settings-widget.cpp" line="413"/>
<source>FileName: </source> <source>FileName: </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../src/settings-widget.cpp" line="407"/> <location filename="../../src/settings-widget.cpp" line="414"/>
<source>FileType: </source> <source>FileType: </source>
<translation></translation> <translation></translation>
</message> </message>