diff --git a/CMakeLists.txt b/CMakeLists.txt index b5974df..2be5d3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,8 @@ set(PROJECT_SOURCES appeventfilter.cpp resources/icons.qrc startuptext.h + recentfilesdialog.h + recentfilesdialog.cpp ) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) diff --git a/mainwindow.cpp b/mainwindow.cpp index 7e756ae..c3444d7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -24,6 +24,9 @@ MainWindow::MainWindow(QWidget *parent) QObject::connect(shiftTimer,&QTimer::timeout, this, &MainWindow::shiftTimerHandle); + QObject::connect(this,&MainWindow::openRecentFilesDialog, + view_handler.get(),&ViewsHandler::openRecentFilesDialogHandle); + QObject::connect(this,&MainWindow::startSearchAll, view_handler.get(),&ViewsHandler::startTextSearchInAllFilesHandle); } @@ -57,16 +60,25 @@ void MainWindow::keyPressEvent(QKeyEvent *event) } shiftTimer->start(200); }break; + + case Qt::Key_Tab: + if( event->modifiers() == Qt::CTRL){ + emit openRecentFilesDialog(true); + }break; + default:; } QMainWindow::keyPressEvent(event); } void MainWindow::keyReleaseEvent(QKeyEvent *event) { - if(event->key() == Qt::Key_Alt){ - fileSearchBox->hide(); - folderTreeBox->hide(); - mkEditorBox->hide(); + switch(event->key()){ + case Qt::Key_Alt:{ + fileSearchBox->hide(); + folderTreeBox->hide(); + mkEditorBox->hide(); + }break; + case Qt::Key_Control: emit openRecentFilesDialog(false); break; } QMainWindow::keyReleaseEvent(event); } diff --git a/mainwindow.h b/mainwindow.h index 1cc646b..2e4f221 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -50,6 +50,7 @@ private slots: void setup_views(QWidget *parent, Ui::MainWindow &ui); signals: + void openRecentFilesDialog(bool show); void startSearchAll(); }; #endif // MAINWINDOW_H diff --git a/recentfilesdialog.cpp b/recentfilesdialog.cpp new file mode 100644 index 0000000..3d75bf6 --- /dev/null +++ b/recentfilesdialog.cpp @@ -0,0 +1,6 @@ +#include "recentfilesdialog.h" + +RecentFilesDialog::RecentFilesDialog(QWidget * parent):QDialog(parent) +{ + +} diff --git a/recentfilesdialog.h b/recentfilesdialog.h new file mode 100644 index 0000000..09b942f --- /dev/null +++ b/recentfilesdialog.h @@ -0,0 +1,15 @@ +#ifndef RECENTFILESDIALOG_H +#define RECENTFILESDIALOG_H + +#include +#include +#include + +class RecentFilesDialog : public QDialog +{ + Q_OBJECT +public: + RecentFilesDialog(QWidget*parent = nullptr); +}; + +#endif // RECENTFILESDIALOG_H diff --git a/views_handler.cpp b/views_handler.cpp index 11a0261..95fff85 100644 --- a/views_handler.cpp +++ b/views_handler.cpp @@ -319,6 +319,14 @@ void ViewsHandler::displayTextSearchedFilePosition(QString &filePath,int searchT } +void ViewsHandler::openRecentFilesDialogHandle(bool show) +{ + if(show) + recentFilesView->show(); + else + recentFilesView->hide(); +} + void ViewsHandler::startTextSearchInAllFilesHandle() { if(textSearchAllView->isHidden()){ diff --git a/views_handler.h b/views_handler.h index dc1f3b2..91cefee 100644 --- a/views_handler.h +++ b/views_handler.h @@ -13,6 +13,7 @@ #include "textsearchworker.h" #include "ui_mainwindow.h" #include "searchalldialog.h" +#include "recentfilesdialog.h" #define NAVIGATION_RATIO 100 #define EDITOR_RAIO 200 @@ -30,16 +31,19 @@ class ViewsHandler: public QObject return handle; } ~ViewsHandler(){ + delete recentFilesView; delete textSearchAllView; } public slots: + void openRecentFilesDialogHandle(bool show); void startTextSearchInAllFilesHandle(); private: ViewsHandler(QWidget*parent,Ui::MainWindow &ui){ firstDirectoryLoad = true; this->parent = parent; + recentFilesView = new RecentFilesDialog(this->parent); textSearchAllView = new SearchAllDialog(this->parent); initViews(ui); initConnection(); @@ -50,6 +54,7 @@ public slots: QWidget *parent; QThread searchThread; + RecentFilesDialog *recentFilesView; SearchAllDialog *textSearchAllView; QFrame *viewLeftFrame; TextSearchWorker textSearchWorker;