forked from openkylin/ukui-search
commit
941435ed6b
|
@ -26,11 +26,18 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
HomePageItem::HomePageItem(QWidget *parent, const int& type, const QString& path) : QWidget(parent)
|
HomePageItem::HomePageItem(QWidget *parent, const int& type, const QString& path) : QWidget(parent)
|
||||||
{
|
{
|
||||||
setupUi(type, path);
|
setupUi(type, path);
|
||||||
m_transparency = 0.06;
|
m_transparency = 0.06;
|
||||||
|
connect(qApp, &QApplication::paletteChanged, this, [ = ]() {
|
||||||
|
if (m_namelabel) {
|
||||||
|
QString name = this->toolTip();
|
||||||
|
m_namelabel->setText(m_namelabel->fontMetrics().elidedText(name, Qt::ElideRight, 108));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
HomePageItem::~HomePageItem()
|
HomePageItem::~HomePageItem()
|
||||||
|
@ -74,7 +81,6 @@ void HomePageItem::setupUi(const int& type, const QString& path) {
|
||||||
});
|
});
|
||||||
m_iconlabel = new QLabel(m_widget);
|
m_iconlabel = new QLabel(m_widget);
|
||||||
m_namelabel = new QLabel(m_widget);
|
m_namelabel = new QLabel(m_widget);
|
||||||
m_namelabel->setStyleSheet("QLabel{color: palette(text);}");
|
|
||||||
if (type == ItemType::Recent) {
|
if (type == ItemType::Recent) {
|
||||||
m_widget->setFixedSize(300, 48);
|
m_widget->setFixedSize(300, 48);
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
@ -148,20 +154,20 @@ bool HomePageItem::eventFilter(QObject *watched, QEvent *event){
|
||||||
if (watched == m_widget){
|
if (watched == m_widget){
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
m_transparency = 0.06;
|
m_transparency = 0.06;
|
||||||
this->repaint();
|
this->update();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type() == QEvent::MouseButtonRelease) {
|
} else if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
Q_EMIT this->onItemClicked();
|
Q_EMIT this->onItemClicked();
|
||||||
m_transparency = 0.06;
|
m_transparency = 0.06;
|
||||||
this->repaint();
|
this->update();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type() == QEvent::Enter) {
|
} else if (event->type() == QEvent::Enter) {
|
||||||
m_transparency = 0.15;
|
m_transparency = 0.15;
|
||||||
this->repaint();
|
this->update();
|
||||||
return true;
|
return true;
|
||||||
} else if (event->type() == QEvent::Leave) {
|
} else if (event->type() == QEvent::Leave) {
|
||||||
m_transparency = 0.06;
|
m_transparency = 0.06;
|
||||||
this->repaint();
|
this->update();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,12 +177,10 @@ bool HomePageItem::eventFilter(QObject *watched, QEvent *event){
|
||||||
|
|
||||||
void HomePageItem::paintEvent(QPaintEvent *event) {
|
void HomePageItem::paintEvent(QPaintEvent *event) {
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
|
|
||||||
QStyleOption opt;
|
QStyleOption opt;
|
||||||
opt.init(this);
|
opt.init(this);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
|
||||||
QRect rect = this->rect();
|
QRect rect = this->rect();
|
||||||
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||||
p.setBrush(opt.palette.color(QPalette::Text));
|
p.setBrush(opt.palette.color(QPalette::Text));
|
||||||
|
|
|
@ -90,6 +90,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) {
|
connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) {
|
||||||
this->setPalette(pal);
|
this->setPalette(pal);
|
||||||
this->update();
|
this->update();
|
||||||
|
Q_FOREACH (QWidget *widget, this->findChildren<QWidget *>()) {
|
||||||
|
if (widget) {
|
||||||
|
widget->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_search_result_file = new QQueue<QString>;
|
m_search_result_file = new QQueue<QString>;
|
||||||
|
@ -163,7 +168,6 @@ void MainWindow::initUi()
|
||||||
QVBoxLayout * mainlayout = new QVBoxLayout(m_frame);
|
QVBoxLayout * mainlayout = new QVBoxLayout(m_frame);
|
||||||
mainlayout->setContentsMargins(8, 0, 8, 6);
|
mainlayout->setContentsMargins(8, 0, 8, 6);
|
||||||
m_frame->setLayout(mainlayout);
|
m_frame->setLayout(mainlayout);
|
||||||
m_frame->setStyleSheet("QLabel{color: palette(text);}");
|
|
||||||
|
|
||||||
m_titleFrame = new QFrame(m_frame);//标题栏
|
m_titleFrame = new QFrame(m_frame);//标题栏
|
||||||
m_titleFrame->setFixedHeight(40);
|
m_titleFrame->setFixedHeight(40);
|
||||||
|
@ -190,8 +194,7 @@ void MainWindow::initUi()
|
||||||
m_settingsWidget->show();
|
m_settingsWidget->show();
|
||||||
connect(m_settingsWidget, &SettingsWidget::settingWidgetClosed, this, [ = ]() {
|
connect(m_settingsWidget, &SettingsWidget::settingWidgetClosed, this, [ = ]() {
|
||||||
QTimer::singleShot(100, this, [ = ] {
|
QTimer::singleShot(100, this, [ = ] {
|
||||||
clearSearchResult();
|
// clearSearchResult(); //现暂定从设置页返回主页面不清空搜索结果
|
||||||
// m_search_result_thread->start();
|
|
||||||
this->setWindowState(this->windowState() & ~Qt::WindowMinimized);
|
this->setWindowState(this->windowState() & ~Qt::WindowMinimized);
|
||||||
this->raise();
|
this->raise();
|
||||||
this->showNormal();
|
this->showNormal();
|
||||||
|
@ -329,7 +332,7 @@ void MainWindow::moveToPanel()
|
||||||
"/org/ukui/SettingsDaemon/wayland",
|
"/org/ukui/SettingsDaemon/wayland",
|
||||||
"org.ukui.SettingsDaemon.wayland",
|
"org.ukui.SettingsDaemon.wayland",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
if (primaryScreenInterface.isValid()) {
|
if (QDBusReply<int>(primaryScreenInterface.call("x")).isValid()) {
|
||||||
QDBusReply<int> x = primaryScreenInterface.call("x");
|
QDBusReply<int> x = primaryScreenInterface.call("x");
|
||||||
QDBusReply<int> width = primaryScreenInterface.call("width");
|
QDBusReply<int> width = primaryScreenInterface.call("width");
|
||||||
QDBusReply<int> height = primaryScreenInterface.call("height");
|
QDBusReply<int> height = primaryScreenInterface.call("height");
|
||||||
|
|
|
@ -286,7 +286,7 @@ void SettingsWidget::refreshIndexState()
|
||||||
void SettingsWidget::onBtnDelClicked(const QString& path) {
|
void SettingsWidget::onBtnDelClicked(const QString& path) {
|
||||||
QMessageBox message(QMessageBox::Question, tr("Search"), tr("Whether to delete this directory?"));
|
QMessageBox message(QMessageBox::Question, tr("Search"), tr("Whether to delete this directory?"));
|
||||||
QPushButton * buttonYes = message.addButton(tr("Yes"), QMessageBox::YesRole);
|
QPushButton * buttonYes = message.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||||
QPushButton * buttonNo = message.addButton(tr("No"), QMessageBox::NoRole);
|
message.addButton(tr("No"), QMessageBox::NoRole);
|
||||||
message.exec();
|
message.exec();
|
||||||
if (message.clickedButton() != buttonYes) {
|
if (message.clickedButton() != buttonYes) {
|
||||||
return;
|
return;
|
||||||
|
@ -517,6 +517,7 @@ void SettingsWidget::showWarningDialog(const int & errorCode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QMessageBox message(QMessageBox::Warning, tr("Search"), errorMessage, QMessageBox::Ok, this);
|
QMessageBox message(QMessageBox::Warning, tr("Search"), errorMessage);
|
||||||
|
message.addButton(tr("OK"), QMessageBox::AcceptRole);
|
||||||
message.exec();
|
message.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/main.cpp" line="171"/>
|
<location filename="../../src/main.cpp" line="182"/>
|
||||||
<source>ukui-search is already running!</source>
|
<source>ukui-search is already running!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -137,27 +137,27 @@
|
||||||
<context>
|
<context>
|
||||||
<name>SearchDetailView</name>
|
<name>SearchDetailView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="490"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="494"/>
|
||||||
<source>Path</source>
|
<source>Path</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="498"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="502"/>
|
||||||
<source>Last time modified</source>
|
<source>Last time modified</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="216"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="220"/>
|
||||||
<source>Application</source>
|
<source>Application</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="197"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="201"/>
|
||||||
<source>Introduction: %1</source>
|
<source>Introduction: %1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="335"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="339"/>
|
||||||
<source>Document</source>
|
<source>Document</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -317,6 +317,11 @@
|
||||||
<source>Set blocked folder failed!</source>
|
<source>Set blocked folder failed!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/settings-widget.cpp" line="521"/>
|
||||||
|
<source>OK</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ShowMoreLabel</name>
|
<name>ShowMoreLabel</name>
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/main.cpp" line="171"/>
|
<location filename="../../src/main.cpp" line="182"/>
|
||||||
<source>ukui-search is already running!</source>
|
<source>ukui-search is already running!</source>
|
||||||
<translation>ukui-bul zaten çalışıyor!</translation>
|
<translation>ukui-bul zaten çalışıyor!</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -137,27 +137,27 @@
|
||||||
<context>
|
<context>
|
||||||
<name>SearchDetailView</name>
|
<name>SearchDetailView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="490"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="494"/>
|
||||||
<source>Path</source>
|
<source>Path</source>
|
||||||
<translation>Yol</translation>
|
<translation>Yol</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="498"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="502"/>
|
||||||
<source>Last time modified</source>
|
<source>Last time modified</source>
|
||||||
<translation>Son değiştirilme zamanı</translation>
|
<translation>Son değiştirilme zamanı</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="216"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="220"/>
|
||||||
<source>Application</source>
|
<source>Application</source>
|
||||||
<translation>Uygulama</translation>
|
<translation>Uygulama</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="197"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="201"/>
|
||||||
<source>Introduction: %1</source>
|
<source>Introduction: %1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="335"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="339"/>
|
||||||
<source>Document</source>
|
<source>Document</source>
|
||||||
<translation>Belge</translation>
|
<translation>Belge</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -321,6 +321,11 @@
|
||||||
<source>Set blocked folder failed!</source>
|
<source>Set blocked folder failed!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/settings-widget.cpp" line="521"/>
|
||||||
|
<source>OK</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ShowMoreLabel</name>
|
<name>ShowMoreLabel</name>
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>QObject</name>
|
<name>QObject</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/main.cpp" line="171"/>
|
<location filename="../../src/main.cpp" line="182"/>
|
||||||
<source>ukui-search is already running!</source>
|
<source>ukui-search is already running!</source>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -137,27 +137,27 @@
|
||||||
<context>
|
<context>
|
||||||
<name>SearchDetailView</name>
|
<name>SearchDetailView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="490"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="494"/>
|
||||||
<source>Path</source>
|
<source>Path</source>
|
||||||
<translation>路径</translation>
|
<translation>路径</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="498"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="502"/>
|
||||||
<source>Last time modified</source>
|
<source>Last time modified</source>
|
||||||
<translation>上次修改时间</translation>
|
<translation>上次修改时间</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="216"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="220"/>
|
||||||
<source>Application</source>
|
<source>Application</source>
|
||||||
<translation>应用</translation>
|
<translation>应用</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="197"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="201"/>
|
||||||
<source>Introduction: %1</source>
|
<source>Introduction: %1</source>
|
||||||
<translation>软件介绍: %1</translation>
|
<translation>软件介绍: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/control/search-detail-view.cpp" line="335"/>
|
<location filename="../../src/control/search-detail-view.cpp" line="339"/>
|
||||||
<source>Document</source>
|
<source>Document</source>
|
||||||
<translation>文件</translation>
|
<translation>文件</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -272,6 +272,11 @@
|
||||||
<source>Set blocked folder failed!</source>
|
<source>Set blocked folder failed!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../src/settings-widget.cpp" line="521"/>
|
||||||
|
<source>OK</source>
|
||||||
|
<translation>好的</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/settings-widget.cpp" line="348"/>
|
<location filename="../../src/settings-widget.cpp" line="348"/>
|
||||||
<source>Creating ...</source>
|
<source>Creating ...</source>
|
||||||
|
|
Loading…
Reference in New Issue