forked from openkylin/ukui-search
Merge branch '0330-dev' into 'main'
Optimized code. See merge request kylin-desktop/ukui-search!3
This commit is contained in:
commit
3e2f3f9c38
|
@ -217,7 +217,7 @@ SearchLineEdit::SearchLineEdit()
|
||||||
m_model->setStringList(GlobalSettings::getInstance()->getSearchRecord());
|
m_model->setStringList(GlobalSettings::getInstance()->getSearchRecord());
|
||||||
m_completer->setModel(m_model);
|
m_completer->setModel(m_model);
|
||||||
m_completer->setCompletionMode(QCompleter::InlineCompletion);
|
m_completer->setCompletionMode(QCompleter::InlineCompletion);
|
||||||
m_completer->setCaseSensitivity(Qt::CaseInsensitive);
|
m_completer->setMaxVisibleItems(14);
|
||||||
|
|
||||||
setCompleter(m_completer);
|
setCompleter(m_completer);
|
||||||
|
|
||||||
|
|
39
src/main.cpp
39
src/main.cpp
|
@ -135,32 +135,21 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
qWarning()<<"I can't find home! I'm done here!!";
|
qWarning()<<"I can't find home! I'm done here!!";
|
||||||
printf("I can't find home! I'm done here!!");
|
printf("I can't find home! I'm done here!!");
|
||||||
|
syslog(LOG_ERR,"I can't find home! I'm done here!!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p_home = NULL;
|
p_home = NULL;
|
||||||
while(!QDir(QDir::homePath()).exists())
|
while(!QDir(QDir::homePath()).exists())
|
||||||
{
|
{
|
||||||
qWarning()<<"Home not exits!!";
|
qWarning()<<"Home is not exits!!";
|
||||||
printf("Home not exits!!");
|
printf("Home is not exits!!");
|
||||||
|
syslog(LOG_ERR,"Home is not exits!!\n");
|
||||||
::sleep(1);
|
::sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
perror("creat fifo error\n");
|
|
||||||
assert(false);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
printf("create fifo success\n");
|
|
||||||
|
|
||||||
|
|
||||||
qInstallMessageHandler(messageOutput);
|
qInstallMessageHandler(messageOutput);
|
||||||
|
|
||||||
|
qDebug() << "ukui-search main start";
|
||||||
qRegisterMetaType<QPair<QString,QStringList>>("QPair<QString,QStringList>");
|
qRegisterMetaType<QPair<QString,QStringList>>("QPair<QString,QStringList>");
|
||||||
qRegisterMetaType<Document>("Document");
|
qRegisterMetaType<Document>("Document");
|
||||||
|
|
||||||
|
@ -191,6 +180,21 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
//here need to be modified
|
//here need to be modified
|
||||||
/*-------------ukuisearchdbus Test start-----------------*/
|
/*-------------ukuisearchdbus Test start-----------------*/
|
||||||
|
|
||||||
|
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 -1;
|
||||||
|
}
|
||||||
|
qDebug()<<"create fifo success\n";
|
||||||
UkuiSearchQDBus usQDBus;
|
UkuiSearchQDBus usQDBus;
|
||||||
usQDBus.setInotifyMaxUserWatches();
|
usQDBus.setInotifyMaxUserWatches();
|
||||||
|
|
||||||
|
@ -270,7 +274,6 @@ int main(int argc, char *argv[])
|
||||||
// qDebug() << "main start";
|
// qDebug() << "main start";
|
||||||
// FirstIndex* fi = new FirstIndex("/home");
|
// FirstIndex* fi = new FirstIndex("/home");
|
||||||
// fi->start();
|
// fi->start();
|
||||||
qDebug() << "main start";
|
|
||||||
AppMatch::getAppMatch()->start();
|
AppMatch::getAppMatch()->start();
|
||||||
//wtf???
|
//wtf???
|
||||||
// AppMatch apm;
|
// AppMatch apm;
|
||||||
|
|
|
@ -54,6 +54,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
{
|
{
|
||||||
|
|
||||||
m_searcher = new SearchManager();
|
m_searcher = new SearchManager();
|
||||||
|
m_settingsMatch = new SettingsMatch(this);
|
||||||
// FileUtils::findMultiToneWords("仇仇仇仇仇仇仇仇仇仇仇翟康宁test");
|
// FileUtils::findMultiToneWords("仇仇仇仇仇仇仇仇仇仇仇翟康宁test");
|
||||||
/*-------------Inotify Test Start---------------*/
|
/*-------------Inotify Test Start---------------*/
|
||||||
// QTime t1 = QTime::currentTime();
|
// QTime t1 = QTime::currentTime();
|
||||||
|
@ -329,9 +330,8 @@ void MainWindow::searchContent(QString keyword){
|
||||||
m_contentFrame->setKeyword(keyword);
|
m_contentFrame->setKeyword(keyword);
|
||||||
|
|
||||||
//设置搜索
|
//设置搜索
|
||||||
SettingsMatch * settingMatchor = new SettingsMatch(this);
|
|
||||||
QStringList settingList;
|
QStringList settingList;
|
||||||
settingList = settingMatchor->startMatchApp(keyword);
|
settingList = m_settingsMatch->startMatchApp(keyword);
|
||||||
m_contentFrame->resetSearchList();
|
m_contentFrame->resetSearchList();
|
||||||
m_contentFrame->setSettingList(settingList);
|
m_contentFrame->setSettingList(settingList);
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ private:
|
||||||
SearchAppThread * m_seach_app_thread = nullptr;
|
SearchAppThread * m_seach_app_thread = nullptr;
|
||||||
|
|
||||||
SearchManager* m_searcher = nullptr;
|
SearchManager* m_searcher = nullptr;
|
||||||
|
SettingsMatch *m_settingsMatch = nullptr;
|
||||||
QSystemTrayIcon *m_sys_tray_icon;
|
QSystemTrayIcon *m_sys_tray_icon;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue