Merge pull request #81 from mammonsama666/0114-dev
Fix bus of frontend.
This commit is contained in:
commit
c62fff805b
|
@ -158,6 +158,15 @@ int ContentWidget::currentPage() {
|
||||||
*/
|
*/
|
||||||
void ContentWidget::refreshSearchList(const QVector<int>& types, const QVector<QStringList>& lists, const QString& keyword) {
|
void ContentWidget::refreshSearchList(const QVector<int>& types, const QVector<QStringList>& lists, const QString& keyword) {
|
||||||
if (!m_listLyt->isEmpty()) {
|
if (!m_listLyt->isEmpty()) {
|
||||||
|
if (m_fileListView) {
|
||||||
|
m_fileListView->clear();
|
||||||
|
}
|
||||||
|
if (m_dirListView) {
|
||||||
|
m_dirListView->clear();
|
||||||
|
}
|
||||||
|
if (m_contentListView) {
|
||||||
|
m_contentListView->clear();
|
||||||
|
}
|
||||||
clearLayout(m_listLyt);
|
clearLayout(m_listLyt);
|
||||||
m_resultList->setFixedHeight(0);
|
m_resultList->setFixedHeight(0);
|
||||||
}
|
}
|
||||||
|
@ -396,15 +405,6 @@ QString ContentWidget::getTitleName(const int& type) {
|
||||||
* @param layout 需要清空的布局
|
* @param layout 需要清空的布局
|
||||||
*/
|
*/
|
||||||
void ContentWidget::clearLayout(QLayout * layout) {
|
void ContentWidget::clearLayout(QLayout * layout) {
|
||||||
if (m_fileListView) {
|
|
||||||
m_fileListView->clear();
|
|
||||||
}
|
|
||||||
if (m_dirListView) {
|
|
||||||
m_dirListView->clear();
|
|
||||||
}
|
|
||||||
if (m_contentListView) {
|
|
||||||
m_contentListView->clear();
|
|
||||||
}
|
|
||||||
m_contentList.clear();
|
m_contentList.clear();
|
||||||
if (! layout) return;
|
if (! layout) return;
|
||||||
QLayoutItem * child;
|
QLayoutItem * child;
|
||||||
|
|
|
@ -58,7 +58,6 @@ bool ConfigFile::writeRecently(QString message){
|
||||||
recently.insert(0,message);
|
recently.insert(0,message);
|
||||||
|
|
||||||
m_qSettings->beginGroup("Recently");
|
m_qSettings->beginGroup("Recently");
|
||||||
qWarning()<<m_qSettings->value("Recently").toStringList().length();
|
|
||||||
if (m_qSettings->value("Recently").toStringList().length() >= 20) {
|
if (m_qSettings->value("Recently").toStringList().length() >= 20) {
|
||||||
m_qSettings->setValue("Recently",QStringList(recently.mid(0, 20)));
|
m_qSettings->setValue("Recently",QStringList(recently.mid(0, 20)));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,20 +34,14 @@ void HomePageItem::setupUi(const int& type, const QString& path) {
|
||||||
case SearchListView::ResType::Content:
|
case SearchListView::ResType::Content:
|
||||||
case SearchListView::ResType::Dir:
|
case SearchListView::ResType::Dir:
|
||||||
case SearchListView::ResType::File: {
|
case SearchListView::ResType::File: {
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
process->start(QString("xdg-open %1").arg(path));
|
process.start(QString("xdg-open %1").arg(path));
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
|
||||||
process->deleteLater();
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SearchListView::ResType::Setting: {
|
case SearchListView::ResType::Setting: {
|
||||||
//打开控制面板对应页面
|
//打开控制面板对应页面
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
|
||||||
process->deleteLater();
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -65,13 +65,13 @@ QString SearchDetailView::getHtmlText(const QString & text, const QString & keyw
|
||||||
if ((keyword.toUpper()).contains(QString(text.at(i)).toUpper())) {
|
if ((keyword.toUpper()).contains(QString(text.at(i)).toUpper())) {
|
||||||
if (! boldOpenned) {
|
if (! boldOpenned) {
|
||||||
boldOpenned = true;
|
boldOpenned = true;
|
||||||
htmlString.append(QString("<b>"));
|
htmlString.append(QString("<b><font size=\"4\">"));
|
||||||
}
|
}
|
||||||
htmlString.append(QString(text.at(i)));
|
htmlString.append(QString(text.at(i)));
|
||||||
} else {
|
} else {
|
||||||
if (boldOpenned) {
|
if (boldOpenned) {
|
||||||
boldOpenned = false;
|
boldOpenned = false;
|
||||||
htmlString.append(QString("</b>"));
|
htmlString.append(QString("</font></b>"));
|
||||||
}
|
}
|
||||||
htmlString.append(QString(text.at(i)));
|
htmlString.append(QString(text.at(i)));
|
||||||
}
|
}
|
||||||
|
@ -251,21 +251,15 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
|
||||||
case SearchListView::ResType::Content:
|
case SearchListView::ResType::Content:
|
||||||
case SearchListView::ResType::Dir:
|
case SearchListView::ResType::Dir:
|
||||||
case SearchListView::ResType::File: {
|
case SearchListView::ResType::File: {
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
process->start(QString("xdg-open %1").arg(path));
|
process.start(QString("xdg-open %1").arg(path));
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
|
||||||
process->deleteLater();
|
|
||||||
});
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SearchListView::ResType::Setting: {
|
case SearchListView::ResType::Setting: {
|
||||||
//打开控制面板对应页面
|
//打开控制面板对应页面
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
|
||||||
process->deleteLater();
|
|
||||||
});
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +277,9 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
|
||||||
bool SearchDetailView::writeConfigFile(const QString& path) {
|
bool SearchDetailView::writeConfigFile(const QString& path) {
|
||||||
if (ConfigFile::writeConfig(path)) {
|
if (ConfigFile::writeConfig(path)) {
|
||||||
Q_EMIT this->configFileChanged();
|
Q_EMIT this->configFileChanged();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -299,11 +295,8 @@ bool SearchDetailView::addDesktopShortcut(const QString& path) {
|
||||||
bool ret = file.copy(QString(dirpath+"/"+desktopfn));
|
bool ret = file.copy(QString(dirpath+"/"+desktopfn));
|
||||||
if(ret)
|
if(ret)
|
||||||
{
|
{
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
process->start(QString("chmod a+x %1").arg(newName));
|
process.start(QString("chmod a+x %1").arg(newName));
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
|
||||||
process->deleteLater();
|
|
||||||
});
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -328,6 +321,7 @@ bool SearchDetailView::addPanelShortcut(const QString& path) {
|
||||||
qDebug()<<"qDebug: Add shortcut to panel successed!";
|
qDebug()<<"qDebug: Add shortcut to panel successed!";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,11 +329,8 @@ bool SearchDetailView::addPanelShortcut(const QString& path) {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool SearchDetailView::openPathAction(const QString& path) {
|
bool SearchDetailView::openPathAction(const QString& path) {
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
process->start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
|
process.start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
|
||||||
process->deleteLater();
|
|
||||||
});
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,4 +341,5 @@ bool SearchDetailView::openPathAction(const QString& path) {
|
||||||
bool SearchDetailView::copyPathAction(const QString& path) {
|
bool SearchDetailView::copyPathAction(const QString& path) {
|
||||||
QClipboard * clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
QClipboard * clipboard = QApplication::clipboard(); //获取系统剪贴板指针
|
||||||
clipboard->setText(path);
|
clipboard->setText(path);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ void MainWindow::initUi()
|
||||||
&MainWindow::primaryScreenChangedSlot);
|
&MainWindow::primaryScreenChangedSlot);
|
||||||
connect(m_searchLayout, &UkuiSearchBarHLayout::textChanged, this, [ = ](QString text) {
|
connect(m_searchLayout, &UkuiSearchBarHLayout::textChanged, this, [ = ](QString text) {
|
||||||
if (text == "") {
|
if (text == "") {
|
||||||
if (m_search_result_thread->isInterruptionRequested()) {
|
if (m_search_result_thread->isRunning()) {
|
||||||
m_search_result_thread->requestInterruption();
|
m_search_result_thread->requestInterruption();
|
||||||
m_search_result_thread->quit();
|
m_search_result_thread->quit();
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void MainWindow::initUi()
|
||||||
} else {
|
} else {
|
||||||
m_contentFrame->setCurrentIndex(1);
|
m_contentFrame->setCurrentIndex(1);
|
||||||
// QTimer::singleShot(50,this,[=](){
|
// QTimer::singleShot(50,this,[=](){
|
||||||
if (! m_search_result_thread->isInterruptionRequested()) {
|
if (! m_search_result_thread->isRunning()) {
|
||||||
m_search_result_thread->start();
|
m_search_result_thread->start();
|
||||||
}
|
}
|
||||||
searchContent(text);
|
searchContent(text);
|
||||||
|
|
Loading…
Reference in New Issue