diff --git a/.gitignore b/.gitignore index fab7372..20e2d0e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ *.so.* *_pch.h.cpp *_resource.rc -*.qm +#*.qm .#* *.*# core diff --git a/debian/control b/debian/control index 411e22f..de27efd 100644 --- a/debian/control +++ b/debian/control @@ -11,9 +11,8 @@ Build-Depends: debhelper (>=9.0.0), qtscript5-dev, qttools5-dev-tools, libxapian-dev, - libquazip5-dev(>=0.7.6-6build1), + libquazip5-dev, libglib2.0-dev, - libkf5windowsystem-dev, libgsettings-qt-dev, libqt5x11extras5-dev, libuchardet-dev, diff --git a/debian/ukui-search.install b/debian/ukui-search.install index db54699..d0ffb18 100644 --- a/debian/ukui-search.install +++ b/debian/ukui-search.install @@ -1,4 +1,3 @@ usr/bin/ukui-search etc/xdg/autostart/*.desktop usr/share/applications/*.desktop -src/.qm/*.qm usr/share/ukui-search/translations diff --git a/libchinese-segmentation/chinese-segmentation.h b/libchinese-segmentation/chinese-segmentation.h index db054c4..e1f9d96 100644 --- a/libchinese-segmentation/chinese-segmentation.h +++ b/libchinese-segmentation/chinese-segmentation.h @@ -39,7 +39,7 @@ struct SKeyWord{ ~SKeyWord(){ word = std::move(""); offsets.clear(); - offsets.shrink_to_fit(); +// offsets.shrink_to_fit(); } }; diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 34b7176..136ad9d 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -55,9 +55,10 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) qWarning()<<"Kylinssoclient Dbus connect fail!"; this->forceSync(); + m_cache.insert(FONT_SIZE_KEY, 11); //the default number of transparency in mainwindow is 0.7 //if someone changes the num in mainwindow, here should be modified too - m_cache.insert(TRANSPARENCY_KEY, 0.7); + m_cache.insert(TRANSPARENCY_KEY, 1); if (QGSettings::isSchemaInstalled(CONTROL_CENTER_PERSONALISE_GSETTINGS_ID)) { m_trans_gsettings = new QGSettings(CONTROL_CENTER_PERSONALISE_GSETTINGS_ID, QByteArray(), this); connect(m_trans_gsettings, &QGSettings::changed, this, [=](const QString& key) { diff --git a/libsearch/index/first-index.h b/libsearch/index/first-index.h index 2d90ba9..8a0a4f8 100644 --- a/libsearch/index/first-index.h +++ b/libsearch/index/first-index.h @@ -33,6 +33,7 @@ #include #include #include +#include "assert.h" #include //#include #include "traverse_bfs.h" diff --git a/src/control/highlight-item-delegate.cpp b/src/control/highlight-item-delegate.cpp index 334a8bc..57a971e 100644 --- a/src/control/highlight-item-delegate.cpp +++ b/src/control/highlight-item-delegate.cpp @@ -56,7 +56,8 @@ void HighlightItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem ctx.palette.setColor(QPalette::Text, optionV4.palette.color(QPalette::Active, QPalette::HighlightedText)); QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &optionV4); - textRect.adjust(-20, -5, 0, 0); +// textRect.adjust(-20, -5, 0, 0); + textRect.adjust(0, -5, 0, 0); painter->save(); painter->translate(textRect.topLeft()); painter->setClipRect(textRect.translated(-textRect.topLeft())); diff --git a/src/control/search-list-view.cpp b/src/control/search-list-view.cpp index a4ddca6..f4e18c1 100644 --- a/src/control/search-list-view.cpp +++ b/src/control/search-list-view.cpp @@ -37,16 +37,16 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const m_model->setItem(m_item); this->setModel(m_model); this->setHeaderHidden(true); - this->setColumnWidth(0, 20); - this->setColumnWidth(1, 80); +// this->setColumnWidth(0, 20); +// this->setColumnWidth(1, 80); rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())) + 1; this->setFixedHeight(list.count() * rowheight + 4); this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAutoFillBackground(false); - this->setStyleSheet("QWidget{background:transparent;}"); - m_styleDelegate = new HighlightItemDelegate(this); +// this->setStyleSheet("QWidget{background:transparent;}"); +// m_styleDelegate = new HighlightItemDelegate(this); // m_styleDelegate->setSearchKeyword(keyword); - this->setItemDelegate(m_styleDelegate); +// this->setItemDelegate(m_styleDelegate); m_type = type; connect(this->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ](const QItemSelection &selected, const QItemSelection &deselected) { @@ -99,6 +99,8 @@ void SearchListView::setList(QStringList list) this->blockSignals(false); } rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())); + qDebug()<<"setList rowheight"<< rowheight; + qDebug()<<"setList indexRowSizeHint"<setFixedHeight(m_item->getCurrentSize() * rowheight + 4); } @@ -135,7 +137,7 @@ void SearchListView::clear() */ void SearchListView::setKeyword(QString keyword) { - m_styleDelegate->setSearchKeyword(keyword); +// m_styleDelegate->setSearchKeyword(keyword); } /** diff --git a/src/main.cpp b/src/main.cpp index eb76c89..f2a4344 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -229,7 +229,8 @@ int main(int argc, char *argv[]) // Load translations QTranslator translator; try { - if (! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw -1; +// if (! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw -1; + if (! translator.load(":/res/translations/zh_CN.qm" + QLocale::system().name())) throw -1; app.installTranslator(&translator); } catch (...) { qDebug() << "Load translations file" << QLocale() << "failed!"; @@ -263,7 +264,7 @@ int main(int argc, char *argv[]) if (QString::compare(QString("-s"), QString(QLatin1String(argv[1]))) == 0) { // w->moveToPanel(); centerToScreen(w); - XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints); w->show(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 227c691..8d5ac33 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -29,9 +29,9 @@ #include #include #include -#include +//#include #include -#include "kwindowsystem.h" +//#include "kwindowsystem.h" #include "qt-single-application.h" //#include "inotify-manager.h" @@ -67,10 +67,10 @@ MainWindow::MainWindow(QWidget *parent) : initUi(); // setProperty("useStyleWindowManager", false); //禁止拖动 - m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; - m_hints.functions = MWM_FUNC_ALL; - m_hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; +// m_hints.functions = MWM_FUNC_ALL; +// m_hints.decorations = MWM_DECOR_BORDER; +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); QPainterPath path; auto rect = this->rect(); @@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent) : // path.addRoundedRect(rect, 0, 0); path.addRect(rect); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); +// KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); const QByteArray id("org.ukui.control-center.personalise"); if (QGSettings::isSchemaInstalled(id)) { @@ -130,7 +130,7 @@ MainWindow::MainWindow(QWidget *parent) : clearSearchResult(); // this->moveToPanel(); centerToScreen(this); - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入 this->raise(); @@ -272,7 +272,7 @@ void MainWindow::bootOptionsFilter(QString opt) clearSearchResult(); // this->moveToPanel(); centerToScreen(this); - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); this->m_searchLayout->focusIn(); this->raise(); @@ -438,10 +438,12 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r switch (event->response_type & ~0x80) { case XCB_FOCUS_OUT: - this->hide(); - m_contentFrame->closeWebView(); - m_search_result_thread->requestInterruption(); - m_search_result_thread->quit(); + //iaom begian +// this->hide(); +// m_contentFrame->closeWebView(); +// m_search_result_thread->requestInterruption(); +// m_search_result_thread->quit(); + //iaom finish // m_seach_app_thread->stop(); break; default: diff --git a/src/mainwindow.h b/src/mainwindow.h index be2a3fe..ae1fa71 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -43,6 +43,7 @@ #include #include #include +#include #include "content-widget.h" #include "input-box.h" @@ -50,7 +51,7 @@ #include "settings-widget.h" #include "libsearch.h" #include "search-app-thread.h" -#include "xatom-helper.h" +//#include "xatom-helper.h" class SearchResult; class MainWindow : public QMainWindow @@ -74,7 +75,7 @@ public: // The position which mainwindow shows in the center of screen where the cursor in. void centerToScreen(QWidget* widget); - MotifWmHints m_hints; +// MotifWmHints m_hints; private: diff --git a/src/model/search-item-model.cpp b/src/model/search-item-model.cpp index ecdca91..3a08954 100644 --- a/src/model/search-item-model.cpp +++ b/src/model/search-item-model.cpp @@ -71,7 +71,7 @@ int SearchItemModel::rowCount(const QModelIndex& index) const */ int SearchItemModel::columnCount(const QModelIndex& index) const { - return index.isValid() ? 0 : 2; + return index.isValid() ? 0 : 1; } /** @@ -96,29 +96,31 @@ QVariant SearchItemModel::data(const QModelIndex &index, int role) const { if(!index.isValid()) return QVariant(); - switch (index.column()) { - case Icon: { +// switch (index.column()) { +// case Icon: { switch (role) { case Qt::DecorationRole: { return m_item->getIcon(index.row()); } + case Qt::DisplayRole: { + return QVariant(m_item->getName(index.row())); default: return QVariant(); } } - case Name: { - switch (role) { - case Qt::DisplayRole: { - return QVariant(m_item->getName(index.row())); - } +// case Name: { +// switch (role) { +// case Qt::DisplayRole: { +// return QVariant(m_item->getName(index.row())); +// } // case Qt::ForegroundRole: { // return QColor(50, 50, 50); // } - default: - return QVariant(); - } - } - } +// default: +// return QVariant(); +// } +// } +// } return QVariant(); } diff --git a/src/resource.qrc b/src/resource.qrc index 018ebdd..9d1ba42 100644 --- a/src/resource.qrc +++ b/src/resource.qrc @@ -5,5 +5,6 @@ res/icons/close.svg res/qt-translations/qt_zh_CN.qm res/icons/net-disconnected.svg + res/translations/zh_CN.qm diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index 0581fac..f185f35 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -34,13 +34,13 @@ SettingsWidget::SettingsWidget(QWidget *parent) : QWidget(parent) { this->setWindowIcon(QIcon::fromTheme("kylin-search")); this->setWindowTitle(tr("ukui-search-settings")); -// this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); + this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); // this->setAttribute(Qt::WA_TranslucentBackground); - m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; - m_hints.functions = MWM_FUNC_ALL; - m_hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; +// m_hints.functions = MWM_FUNC_ALL; +// m_hints.decorations = MWM_DECOR_BORDER; +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); initUi(); refreshIndexState(); @@ -375,7 +375,7 @@ void SettingsWidget::showWidget() flags &= ~Qt::WindowStaysOnTopHint; this->setWindowFlags(flags); m_timer->start(); - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); } diff --git a/src/settings-widget.h b/src/settings-widget.h index fdb1c87..0a272ea 100644 --- a/src/settings-widget.h +++ b/src/settings-widget.h @@ -33,7 +33,7 @@ #include #include #include -#include "xatom-helper.h" +//#include "xatom-helper.h" class SettingsWidget : public QWidget { @@ -56,7 +56,7 @@ private: void showWarningDialog(const int&); void resetWebEngine(); - MotifWmHints m_hints; +// MotifWmHints m_hints; //标题栏 QVBoxLayout * m_mainLyt = nullptr; diff --git a/src/src.pro b/src/src.pro index 35eff8a..4030056 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,4 +1,4 @@ -QT += core gui dbus KWindowSystem xml x11extras +QT += core gui dbus xml x11extras greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -32,8 +32,8 @@ SOURCES += \ mainwindow.cpp \ search-app-thread.cpp \ search-result.cpp \ - settings-widget.cpp \ - xatom-helper.cpp + settings-widget.cpp +# xatom-helper.cpp HEADERS += \ @@ -43,8 +43,8 @@ HEADERS += \ mainwindow.h \ search-app-thread.h \ search-result.h \ - settings-widget.h \ - xatom-helper.h + settings-widget.h +# xatom-helper.h # Default rules for deployment. @@ -78,9 +78,3 @@ DEPENDPATH += $$PWD/../libchinese-segmentation INCLUDEPATH += $$PWD/../libsearch DEPENDPATH += $$PWD/../libsearch - -#DISTFILES += \ -# ../data/ukui-search-menu.desktop \ -# $$OUT_PWD/.qm/bo.qm \ -# $$OUT_PWD/.qm/tr.qm \ -# $$OUT_PWD/.qm/zh_CN.qm diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index 9e5b6d5..304ee25 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -4,57 +4,57 @@ ContentWidget - + Recently Opened - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Web Pages - + Unknown @@ -70,12 +70,12 @@ MainWindow - + ukui-search - + Global Search @@ -121,7 +121,7 @@ QObject - + ukui-search is already running! @@ -129,7 +129,7 @@ SearchBarHLayout - + Search @@ -137,32 +137,32 @@ SearchDetailView - + Path - + Last time modified - + Application - + Introduction: %1 - + Document - + Preview is not avaliable @@ -170,55 +170,55 @@ SettingsWidget - - - + + + Search - - + + ... - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + Please select search engine you preferred. - + baidu - + sougou - + 360 - + Cancel - + Creating ... @@ -228,102 +228,102 @@ - + <h2>Settings</h2> - + <h3>Index State</h3> - + <h3>File Index Settings</h3> - + <h3>Search Engine Settings</h3> - + Whether to delete this directory? - + Yes - + No - + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: - + Choosen path is Empty! - + Choosen path is not in "home"! - + Its' parent folder has been blocked! - + Set blocked folder failed! - + OK diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 6f1933a..ab1d08a 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -4,57 +4,57 @@ ContentWidget - + Recently Opened Yeni Açılan - + Open Quickly Hızlı Aç - + Commonly Used Genel olarak kullanılan - + Apps Uygulamalar - + Settings Ayarlar - + Files Dosyalar - + Dirs Dizinler - + File Contents Dosya İçeriği - + Best Matches En İyi Eşleşen - + Web Pages - + Unknown Bilinmeyen @@ -70,12 +70,12 @@ MainWindow - + ukui-search ukui-ara - + Global Search Genel Arama @@ -121,7 +121,7 @@ QObject - + ukui-search is already running! ukui-bul zaten çalışıyor! @@ -129,7 +129,7 @@ SearchBarHLayout - + Search Ara @@ -137,32 +137,32 @@ SearchDetailView - + Path Yol - + Last time modified Son değiştirilme zamanı - + Application Uygulama - + Introduction: %1 - + Document Belge - + Preview is not avaliable @@ -170,55 +170,55 @@ SettingsWidget - - - + + + Search Ara - - + + ... ... - + Following folders will not be searched. You can set it by adding and removing folders. Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz. - + Add ignored folders Göz ardı edilen klasörleri ekleyin - + Please select search engine you preferred. Lütfen tercih ettiğiniz arama motorunu seçin. - + baidu - + sougou - + 360 - + Cancel İptal - + Creating ... Oluşturuluyor... @@ -232,102 +232,102 @@ - + <h2>Settings</h2> <h2>Ayarlar</h2> - + <h3>Index State</h3> <h3>Dizin Durumu</h3> - + <h3>File Index Settings</h3> <h3>Dosya Dizini Ayarları</h3> - + <h3>Search Engine Settings</h3> <h3>SArama Motoru Ayarları</h3> - + Whether to delete this directory? Bu dizini silinsin mi? - + Yes - + No - + Done Tamam - + Index Entry: %1 Dizin Girişi: %1 - + Directories Dizinler - + select blocked folder engellenen klasörü seç - + Select Seç - + Position: Pozisyon: - + FileName: Dosya Adı: - + FileType: Dosya Türü: - + Choosen path is Empty! - + Choosen path is not in "home"! - + Its' parent folder has been blocked! - + Set blocked folder failed! - + OK diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 983c03b..f9d53c5 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -4,57 +4,57 @@ ContentWidget - + Recently Opened 最近 - + Open Quickly 快速入口 - + Commonly Used 常用 - + Apps 应用 - + Settings 配置项 - + Files 文件 - + Dirs 文件夹 - + File Contents 文件内容 - + Best Matches 最佳匹配 - + Web Pages 网页 - + Unknown 未知 @@ -70,12 +70,12 @@ MainWindow - + ukui-search 搜索 - + Global Search 搜索 @@ -121,7 +121,7 @@ QObject - + ukui-search is already running! @@ -129,7 +129,7 @@ SearchBarHLayout - + Search 搜索 @@ -137,32 +137,32 @@ SearchDetailView - + Path 路径 - + Last time modified 上次修改时间 - + Application 应用 - + Introduction: %1 软件介绍: %1 - + Document 文件 - + Preview is not avaliable 当前预览不可用 @@ -175,115 +175,115 @@ 搜索 - - - + + + Search 搜索 - + <h2>Settings</h2> <h2>设置</h2> - + <h3>Index State</h3> <h3>索引状态</h3> - - + + ... - + <h3>File Index Settings</h3> <h3>文件索引设置</h3> - + Following folders will not be searched. You can set it by adding and removing folders. 搜索将不再查看以下文件夹。通过增加和删除文件夹可进行文件索引设置。 - + Add ignored folders 添加文件夹至黑名单 - + <h3>Search Engine Settings</h3> <h3>搜索引擎设置</h3> - + Please select search engine you preferred. 设置互联网搜索引擎 - + baidu 百度 - + sougou 搜狗 - + 360 360 - + Whether to delete this directory? 是否要删除此目录 - + Yes 是(Y) - + No 否(N) - + Cancel 取消 - + Choosen path is Empty! 选择的路径不存在! - + Choosen path is not in "home"! 请选择家目录下的文件夹! - + Its' parent folder has been blocked! 父文件夹已被屏蔽! - + Set blocked folder failed! - + OK 好的 - + Creating ... 正在索引 @@ -292,42 +292,42 @@ 搜索 - + Done 索引完成 - + Index Entry: %1 索引项: %1 - + Directories 文件夹 - + select blocked folder 选择屏蔽文件夹 - + Select 选择 - + Position: 位置: - + FileName: 名称: - + FileType: 类型: