2020-12-22 10:14:58 +08:00
|
|
|
|
/*
|
|
|
|
|
*
|
2021-01-29 11:43:07 +08:00
|
|
|
|
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2020-12-22 10:14:58 +08:00
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2021-01-29 11:43:07 +08:00
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
2020-12-22 10:14:58 +08:00
|
|
|
|
*
|
|
|
|
|
* 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
|
2021-01-29 11:43:07 +08:00
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*
|
|
|
|
|
* Authors: zhangjiaping <zhangjiaping@kylinos.cn>
|
|
|
|
|
* Modified by: zhangpengfei <zhangpengfei@kylinos.cn>
|
|
|
|
|
* Modified by: zhangzihao <zhangzihao@kylinos.cn>
|
2020-12-22 10:14:58 +08:00
|
|
|
|
*
|
|
|
|
|
*/
|
2020-12-21 16:26:59 +08:00
|
|
|
|
|
2020-12-30 14:42:04 +08:00
|
|
|
|
#include "mainwindow.h"
|
2020-12-22 10:14:58 +08:00
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
#include <QScreen>
|
|
|
|
|
#include <QTranslator>
|
|
|
|
|
#include <QLocale>
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
#include <syslog.h>
|
2021-05-12 16:27:24 +08:00
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
2021-04-19 20:48:41 +08:00
|
|
|
|
#include <ukui-log4qt.h>
|
2021-05-12 16:27:24 +08:00
|
|
|
|
#endif
|
2020-12-22 10:14:58 +08:00
|
|
|
|
#include <QObject>
|
2021-05-12 15:58:38 +08:00
|
|
|
|
#include <QApplication>
|
2020-12-22 10:14:58 +08:00
|
|
|
|
#include "qt-single-application.h"
|
|
|
|
|
#include "qt-local-peer.h"
|
2020-12-26 08:56:38 +08:00
|
|
|
|
//#include "inotify-manager.h"
|
2020-12-30 15:31:36 +08:00
|
|
|
|
#include "libsearch.h"
|
2021-01-04 14:21:45 +08:00
|
|
|
|
#include "global-settings.h"
|
2021-08-11 13:57:54 +08:00
|
|
|
|
#include "ukui-search-dbus-service.h"
|
2020-12-22 10:14:58 +08:00
|
|
|
|
|
2021-04-30 16:28:50 +08:00
|
|
|
|
using namespace Zeeker;
|
2021-02-21 11:41:20 +08:00
|
|
|
|
//void handler(int){
|
|
|
|
|
// qDebug() << "Recieved SIGTERM!";
|
2021-01-23 11:32:18 +08:00
|
|
|
|
|
2021-02-21 11:41:20 +08:00
|
|
|
|
// GlobalSettings::getInstance()->setValue(INDEX_DATABASE_STATE, "2");
|
|
|
|
|
// GlobalSettings::getInstance()->setValue(CONTENT_INDEX_DATABASE_STATE, "2");
|
|
|
|
|
// GlobalSettings::getInstance()->setValue(INDEX_GENERATOR_NORMAL_EXIT, "2");
|
|
|
|
|
// GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "2");
|
|
|
|
|
// GlobalSettings::getInstance()->forceSync(INDEX_DATABASE_STATE);
|
|
|
|
|
// GlobalSettings::getInstance()->forceSync(CONTENT_INDEX_DATABASE_STATE);
|
|
|
|
|
// GlobalSettings::getInstance()->forceSync(INDEX_GENERATOR_NORMAL_EXIT);
|
|
|
|
|
// GlobalSettings::getInstance()->forceSync(INOTIFY_NORMAL_EXIT);
|
2021-01-22 17:15:43 +08:00
|
|
|
|
|
2021-02-21 11:41:20 +08:00
|
|
|
|
// qDebug() << "indexDataBaseStatus: " << GlobalSettings::getInstance()->getValue(INDEX_DATABASE_STATE).toString();
|
|
|
|
|
// qDebug() << "contentIndexDataBaseStatus: " << GlobalSettings::getInstance()->getValue(CONTENT_INDEX_DATABASE_STATE).toString();
|
2021-01-23 11:32:18 +08:00
|
|
|
|
|
2021-02-21 11:41:20 +08:00
|
|
|
|
// ::exit(0);
|
2021-01-22 17:15:43 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// InotifyIndex::getInstance("/home")->~InotifyIndex();
|
2021-01-22 17:15:43 +08:00
|
|
|
|
|
2021-02-21 11:41:20 +08:00
|
|
|
|
// //wait linux kill this thread forcedly
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// while (true);
|
2021-02-21 11:41:20 +08:00
|
|
|
|
//}
|
2021-01-22 17:15:43 +08:00
|
|
|
|
|
|
|
|
|
|
2021-05-08 17:43:54 +08:00
|
|
|
|
void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
|
|
|
|
{
|
|
|
|
|
QByteArray localMsg = msg.toLocal8Bit();
|
|
|
|
|
QByteArray currentTime = QTime::currentTime().toString().toLocal8Bit();
|
|
|
|
|
|
|
|
|
|
bool showDebug = true;
|
|
|
|
|
// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/ukui-search.log";
|
|
|
|
|
// QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/org.ukui/ukui-search/ukui-search.log";
|
|
|
|
|
QString logFilePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + "/.config/org.ukui/ukui-search.log";
|
|
|
|
|
if (!QFile::exists(logFilePath)) {
|
|
|
|
|
showDebug = false;
|
|
|
|
|
}
|
|
|
|
|
FILE *log_file = nullptr;
|
|
|
|
|
|
|
|
|
|
if (showDebug) {
|
|
|
|
|
log_file = fopen(logFilePath.toLocal8Bit().constData(), "a+");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *file = context.file ? context.file : "";
|
|
|
|
|
const char *function = context.function ? context.function : "";
|
|
|
|
|
switch (type) {
|
|
|
|
|
case QtDebugMsg:
|
|
|
|
|
if (!log_file) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
fprintf(log_file, "Debug: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function);
|
|
|
|
|
break;
|
|
|
|
|
case QtInfoMsg:
|
|
|
|
|
fprintf(log_file? log_file: stdout, "Info: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function);
|
|
|
|
|
break;
|
|
|
|
|
case QtWarningMsg:
|
|
|
|
|
fprintf(log_file? log_file: stderr, "Warning: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function);
|
|
|
|
|
break;
|
|
|
|
|
case QtCriticalMsg:
|
|
|
|
|
fprintf(log_file? log_file: stderr, "Critical: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function);
|
|
|
|
|
break;
|
|
|
|
|
case QtFatalMsg:
|
|
|
|
|
fprintf(log_file? log_file: stderr, "Fatal: %s: %s (%s:%u, %s)\n", currentTime.constData(), localMsg.constData(), file, context.line, function);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (log_file)
|
|
|
|
|
fclose(log_file);
|
|
|
|
|
}
|
2020-12-31 21:14:13 +08:00
|
|
|
|
|
2020-12-22 10:14:58 +08:00
|
|
|
|
void centerToScreen(QWidget* widget) {
|
2021-04-26 15:06:47 +08:00
|
|
|
|
if(!widget)
|
|
|
|
|
return;
|
2020-12-22 10:14:58 +08:00
|
|
|
|
QDesktopWidget* m = QApplication::desktop();
|
|
|
|
|
QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos()));
|
|
|
|
|
int desk_x = desk_rect.width();
|
|
|
|
|
int desk_y = desk_rect.height();
|
|
|
|
|
int x = widget->width();
|
|
|
|
|
int y = widget->height();
|
2021-01-11 20:49:42 +08:00
|
|
|
|
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
|
2020-12-22 10:14:58 +08:00
|
|
|
|
}
|
2021-04-20 16:24:07 +08:00
|
|
|
|
/*
|
2021-04-16 16:09:50 +08:00
|
|
|
|
void searchMethod(FileUtils::SearchMethod sm){
|
2021-04-20 16:24:07 +08:00
|
|
|
|
qWarning() << "searchMethod start: " << static_cast<int>(sm);
|
|
|
|
|
if (FileUtils::SearchMethod::INDEXSEARCH == sm || FileUtils::SearchMethod::DIRECTSEARCH == sm) {
|
2021-04-16 16:09:50 +08:00
|
|
|
|
FileUtils::searchMethod = sm;
|
|
|
|
|
} else {
|
|
|
|
|
printf("enum class error!!!\n");
|
|
|
|
|
qWarning("enum class error!!!\n");
|
|
|
|
|
}
|
2021-04-20 16:24:07 +08:00
|
|
|
|
if (FileUtils::SearchMethod::INDEXSEARCH == sm && 0 == FileUtils::_index_status) {
|
|
|
|
|
qWarning() << "start first index";
|
2021-04-16 16:09:50 +08:00
|
|
|
|
FirstIndex fi("/home/zhangzihao/Desktop");
|
|
|
|
|
fi.start();
|
2021-04-20 16:24:07 +08:00
|
|
|
|
qWarning() << "start inotify index";
|
|
|
|
|
// InotifyIndex ii("/home");
|
|
|
|
|
// ii.start();
|
2021-04-16 16:09:50 +08:00
|
|
|
|
InotifyIndex* ii = InotifyIndex::getInstance("/home");
|
2021-04-20 16:24:07 +08:00
|
|
|
|
if (!ii->isRunning()) {
|
|
|
|
|
ii->start();
|
|
|
|
|
}
|
|
|
|
|
qDebug()<<"Search method has been set to INDEXSEARCH";
|
2021-04-16 16:09:50 +08:00
|
|
|
|
}
|
2021-04-20 16:24:07 +08:00
|
|
|
|
qWarning() << "searchMethod end: " << static_cast<int>(FileUtils::searchMethod);
|
2021-04-16 16:09:50 +08:00
|
|
|
|
}
|
2021-04-20 16:24:07 +08:00
|
|
|
|
*/
|
2021-04-26 15:06:47 +08:00
|
|
|
|
int main(int argc, char *argv[]) {
|
2021-05-12 16:27:24 +08:00
|
|
|
|
//v101日志模块
|
|
|
|
|
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
|
|
|
|
// //Init log module
|
2021-05-08 17:43:54 +08:00
|
|
|
|
// initUkuiLog4qt("ukui-search");
|
2021-05-12 16:27:24 +08:00
|
|
|
|
//#endif
|
2021-04-19 20:48:41 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Determine whether the home directory has been created, and if not, keep waiting.
|
2021-03-06 16:41:16 +08:00
|
|
|
|
char *p_home = NULL;
|
|
|
|
|
|
|
|
|
|
unsigned int i = 0;
|
2021-04-26 15:06:47 +08:00
|
|
|
|
while(p_home == NULL) {
|
2021-03-06 16:41:16 +08:00
|
|
|
|
::sleep(1);
|
|
|
|
|
++i;
|
|
|
|
|
p_home = getenv("HOME");
|
2021-04-26 15:06:47 +08:00
|
|
|
|
if(i % 5 == 0) {
|
|
|
|
|
qWarning() << "I can't find home! I'm done here!!";
|
2021-03-06 16:41:16 +08:00
|
|
|
|
printf("I can't find home! I'm done here!!");
|
2021-04-26 15:06:47 +08:00
|
|
|
|
syslog(LOG_ERR, "I can't find home! I'm done here!!\n");
|
2021-03-06 16:41:16 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
p_home = NULL;
|
2021-04-26 15:06:47 +08:00
|
|
|
|
while(!QDir(QDir::homePath()).exists()) {
|
|
|
|
|
qWarning() << "Home is not exits!!";
|
2021-03-30 17:55:08 +08:00
|
|
|
|
printf("Home is not exits!!");
|
2021-04-26 15:06:47 +08:00
|
|
|
|
syslog(LOG_ERR, "Home is not exits!!\n");
|
2021-03-06 16:41:16 +08:00
|
|
|
|
::sleep(1);
|
|
|
|
|
}
|
2021-03-13 17:47:53 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Output log to file
|
2021-05-08 17:43:54 +08:00
|
|
|
|
qInstallMessageHandler(messageOutput);
|
2021-05-12 16:27:24 +08:00
|
|
|
|
//若使用v101日志模块,可以解放如下判断条件
|
|
|
|
|
//#if (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))
|
|
|
|
|
// // Output log to file
|
|
|
|
|
// qInstallMessageHandler(messageOutput);
|
|
|
|
|
//#endif
|
2021-03-30 17:55:08 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Register meta type
|
2021-03-30 17:55:08 +08:00
|
|
|
|
qDebug() << "ukui-search main start";
|
2021-04-26 15:06:47 +08:00
|
|
|
|
qRegisterMetaType<QPair<QString, QStringList>>("QPair<QString,QStringList>");
|
2021-01-19 10:44:28 +08:00
|
|
|
|
qRegisterMetaType<Document>("Document");
|
2021-03-11 11:09:47 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// If qt version bigger than 5.12, enable high dpi scaling and use high dpi pixmaps?
|
2021-03-11 11:09:47 +08:00
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
2021-04-26 15:06:47 +08:00
|
|
|
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
|
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
2021-03-11 11:09:47 +08:00
|
|
|
|
#endif
|
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
2021-04-26 15:06:47 +08:00
|
|
|
|
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
2021-03-11 11:09:47 +08:00
|
|
|
|
#endif
|
2021-01-10 15:59:17 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Make sure only one ukui-search is running.
|
2021-01-10 15:59:17 +08:00
|
|
|
|
QtSingleApplication app("ukui-search", argc, argv);
|
|
|
|
|
app.setQuitOnLastWindowClosed(false);
|
|
|
|
|
|
2021-04-26 15:06:47 +08:00
|
|
|
|
if(app.isRunning()) {
|
2021-01-10 15:59:17 +08:00
|
|
|
|
app.sendMessage(QApplication::arguments().length() > 1 ? QApplication::arguments().at(1) : app.applicationFilePath());
|
|
|
|
|
qDebug() << QObject::tr("ukui-search is already running!");
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
|
}/*else {
|
|
|
|
|
QCommandLineParser parser;
|
|
|
|
|
QCommandLineOption debugOption({"d", "debug"}, QObject::tr("Display debug information"));
|
|
|
|
|
QCommandLineOption showsearch({"s", "show"}, QObject::tr("show search widget"));
|
|
|
|
|
parser.addOptions({debugOption, showsearch});
|
|
|
|
|
parser.process(app);
|
|
|
|
|
}*/
|
2021-04-26 15:06:47 +08:00
|
|
|
|
/*
|
|
|
|
|
// 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 -1;
|
|
|
|
|
}
|
|
|
|
|
qDebug()<<"create fifo success\n";
|
|
|
|
|
*/
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Set max_user_watches to a number which is enough big.
|
2021-01-22 17:15:43 +08:00
|
|
|
|
UkuiSearchQDBus usQDBus;
|
|
|
|
|
usQDBus.setInotifyMaxUserWatches();
|
2021-01-06 14:14:38 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// load chinese character and pinyin file to a Map
|
2020-12-26 12:45:28 +08:00
|
|
|
|
FileUtils::loadHanziTable("://index/pinyinWithoutTone.txt");
|
2020-12-26 21:11:17 +08:00
|
|
|
|
/*-------------InotyifyRefact Test Start---------------*/
|
2021-01-06 11:21:19 +08:00
|
|
|
|
// QTime t1 = QTime::currentTime();
|
|
|
|
|
// InotifyManagerRefact* imr = new InotifyManagerRefact("/home");
|
|
|
|
|
// imr->start();
|
|
|
|
|
// QTime t2 = QTime::currentTime();
|
|
|
|
|
// qDebug() << t1;
|
|
|
|
|
// qDebug() << t2;
|
2020-12-26 21:11:17 +08:00
|
|
|
|
/*-------------InotyifyRefact Test End-----------------*/
|
2020-12-26 12:45:28 +08:00
|
|
|
|
|
2021-01-06 14:14:38 +08:00
|
|
|
|
/*-------------content index Test Start---------------*/
|
2021-01-06 17:42:35 +08:00
|
|
|
|
// QTime t3 = QTime::currentTime();
|
|
|
|
|
// FileTypeFilter* ftf = new FileTypeFilter("/home");
|
|
|
|
|
// ftf->Test();
|
|
|
|
|
// QTime t4 = QTime::currentTime();
|
|
|
|
|
// delete ftf;
|
|
|
|
|
// ftf = nullptr;
|
|
|
|
|
// qDebug() << t3;
|
|
|
|
|
// qDebug() << t4;
|
2021-01-06 14:14:38 +08:00
|
|
|
|
/*-------------content index Test End-----------------*/
|
2020-12-31 21:14:13 +08:00
|
|
|
|
/*-------------文本搜索 Test start-----------------*/
|
2021-01-03 16:01:35 +08:00
|
|
|
|
// FileSearcher *search = new FileSearcher();
|
|
|
|
|
// search->onKeywordSearchContent("重要器官移植⑤白血病");
|
2021-01-03 16:58:26 +08:00
|
|
|
|
// search->onKeywordSearchContent("g,e,x");
|
2020-12-31 21:14:13 +08:00
|
|
|
|
/*-------------文本搜索 Test End-----------------*/
|
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Load translations
|
2020-12-22 10:14:58 +08:00
|
|
|
|
QTranslator translator;
|
|
|
|
|
try {
|
2021-04-26 15:06:47 +08:00
|
|
|
|
if(! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw - 1;
|
2020-12-22 10:14:58 +08:00
|
|
|
|
app.installTranslator(&translator);
|
2021-04-26 15:06:47 +08:00
|
|
|
|
} catch(...) {
|
2020-12-22 10:14:58 +08:00
|
|
|
|
qDebug() << "Load translations file" << QLocale() << "failed!";
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-02 15:15:37 +08:00
|
|
|
|
QTranslator qt_translator;
|
|
|
|
|
try {
|
2021-04-26 15:06:47 +08:00
|
|
|
|
if(! qt_translator.load(":/res/qt-translations/qt_zh_CN.qm")) throw - 1;
|
2021-02-02 15:15:37 +08:00
|
|
|
|
app.installTranslator(&qt_translator);
|
2021-04-26 15:06:47 +08:00
|
|
|
|
} catch(...) {
|
2021-02-02 15:15:37 +08:00
|
|
|
|
qDebug() << "Load translations file" << QLocale() << "failed!";
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
//set main window to the center of screen
|
2020-12-22 10:14:58 +08:00
|
|
|
|
MainWindow *w = new MainWindow;
|
2021-08-11 13:57:54 +08:00
|
|
|
|
UkuiSearchDbusServices dbusService(w);
|
2021-05-12 15:58:38 +08:00
|
|
|
|
qApp->setWindowIcon(QIcon::fromTheme("kylin-search"));
|
2021-01-26 18:43:03 +08:00
|
|
|
|
// centerToScreen(w);
|
2021-03-30 17:04:44 +08:00
|
|
|
|
// w->moveToPanel();
|
|
|
|
|
centerToScreen(w);
|
2021-01-10 15:59:17 +08:00
|
|
|
|
|
2021-04-20 16:24:07 +08:00
|
|
|
|
//请务必在connect之后初始化mainwindow的Gsettings,为了保证gsettings第一次读取到的配置值能成功应用
|
|
|
|
|
w->initGsettings();
|
|
|
|
|
|
2021-01-20 15:33:49 +08:00
|
|
|
|
//使用窗管的无边框策略
|
2021-03-26 11:39:08 +08:00
|
|
|
|
// w->setProperty("useStyleWindowManager", false); //禁用拖动
|
|
|
|
|
// MotifWmHints hints;
|
|
|
|
|
// hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
|
|
|
|
// hints.functions = MWM_FUNC_ALL;
|
|
|
|
|
// hints.decorations = MWM_DECOR_BORDER;
|
|
|
|
|
// XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), hints);
|
2021-01-20 15:33:49 +08:00
|
|
|
|
|
2020-12-22 10:14:58 +08:00
|
|
|
|
app.setActivationWindow(w);
|
2021-01-26 16:22:03 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Processing startup parameters
|
2021-04-26 15:06:47 +08:00
|
|
|
|
if(QString::compare(QString("-s"), QString(QLatin1String(argv[1]))) == 0) {
|
2021-03-30 17:04:44 +08:00
|
|
|
|
// w->moveToPanel();
|
|
|
|
|
centerToScreen(w);
|
2021-05-12 16:27:24 +08:00
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
2021-03-26 11:39:08 +08:00
|
|
|
|
XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints);
|
2021-05-12 16:27:24 +08:00
|
|
|
|
#endif
|
2021-01-26 16:22:03 +08:00
|
|
|
|
w->show();
|
|
|
|
|
}
|
2021-04-06 16:20:29 +08:00
|
|
|
|
|
2021-04-13 15:40:19 +08:00
|
|
|
|
QObject::connect(&app, &QtSingleApplication::messageReceived, w, &MainWindow::bootOptionsFilter);
|
2020-12-22 10:14:58 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// Start app search thread
|
2021-03-05 08:43:02 +08:00
|
|
|
|
AppMatch::getAppMatch()->start();
|
2021-01-19 19:26:39 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// TODO
|
|
|
|
|
// Set threads which in global thread pool expiry time in 5ms, some prolems here
|
2021-06-02 15:17:27 +08:00
|
|
|
|
// QThreadPool::globalInstance()->setExpiryTimeout(5);
|
2021-03-06 16:41:16 +08:00
|
|
|
|
|
2021-04-06 16:20:29 +08:00
|
|
|
|
// TODO
|
|
|
|
|
// First insdex start, the parameter us useless, should remove the parameter
|
2021-04-16 15:35:54 +08:00
|
|
|
|
// FirstIndex fi("/home/zhangzihao/Desktop");
|
|
|
|
|
// fi.start();
|
2021-04-06 16:20:29 +08:00
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
// Inotify index start, the parameter us useless, should remove the parameter
|
2021-04-16 15:35:54 +08:00
|
|
|
|
// InotifyIndex* ii = InotifyIndex::getInstance("/home");
|
|
|
|
|
// ii->start();
|
2020-12-26 08:56:38 +08:00
|
|
|
|
|
2020-12-22 10:14:58 +08:00
|
|
|
|
return app.exec();
|
2020-12-21 16:26:59 +08:00
|
|
|
|
}
|