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_completer->setModel(m_model);
|
||||
m_completer->setCompletionMode(QCompleter::InlineCompletion);
|
||||
m_completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
m_completer->setMaxVisibleItems(14);
|
||||
|
||||
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!!";
|
||||
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;
|
||||
while(!QDir(QDir::homePath()).exists())
|
||||
{
|
||||
qWarning()<<"Home not exits!!";
|
||||
printf("Home not exits!!");
|
||||
qWarning()<<"Home is not exits!!";
|
||||
printf("Home is not exits!!");
|
||||
syslog(LOG_ERR,"Home is not exits!!\n");
|
||||
::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);
|
||||
|
||||
qDebug() << "ukui-search main start";
|
||||
qRegisterMetaType<QPair<QString,QStringList>>("QPair<QString,QStringList>");
|
||||
qRegisterMetaType<Document>("Document");
|
||||
|
||||
|
@ -191,6 +180,21 @@ int main(int argc, char *argv[])
|
|||
|
||||
//here need to be modified
|
||||
/*-------------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;
|
||||
usQDBus.setInotifyMaxUserWatches();
|
||||
|
||||
|
@ -270,7 +274,6 @@ int main(int argc, char *argv[])
|
|||
// qDebug() << "main start";
|
||||
// FirstIndex* fi = new FirstIndex("/home");
|
||||
// fi->start();
|
||||
qDebug() << "main start";
|
||||
AppMatch::getAppMatch()->start();
|
||||
//wtf???
|
||||
// AppMatch apm;
|
||||
|
|
|
@ -54,6 +54,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
{
|
||||
|
||||
m_searcher = new SearchManager();
|
||||
m_settingsMatch = new SettingsMatch(this);
|
||||
// FileUtils::findMultiToneWords("仇仇仇仇仇仇仇仇仇仇仇翟康宁test");
|
||||
/*-------------Inotify Test Start---------------*/
|
||||
// QTime t1 = QTime::currentTime();
|
||||
|
@ -329,9 +330,8 @@ void MainWindow::searchContent(QString keyword){
|
|||
m_contentFrame->setKeyword(keyword);
|
||||
|
||||
//设置搜索
|
||||
SettingsMatch * settingMatchor = new SettingsMatch(this);
|
||||
QStringList settingList;
|
||||
settingList = settingMatchor->startMatchApp(keyword);
|
||||
settingList = m_settingsMatch->startMatchApp(keyword);
|
||||
m_contentFrame->resetSearchList();
|
||||
m_contentFrame->setSettingList(settingList);
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ private:
|
|||
SearchAppThread * m_seach_app_thread = nullptr;
|
||||
|
||||
SearchManager* m_searcher = nullptr;
|
||||
SettingsMatch *m_settingsMatch = nullptr;
|
||||
QSystemTrayIcon *m_sys_tray_icon;
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue