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::_current_index_count = 0;
unsigned short FileUtils::_index_status = 0;
FileUtils::SearchMethod FileUtils::searchMethod = FileUtils::SearchMethod::DIRECTSEARCH;
QMap<QString, QStringList> FileUtils::map_chinese2pinyin = QMap<QString, QStringList>();
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 unsigned short _index_status;
// enum class SearchMethod{ DIRECTSEARCH = 0, INDEXSEARCH = 1};
// static SearchMethod searchMethod = FileUtils::SearchMethod::DIRECTSEARCH;
enum class SearchMethod{ DIRECTSEARCH = 0, INDEXSEARCH = 1};
static SearchMethod searchMethod;
private:
FileUtils();

View File

@ -268,14 +268,14 @@ void GlobalSettings::setValue(const QString &key, const QVariant &value)
// m_settings->sync();
QtConcurrent::run([=]() {
// qDebug()<<m_settings->status();
// if (m_mutex.tryLock(1000)) {
// if (m_mutex.tryLock(1000)) {
// m_mutex.lock();
m_settings->setValue(key, value);
// qDebug()<<"setvalue========finish!!!"<<key<<":"<<value;
m_settings->sync();
// qDebug()<<"setvalue========sync!!!"<<key<<":"<<value;
// m_mutex.unlock();
// }
// m_mutex.unlock();
// }
});
}

View File

@ -44,6 +44,7 @@
#define CONTENT_INDEX_DATABASE_STATE "content_index_database_state"
#define INDEX_GENERATOR_NORMAL_EXIT "index_generator_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 PATH_EMPTY 1;
#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 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 contentIndexDataBaseStatus = GlobalSettings::getInstance()->getValue(CONTENT_INDEX_DATABASE_STATE).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>();
NEW_QUEUE(this->q_content_index);
// 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;
char buffer[2];
@ -189,7 +204,7 @@ void FirstIndex::run(){
if (p_indexGenerator)
delete p_indexGenerator;
p_indexGenerator = nullptr;
GlobalSettings::getInstance()->forceSync();
// GlobalSettings::getInstance()->forceSync();
::_exit(0);
}
else if(pid < 0)
@ -204,8 +219,8 @@ void FirstIndex::run(){
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "2");
int retval = write(fifo_fd, buffer, strlen(buffer));
if(retval == -1)
int retval1 = write(fifo_fd, buffer, strlen(buffer));
if(retval1 == -1)
{
qWarning("write error\n");
}

View File

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

View File

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

View File

@ -53,17 +53,12 @@ InotifyIndex::InotifyIndex(const QString& path) : Traverse_BFS(path)
usQDBus.setInotifyMaxUserWatches();
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()
{
IndexGenerator::getInstance()->~IndexGenerator();
qWarning() << "~InotifyIndex";
}
void InotifyIndex::firstTraverse(){
@ -113,7 +108,7 @@ bool InotifyIndex::AddWatch(const QString &path){
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));
if (ret){
qDebug() << "remove path error";
@ -122,26 +117,27 @@ bool InotifyIndex::RemoveWatch(const QString &path){
// Q_ASSERT(ret == 0);
assert(ret == 0);
for (QMap<int, QString>::Iterator i = currentPath.begin(); i != currentPath.end();){
// qDebug() << i.value();
if (removeFromDatabase) {
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().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;
// return false;
}
// assert(ret == 0);
// assert(ret == 0);
/*--------------------------------*/
//在此调用删除索引
qDebug() << i.value();
IndexGenerator::getInstance()->deleteAllIndex(new QStringList(i.value()));
/*--------------------------------*/
currentPath.erase(i++);
// i++;
// i++;
}
else{
i++;
@ -151,6 +147,32 @@ bool InotifyIndex::RemoveWatch(const QString &path){
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;
//这个貌似不用删先mark一下
// currentPath.remove(currentPath.key(path));
@ -228,6 +250,13 @@ next:
}
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;
char buffer[2];
memset(buffer, 0, sizeof(buffer));
@ -256,8 +285,8 @@ void InotifyIndex::run(){
ssize_t numRead;
for (;;) { /* Read events forever */
read:
while (FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) {
// for (;;) { /* Read events forever */
memset(buf, 0x00, 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;
if(event->name[0] != '.'){
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0");
goto fork;
break;
}
tmp += sizeof(struct inotify_event) + event->len;
}
goto read;
if (tmp >= buf + numRead) {
continue;
}
fork:
++FileUtils::_index_status;
pid_t pid;
@ -323,7 +352,7 @@ fork:
qDebug() << "select timeout!";
::free(read_timeout);
IndexGenerator::getInstance()->~IndexGenerator();
GlobalSettings::getInstance()->forceSync();
// GlobalSettings::getInstance()->forceSync();
::_exit(0);
}else{
GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0");
@ -343,7 +372,6 @@ fork:
else if (pid > 0){
memset(buf, 0x00, BUF_LEN);
waitpid(pid, NULL, 0);
--FileUtils::_index_status;
}
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();
bool AddWatch(const QString&);
bool RemoveWatch(const QString&);
bool RemoveWatch(const QString&, bool removeFromDatabase = true);
virtual void DoSomething(const QFileInfo &) final;
void eventProcess(const char*, ssize_t);
@ -56,7 +56,6 @@ public:
protected:
void run() override;
private:
QString* m_watch_path;
int m_fd;
QMap<int, QString> currentPath;

View File

@ -37,14 +37,11 @@ SearchManager::~SearchManager()
int SearchManager::getCurrentIndexCount()
{
try
{
try {
Xapian::Database db(INDEX_PATH);
return db.get_doccount();
}
catch(const Xapian::Error &e)
{
qWarning() <<QString::fromStdString(e.get_description());
} catch(const Xapian::Error &e) {
qWarning() << QString::fromStdString(e.get_description());
return 0;
}
}
@ -62,8 +59,11 @@ void SearchManager::onKeywordSearch(QString keyword,QQueue<QString> *searchResul
++uniqueSymbol3;
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 = new FileSearch(searchResultFile,uniqueSymbol1,keyword,"0",1,0,5);
m_pool.start(filesearch);
@ -75,6 +75,9 @@ void SearchManager::onKeywordSearch(QString keyword,QQueue<QString> *searchResul
FileContentSearch *contentSearch;
contentSearch = new FileContentSearch(searchResultContent,uniqueSymbol3,keyword,0,5);
m_pool.start(contentSearch);
} else {
qWarning() << "Unknown search method! FileUtils::searchMethod: " << static_cast<int>(FileUtils::searchMethod);
}
return;
}
@ -109,14 +112,14 @@ FileSearch::~FileSearch()
void FileSearch::run()
{
if(!m_search_result->isEmpty())
if (!m_search_result->isEmpty()){
m_search_result->clear();
}
int resultCount = 0;
int total = 0;
while(total < 100)
{
while (total < 100) {
resultCount = keywordSearchfile();
if(resultCount == 0 || resultCount == -1)
if (resultCount == 0 || resultCount == -1)
break;
total += resultCount;
m_begin += m_num;
@ -126,22 +129,18 @@ void FileSearch::run()
int FileSearch::keywordSearchfile()
{
try
{
try {
qDebug() << "--keywordSearchfile start--";
Xapian::Database db(INDEX_PATH);
Xapian::Query query = creatQueryForFileSearch(db);
Xapian::Enquire enquire(db);
Xapian::Query queryFile;
if(!m_value.isEmpty())
{
if (!m_value.isEmpty()) {
std::string slotValue = m_value.toStdString();
Xapian::Query queryValue = Xapian::Query(Xapian::Query::OP_VALUE_RANGE,m_slot,slotValue,slotValue);
queryFile = Xapian::Query(Xapian::Query::OP_AND,query,queryValue);
}
else
{
} else {
queryFile = query;
}
@ -150,19 +149,17 @@ int FileSearch::keywordSearchfile()
enquire.set_query(queryFile);
Xapian::MSet result = enquire.get_mset(m_begin, m_num);
int resultCount = result.size();
qDebug()<< "keywordSearchfile results count=" <<resultCount;
if(resultCount == 0)
qDebug() << "keywordSearchfile results count=" <<resultCount;
if (resultCount == 0)
return 0;
if(getResult(result) == -1)
if (getResult(result) == -1)
return -1;
qDebug()<< "--keywordSearchfile finish--";
qDebug() << "--keywordSearchfile finish--";
return resultCount;
}
catch(const Xapian::Error &e)
{
} catch (const Xapian::Error &e) {
qWarning() <<QString::fromStdString(e.get_description());
qDebug()<< "--keywordSearchfile finish--";
qDebug() << "--keywordSearchfile finish--";
return -1;
}
}
@ -171,8 +168,7 @@ Xapian::Query FileSearch::creatQueryForFileSearch(Xapian::Database &db)
{
auto userInput = m_keyword.toLower();
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()));
// 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)
{
for (auto it = result.begin(); it != result.end(); ++it)
{
for (auto it = result.begin(); it != result.end(); ++it) {
Xapian::Document doc = it.get_document();
std::string data = doc.get_data();
Xapian::weight docScoreWeight = it.get_weight();
@ -191,29 +186,23 @@ int FileSearch::getResult(Xapian::MSet &result)
QString path = QString::fromStdString(data);
std::string().swap(data);
if(SearchManager::isBlocked(path))
if (SearchManager::isBlocked(path)) {
continue;
}
QFileInfo info(path);
if(!info.exists())
{
// pathTobeDelete->append(QString::fromStdString(data));
if (!info.exists()) {
// pathTobeDelete->append(QString::fromStdString(data));
qDebug()<<path<<"is not exist!!";
}
else
{
switch (m_value.toInt())
{
} else {
switch (m_value.toInt()) {
case 1:
SearchManager::m_mutex1.lock();
if(m_uniqueSymbol == SearchManager::uniqueSymbol2)
{
if (m_uniqueSymbol == SearchManager::uniqueSymbol2) {
m_search_result->enqueue(path);
SearchManager::m_mutex1.unlock();
}
else
{
} else {
SearchManager::m_mutex1.unlock();
return -1;
}
@ -221,13 +210,10 @@ int FileSearch::getResult(Xapian::MSet &result)
break;
case 0:
SearchManager::m_mutex2.lock();
if(m_uniqueSymbol == SearchManager::uniqueSymbol1)
{
if(m_uniqueSymbol == SearchManager::uniqueSymbol1) {
m_search_result->enqueue(path);
SearchManager::m_mutex2.unlock();
}
else
{
} else {
SearchManager::m_mutex2.unlock();
return -1;
}
@ -237,7 +223,7 @@ int FileSearch::getResult(Xapian::MSet &result)
}
// searchResult.append(path);
}
qDebug()<< "doc="<< path << ",weight=" <<docScoreWeight << ",percent=" << docScorePercent;
qDebug() << "doc=" << path << ",weight=" << docScoreWeight << ",percent=" << docScorePercent;
}
// if(!pathTobeDelete->isEmpty())
// deleteAllIndex(pathTobeDelete)
@ -261,16 +247,17 @@ FileContentSearch::~FileContentSearch()
void FileContentSearch::run()
{
if(!m_search_result->isEmpty())
if (!m_search_result->isEmpty()) {
m_search_result->clear();
}
int resultCount = 0;
int total = 0;
while(total<50)
{
while (total<50) {
resultCount = keywordSearchContent();
if(resultCount == 0 || resultCount == -1)
if (resultCount == 0 || resultCount == -1) {
break;
}
total += resultCount;
m_begin += m_num;
}
@ -279,8 +266,7 @@ void FileContentSearch::run()
int FileContentSearch::keywordSearchContent()
{
try
{
try {
qDebug()<<"--keywordSearchContent search start--";
Xapian::Database db(CONTENT_INDEX_PATH);
@ -305,8 +291,7 @@ int FileContentSearch::keywordSearchContent()
QVector<SKeyWord> sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword);
//Creat a query
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(" ");
}
@ -333,49 +318,48 @@ int FileContentSearch::keywordSearchContent()
// qDebug()<<QString::fromStdString(sKeyWord.at(i).word);
// }
// Xapian::Query queryPhrase =Xapian::Query(Xapian::Query::OP_AND, v.begin(), v.end());
qDebug()<<"keywordSearchContent:"<<QString::fromStdString(query.get_description());
qDebug() << "keywordSearchContent:" << QString::fromStdString(query.get_description());
enquire.set_query(query);
Xapian::MSet result = enquire.get_mset(m_begin, m_num);
int resultCount = result.size();
if(result.size() == 0)
if (result.size() == 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;
}
qDebug()<< "--keywordSearchContent search finish--";
return resultCount;
}
catch(const Xapian::Error &e)
{
qWarning() <<QString::fromStdString(e.get_description());
qDebug()<< "--keywordSearchContent search finish--";
} catch(const Xapian::Error &e) {
qWarning() << QString::fromStdString(e.get_description());
qDebug() << "--keywordSearchContent search finish--";
return -1;
}
}
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();
std::string data = doc.get_data();
double docScoreWeight = it.get_weight();
Xapian::percent docScorePercent = it.get_percent();
QString path = QString::fromStdString(doc.get_value(1));
if(SearchManager::isBlocked(path))
if (SearchManager::isBlocked(path)){
continue;
}
QFileInfo info(path);
if(!info.exists())
{
if (!info.exists()) {
// pathTobeDelete->append(QString::fromStdString(data));
qDebug()<<path<<"is not exist!!";
qDebug() << path << "is not exist!!";
continue;
}
// Construct snippets containing keyword.
@ -387,14 +371,14 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord)
int size = wordTobeFound.length();
term.skip_to(wordTobeFound);
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);
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,"...");
else
} else {
snippet.append("...").prepend("...");
}
snippets.append(snippet);
QString().swap(snippet);
std::string().swap(s);
@ -418,23 +402,71 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord)
// }
SearchManager::m_mutex3.lock();
if(m_uniqueSymbol == SearchManager::uniqueSymbol3)
{
if (m_uniqueSymbol == SearchManager::uniqueSymbol3) {
m_search_result->enqueue(qMakePair(path,snippets));
SearchManager::m_mutex3.unlock();
snippets.clear();
QStringList().swap(snippets);
}
else
{
} else {
SearchManager::m_mutex3.unlock();
return -1;
}
// searchResult.insert(path,snippets);
qDebug()<< "path="<< path << ",weight=" <<docScoreWeight << ",percent=" << docScorePercent;
qDebug() << "path=" << path << ",weight=" << docScoreWeight << ",percent=" << docScorePercent;
}
// // if(!pathTobeDelete->isEmpty())
// // deleteAllIndex(pathTobeDelete)
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_num = 20;
};
class FileContentSearch : public QRunnable
{
public:
@ -133,4 +134,17 @@ private:
int m_begin = 0;
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

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
{
public:
Traverse_BFS() = default;
void Traverse();
virtual ~Traverse_BFS() = default;
virtual void DoSomething(const QFileInfo&) = 0;
void setPath(const QString&);
protected:
explicit Traverse_BFS(const QString&);
Traverse_BFS(const QString&);
QString path = "/home";
private:
Traverse_BFS(const Traverse_BFS&) = delete;

View File

@ -21,15 +21,16 @@
#define LIBSEARCH_H
#include "libsearch_global.h"
#include "index/search-manager.h"
#include "appsearch/app-match.h"
#include "settingsearch/setting-match.h"
#include "file-utils.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/inotify-index.h"
#include "index/search-manager.h"
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();
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[])
{
// 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.process(app);
}*/
/*
// 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())
@ -194,7 +218,7 @@ int main(int argc, char *argv[])
return -1;
}
qDebug()<<"create fifo success\n";
*/
// Set max_user_watches to a number which is enough big.
UkuiSearchQDBus usQDBus;
usQDBus.setInotifyMaxUserWatches();
@ -249,6 +273,9 @@ int main(int argc, char *argv[])
// w->moveToPanel();
centerToScreen(w);
//请务必在connect之后初始化mainwindow的Gsettings为了保证gsettings第一次读取到的配置值能成功应用
w->initGsettings();
//使用窗管的无边框策略
// w->setProperty("useStyleWindowManager", false); //禁用拖动
// MotifWmHints hints;
@ -278,13 +305,13 @@ int main(int argc, char *argv[])
// TODO
// First insdex start, the parameter us useless, should remove the parameter
FirstIndex fi("/home/zhangzihao/Desktop");
fi.start();
// FirstIndex fi("/home/zhangzihao/Desktop");
// fi.start();
// TODO
// Inotify index start, the parameter us useless, should remove the parameter
InotifyIndex* ii = InotifyIndex::getInstance("/home");
ii->start();
// InotifyIndex* ii = InotifyIndex::getInstance("/home");
// ii->start();
return app.exec();
}

View File

@ -65,6 +65,7 @@ MainWindow::MainWindow(QWidget *parent) :
this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
this->setWindowTitle(tr("ukui-search"));
initUi();
initTimer();
// setProperty("useStyleWindowManager", false); //禁止拖动
m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
@ -80,11 +81,6 @@ MainWindow::MainWindow(QWidget *parent) :
setProperty("blurRegion", 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) {
this->setPalette(pal);
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()
@ -160,6 +160,18 @@ MainWindow::~MainWindow()
delete m_settingsWidget;
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_contentFrame->setCurrentIndex(0);
m_askTimer->stop();
} else {
m_contentFrame->setCurrentIndex(1);
QTimer::singleShot(10,this,[=](){
@ -253,13 +266,45 @@ void MainWindow::initUi()
m_search_result_thread->start();
}
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
// m_contentFrame->setQuicklyOpenList(list); //如需自定义快捷打开使用本函数
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();
}
/**
* @brief MainWindow::createIndexSlot
*/
void MainWindow::createIndexSlot()
{
}
/**
* @brief loadMainWindow
* 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());
}
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获取当前窗口应该使用的透明度
double MainWindow::getTransparentData()
{
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
* @param eventType
@ -438,10 +547,15 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r
switch (event->response_type & ~0x80) {
case XCB_FOCUS_OUT:
if (!m_isAskDialogVisible) {
m_currentSearchAsked = false;
this->hide();
m_askTimer->stop();
m_researchTimer->stop();
m_contentFrame->closeWebView();
m_search_result_thread->requestInterruption();
m_search_result_thread->quit();
}
// m_seach_app_thread->stop();
break;
default:

View File

@ -43,6 +43,7 @@
#include <QKeyEvent>
#include <QGSettings/QGSettings>
#include <QSystemTrayIcon>
#include <QTimer>
#include "content-widget.h"
#include "input-box.h"
@ -51,6 +52,11 @@
#include "libsearch.h"
#include "search-app-thread.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 MainWindow : public QMainWindow
@ -73,6 +79,7 @@ public:
// The position which mainwindow shows in the center of screen where the cursor in.
void centerToScreen(QWidget* widget);
void initGsettings();
MotifWmHints m_hints;
@ -92,8 +99,7 @@ private:
SearchBarHLayout * m_searchLayout = nullptr; // Search bar layout
SeachBarWidget * m_searchWidget = nullptr; // Search bar
QGSettings * m_transparency_gsettings = nullptr;
double getTransparentData();
QStringList m_dirList;
@ -105,13 +111,29 @@ private:
SearchManager* m_searcher = 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:
void paintEvent(QPaintEvent *);
void keyPressEvent(QKeyEvent *event);
void initUi();
Q_SIGNALS:
void searchMethodChanged(FileUtils::SearchMethod);
public Q_SLOTS:
/**
* @brief Monitor screen resolution
@ -126,6 +148,7 @@ public Q_SLOTS:
void bootOptionsFilter(QString opt); // 过滤终端命令
void clearSearchResult(); //清空搜索结果
void createIndexSlot();
};
#endif // MAINWINDOW_H

View File

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

View File

@ -4,61 +4,94 @@
<context>
<name>ContentWidget</name>
<message>
<location filename="../../src/content-widget.cpp" line="377"/>
<location filename="../../src/content-widget.cpp" line="364"/>
<source>Recently Opened</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="413"/>
<location filename="../../src/content-widget.cpp" line="400"/>
<source>Open Quickly</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="414"/>
<location filename="../../src/content-widget.cpp" line="401"/>
<source>Commonly Used</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="681"/>
<location filename="../../src/content-widget.cpp" line="668"/>
<source>Apps</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="683"/>
<location filename="../../src/content-widget.cpp" line="670"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="685"/>
<location filename="../../src/content-widget.cpp" line="672"/>
<source>Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="687"/>
<location filename="../../src/content-widget.cpp" line="674"/>
<source>Dirs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="689"/>
<location filename="../../src/content-widget.cpp" line="676"/>
<source>File Contents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="691"/>
<location filename="../../src/content-widget.cpp" line="678"/>
<source>Best Matches</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="693"/>
<location filename="../../src/content-widget.cpp" line="680"/>
<source>Web Pages</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="695"/>
<location filename="../../src/content-widget.cpp" line="682"/>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</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>
<name>FolderListItem</name>
<message>
@ -70,17 +103,17 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../../src/mainwindow.cpp" line="75"/>
<location filename="../../src/mainwindow.cpp" line="66"/>
<source>ukui-search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="126"/>
<location filename="../../src/mainwindow.cpp" line="120"/>
<source>Global Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="188"/>
<location filename="../../src/mainwindow.cpp" line="196"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
@ -121,7 +154,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../../src/main.cpp" line="182"/>
<location filename="../../src/main.cpp" line="191"/>
<source>ukui-search is already running!</source>
<translation type="unfinished"></translation>
</message>
@ -129,7 +162,7 @@
<context>
<name>SearchBarHLayout</name>
<message>
<location filename="../../src/input-box.cpp" line="120"/>
<location filename="../../src/input-box.cpp" line="126"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
@ -137,32 +170,32 @@
<context>
<name>SearchDetailView</name>
<message>
<location filename="../../src/control/search-detail-view.cpp" line="525"/>
<location filename="../../src/control/search-detail-view.cpp" line="545"/>
<source>Path</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
@ -170,55 +203,55 @@
<context>
<name>SettingsWidget</name>
<message>
<location filename="../../src/settings-widget.cpp" line="69"/>
<location filename="../../src/settings-widget.cpp" line="286"/>
<location filename="../../src/settings-widget.cpp" line="519"/>
<location filename="../../src/settings-widget.cpp" line="75"/>
<location filename="../../src/settings-widget.cpp" line="292"/>
<location filename="../../src/settings-widget.cpp" line="526"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="105"/>
<location filename="../../src/settings-widget.cpp" line="107"/>
<location filename="../../src/settings-widget.cpp" line="111"/>
<location filename="../../src/settings-widget.cpp" line="113"/>
<source>...</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="126"/>
<location filename="../../src/settings-widget.cpp" line="132"/>
<source>Add ignored folders</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="162"/>
<location filename="../../src/settings-widget.cpp" line="168"/>
<source>baidu</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="164"/>
<location filename="../../src/settings-widget.cpp" line="170"/>
<source>sougou</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="166"/>
<location filename="../../src/settings-widget.cpp" line="172"/>
<source>360</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="408"/>
<location filename="../../src/settings-widget.cpp" line="415"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="347"/>
<location filename="../../src/settings-widget.cpp" line="353"/>
<source>Creating ...</source>
<translation type="unfinished"></translation>
</message>
@ -228,102 +261,102 @@
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="287"/>
<location filename="../../src/settings-widget.cpp" line="293"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="288"/>
<location filename="../../src/settings-widget.cpp" line="294"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="350"/>
<location filename="../../src/settings-widget.cpp" line="356"/>
<source>Done</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="358"/>
<location filename="../../src/settings-widget.cpp" line="364"/>
<source>Index Entry: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="402"/>
<location filename="../../src/settings-widget.cpp" line="409"/>
<source>Directories</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="403"/>
<location filename="../../src/settings-widget.cpp" line="410"/>
<source>select blocked folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="404"/>
<location filename="../../src/settings-widget.cpp" line="411"/>
<source>Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="405"/>
<location filename="../../src/settings-widget.cpp" line="412"/>
<source>Position: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="406"/>
<location filename="../../src/settings-widget.cpp" line="413"/>
<source>FileName: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="407"/>
<location filename="../../src/settings-widget.cpp" line="414"/>
<source>FileType: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="503"/>
<location filename="../../src/settings-widget.cpp" line="510"/>
<source>Choosen path is Empty!</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="515"/>
<location filename="../../src/settings-widget.cpp" line="522"/>
<source>Set blocked folder failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="520"/>
<location filename="../../src/settings-widget.cpp" line="527"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>

View File

@ -4,61 +4,94 @@
<context>
<name>ContentWidget</name>
<message>
<location filename="../../src/content-widget.cpp" line="377"/>
<location filename="../../src/content-widget.cpp" line="364"/>
<source>Recently Opened</source>
<translation>Yeni ılan</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="413"/>
<location filename="../../src/content-widget.cpp" line="400"/>
<source>Open Quickly</source>
<translation>Hızlı </translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="414"/>
<location filename="../../src/content-widget.cpp" line="401"/>
<source>Commonly Used</source>
<translation>Genel olarak kullanılan</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="681"/>
<location filename="../../src/content-widget.cpp" line="668"/>
<source>Apps</source>
<translation>Uygulamalar</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="683"/>
<location filename="../../src/content-widget.cpp" line="670"/>
<source>Settings</source>
<translation>Ayarlar</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="685"/>
<location filename="../../src/content-widget.cpp" line="672"/>
<source>Files</source>
<translation>Dosyalar</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="687"/>
<location filename="../../src/content-widget.cpp" line="674"/>
<source>Dirs</source>
<translation>Dizinler</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="689"/>
<location filename="../../src/content-widget.cpp" line="676"/>
<source>File Contents</source>
<translation>Dosya İçeriği</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="691"/>
<location filename="../../src/content-widget.cpp" line="678"/>
<source>Best Matches</source>
<translation>En İyi Eşleşen</translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="693"/>
<location filename="../../src/content-widget.cpp" line="680"/>
<source>Web Pages</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="695"/>
<location filename="../../src/content-widget.cpp" line="682"/>
<source>Unknown</source>
<translation>Bilinmeyen</translation>
</message>
</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>
<name>FolderListItem</name>
<message>
@ -70,17 +103,17 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../../src/mainwindow.cpp" line="75"/>
<location filename="../../src/mainwindow.cpp" line="66"/>
<source>ukui-search</source>
<translation>ukui-ara</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="126"/>
<location filename="../../src/mainwindow.cpp" line="120"/>
<source>Global Search</source>
<translation>Genel Arama</translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="188"/>
<location filename="../../src/mainwindow.cpp" line="196"/>
<source>Search</source>
<translation>Ara</translation>
</message>
@ -121,7 +154,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../../src/main.cpp" line="182"/>
<location filename="../../src/main.cpp" line="191"/>
<source>ukui-search is already running!</source>
<translation>ukui-bul zaten çalışıyor!</translation>
</message>
@ -129,7 +162,7 @@
<context>
<name>SearchBarHLayout</name>
<message>
<location filename="../../src/input-box.cpp" line="120"/>
<location filename="../../src/input-box.cpp" line="126"/>
<source>Search</source>
<translation>Ara</translation>
</message>
@ -137,32 +170,32 @@
<context>
<name>SearchDetailView</name>
<message>
<location filename="../../src/control/search-detail-view.cpp" line="525"/>
<location filename="../../src/control/search-detail-view.cpp" line="545"/>
<source>Path</source>
<translation>Yol</translation>
</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>
<translation>Son değiştirilme zamanı</translation>
</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>
<translation>Uygulama</translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation>Belge</translation>
</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>
<translation type="unfinished"></translation>
</message>
@ -170,55 +203,55 @@
<context>
<name>SettingsWidget</name>
<message>
<location filename="../../src/settings-widget.cpp" line="69"/>
<location filename="../../src/settings-widget.cpp" line="286"/>
<location filename="../../src/settings-widget.cpp" line="519"/>
<location filename="../../src/settings-widget.cpp" line="75"/>
<location filename="../../src/settings-widget.cpp" line="292"/>
<location filename="../../src/settings-widget.cpp" line="526"/>
<source>Search</source>
<translation>Ara</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="105"/>
<location filename="../../src/settings-widget.cpp" line="107"/>
<location filename="../../src/settings-widget.cpp" line="111"/>
<location filename="../../src/settings-widget.cpp" line="113"/>
<source>...</source>
<translation>...</translation>
</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>
<translation>Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz.</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="126"/>
<location filename="../../src/settings-widget.cpp" line="132"/>
<source>Add ignored folders</source>
<translation>Göz ardı edilen klasörleri ekleyin</translation>
</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>
<translation>Lütfen tercih ettiğiniz arama motorunu seçin.</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="162"/>
<location filename="../../src/settings-widget.cpp" line="168"/>
<source>baidu</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="164"/>
<location filename="../../src/settings-widget.cpp" line="170"/>
<source>sougou</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="166"/>
<location filename="../../src/settings-widget.cpp" line="172"/>
<source>360</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="408"/>
<location filename="../../src/settings-widget.cpp" line="415"/>
<source>Cancel</source>
<translation>İptal</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="347"/>
<location filename="../../src/settings-widget.cpp" line="353"/>
<source>Creating ...</source>
<translation>Oluşturuluyor...</translation>
</message>
@ -232,102 +265,102 @@
<translation type="unfinished"></translation>
</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>
<translation>&lt;h2&gt;Ayarlar&lt;/h2&gt;</translation>
</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>
<translation>&lt;h3&gt;Dizin Durumu&lt;/h3&gt;</translation>
</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>
<translation>&lt;h3&gt;Dosya Dizini Ayarları&lt;/h3&gt;</translation>
</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>
<translation>&lt;h3&gt;SArama Motoru Ayarları&lt;/h3&gt;</translation>
</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>
<translation>Bu dizini silinsin mi?</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="287"/>
<location filename="../../src/settings-widget.cpp" line="293"/>
<source>Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="288"/>
<location filename="../../src/settings-widget.cpp" line="294"/>
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="350"/>
<location filename="../../src/settings-widget.cpp" line="356"/>
<source>Done</source>
<translation>Tamam</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="358"/>
<location filename="../../src/settings-widget.cpp" line="364"/>
<source>Index Entry: %1</source>
<translation>Dizin Girişi: %1</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="402"/>
<location filename="../../src/settings-widget.cpp" line="409"/>
<source>Directories</source>
<translation>Dizinler</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="403"/>
<location filename="../../src/settings-widget.cpp" line="410"/>
<source>select blocked folder</source>
<translation>engellenen klasörü seç</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="404"/>
<location filename="../../src/settings-widget.cpp" line="411"/>
<source>Select</source>
<translation>Seç</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="405"/>
<location filename="../../src/settings-widget.cpp" line="412"/>
<source>Position: </source>
<translation>Pozisyon: </translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="406"/>
<location filename="../../src/settings-widget.cpp" line="413"/>
<source>FileName: </source>
<translation>Dosya Adı: </translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="407"/>
<location filename="../../src/settings-widget.cpp" line="414"/>
<source>FileType: </source>
<translation>Dosya Türü: </translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="503"/>
<location filename="../../src/settings-widget.cpp" line="510"/>
<source>Choosen path is Empty!</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="515"/>
<location filename="../../src/settings-widget.cpp" line="522"/>
<source>Set blocked folder failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="520"/>
<location filename="../../src/settings-widget.cpp" line="527"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>

View File

@ -4,61 +4,94 @@
<context>
<name>ContentWidget</name>
<message>
<location filename="../../src/content-widget.cpp" line="377"/>
<location filename="../../src/content-widget.cpp" line="364"/>
<source>Recently Opened</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="413"/>
<location filename="../../src/content-widget.cpp" line="400"/>
<source>Open Quickly</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="414"/>
<location filename="../../src/content-widget.cpp" line="401"/>
<source>Commonly Used</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="681"/>
<location filename="../../src/content-widget.cpp" line="668"/>
<source>Apps</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="683"/>
<location filename="../../src/content-widget.cpp" line="670"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="685"/>
<location filename="../../src/content-widget.cpp" line="672"/>
<source>Files</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="687"/>
<location filename="../../src/content-widget.cpp" line="674"/>
<source>Dirs</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="689"/>
<location filename="../../src/content-widget.cpp" line="676"/>
<source>File Contents</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="691"/>
<location filename="../../src/content-widget.cpp" line="678"/>
<source>Best Matches</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="693"/>
<location filename="../../src/content-widget.cpp" line="680"/>
<source>Web Pages</source>
<translation></translation>
</message>
<message>
<location filename="../../src/content-widget.cpp" line="695"/>
<location filename="../../src/content-widget.cpp" line="682"/>
<source>Unknown</source>
<translation></translation>
</message>
</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>
<name>FolderListItem</name>
<message>
@ -70,17 +103,17 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../../src/mainwindow.cpp" line="75"/>
<location filename="../../src/mainwindow.cpp" line="66"/>
<source>ukui-search</source>
<translation></translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="126"/>
<location filename="../../src/mainwindow.cpp" line="120"/>
<source>Global Search</source>
<translation></translation>
</message>
<message>
<location filename="../../src/mainwindow.cpp" line="188"/>
<location filename="../../src/mainwindow.cpp" line="196"/>
<source>Search</source>
<translation></translation>
</message>
@ -121,7 +154,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../../src/main.cpp" line="182"/>
<location filename="../../src/main.cpp" line="191"/>
<source>ukui-search is already running!</source>
<translation></translation>
</message>
@ -129,7 +162,7 @@
<context>
<name>SearchBarHLayout</name>
<message>
<location filename="../../src/input-box.cpp" line="120"/>
<location filename="../../src/input-box.cpp" line="126"/>
<source>Search</source>
<translation></translation>
</message>
@ -137,32 +170,32 @@
<context>
<name>SearchDetailView</name>
<message>
<location filename="../../src/control/search-detail-view.cpp" line="525"/>
<location filename="../../src/control/search-detail-view.cpp" line="545"/>
<source>Path</source>
<translation></translation>
</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>
<translation></translation>
</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>
<translation></translation>
</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>
<translation>: %1</translation>
</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>
<translation></translation>
</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>
<translation></translation>
</message>
@ -175,115 +208,115 @@
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="69"/>
<location filename="../../src/settings-widget.cpp" line="286"/>
<location filename="../../src/settings-widget.cpp" line="519"/>
<location filename="../../src/settings-widget.cpp" line="75"/>
<location filename="../../src/settings-widget.cpp" line="292"/>
<location filename="../../src/settings-widget.cpp" line="526"/>
<source>Search</source>
<translation></translation>
</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>
<translation>&lt;h2&gt;&lt;/h2&gt;</translation>
</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>
<translation>&lt;h3&gt;&lt;/h3&gt;</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="105"/>
<location filename="../../src/settings-widget.cpp" line="107"/>
<location filename="../../src/settings-widget.cpp" line="111"/>
<location filename="../../src/settings-widget.cpp" line="113"/>
<source>...</source>
<translation></translation>
</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>
<translation>&lt;h3&gt;&lt;/h3&gt;</translation>
</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>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="126"/>
<location filename="../../src/settings-widget.cpp" line="132"/>
<source>Add ignored folders</source>
<translation></translation>
</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>
<translation>&lt;h3&gt;&lt;/h3&gt;</translation>
</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>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="162"/>
<location filename="../../src/settings-widget.cpp" line="168"/>
<source>baidu</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="164"/>
<location filename="../../src/settings-widget.cpp" line="170"/>
<source>sougou</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="166"/>
<location filename="../../src/settings-widget.cpp" line="172"/>
<source>360</source>
<translation>360</translation>
</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>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="287"/>
<location filename="../../src/settings-widget.cpp" line="293"/>
<source>Yes</source>
<translation>(Y)</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="288"/>
<location filename="../../src/settings-widget.cpp" line="294"/>
<source>No</source>
<translation>(N)</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="408"/>
<location filename="../../src/settings-widget.cpp" line="415"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="503"/>
<location filename="../../src/settings-widget.cpp" line="510"/>
<source>Choosen path is Empty!</source>
<translation></translation>
</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>
<translation></translation>
</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>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="515"/>
<location filename="../../src/settings-widget.cpp" line="522"/>
<source>Set blocked folder failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="520"/>
<location filename="../../src/settings-widget.cpp" line="527"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="347"/>
<location filename="../../src/settings-widget.cpp" line="353"/>
<source>Creating ...</source>
<translation></translation>
</message>
@ -292,42 +325,42 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="350"/>
<location filename="../../src/settings-widget.cpp" line="356"/>
<source>Done</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="358"/>
<location filename="../../src/settings-widget.cpp" line="364"/>
<source>Index Entry: %1</source>
<translation>: %1</translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="402"/>
<location filename="../../src/settings-widget.cpp" line="409"/>
<source>Directories</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="403"/>
<location filename="../../src/settings-widget.cpp" line="410"/>
<source>select blocked folder</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="404"/>
<location filename="../../src/settings-widget.cpp" line="411"/>
<source>Select</source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="405"/>
<location filename="../../src/settings-widget.cpp" line="412"/>
<source>Position: </source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="406"/>
<location filename="../../src/settings-widget.cpp" line="413"/>
<source>FileName: </source>
<translation></translation>
</message>
<message>
<location filename="../../src/settings-widget.cpp" line="407"/>
<location filename="../../src/settings-widget.cpp" line="414"/>
<source>FileType: </source>
<translation></translation>
</message>