11// Author: Kang Lin <[email protected] >22
3+ #include < QFontMetrics>
4+ #include < QGridLayout>
5+ #include < QMessageBox>
6+ #include < QCheckBox>
7+ #include < QScreen>
8+ #include < QApplication>
9+ #include < QDebug>
10+ #include < QDesktopServices>
11+ #include < QWidgetAction>
12+ #include < QMouseEvent>
13+ #include < QDrag>
14+ #include < QMimeData>
15+ #include < QKeySequence>
16+ #include < QPushButton>
17+ #include < QDateTime>
18+ #include < QFileDialog>
19+ #include < QLoggingCategory>
20+ #include < QThread>
21+
322#include " mainwindow.h"
423#include " ui_mainwindow.h"
524#ifdef HAVE_UPDATE
6- #include " FrmUpdater.h"
25+ #include " FrmUpdater.h"
726#endif
827#include " RabbitCommonDir.h"
928#include " RabbitCommonTools.h"
1029
1130#ifdef HAVE_ABOUT
12- #include " DlgAbout.h"
31+ #include " DlgAbout.h"
1332#endif
1433#ifdef BUILD_QUIWidget
15- #include " QUIWidget/QUIWidget.h"
34+ #include " QUIWidget/QUIWidget.h"
1635#endif
1736
1837#include " Operate.h"
1938#include " FrmFullScreenToolBar.h"
2039#include " ParameterDlgSettings.h"
21- #include " FrmListRecent.h"
2240
2341#include " ViewTable.h"
2442#include " ViewSplitter.h"
2543
2644#ifdef HAVE_ICE
27- #include " Ice.h"
45+ #include " Ice.h"
2846#endif
2947
30- #include < QFontMetrics>
31- #include < QGridLayout>
32- #include < QMessageBox>
33- #include < QCheckBox>
34- #include < QScreen>
35- #include < QApplication>
36- #include < QDebug>
37- #include < QDesktopServices>
38- #include < QWidgetAction>
39- #include < QMouseEvent>
40- #include < QDrag>
41- #include < QMimeData>
42- #include < QKeySequence>
43- #include < QPushButton>
44- #include < QDateTime>
45- #include < QFileDialog>
46- #include < QLoggingCategory>
47- #include < QThread>
48-
4948static Q_LOGGING_CATEGORY (log, " App.MainWindow" )
5049static Q_LOGGING_CATEGORY(logRecord, " App.MainWindow.Record" )
5150
@@ -67,6 +66,7 @@ MainWindow::MainWindow(QWidget *parent)
6766 , m_pFullScreenToolBar(nullptr )
6867 , m_pRecentMenu(nullptr )
6968 , m_pDockFavorite(nullptr )
69+ , m_pListRecent(nullptr )
7070 , m_pFavoriteView(nullptr )
7171 , m_StatusBarMessage(this )
7272{
@@ -124,9 +124,7 @@ MainWindow::MainWindow(QWidget *parent)
124124 ui->menuTools ->addMenu (RabbitCommon::CTools::GetLogMenu (this ));
125125
126126 m_pRecentMenu = new RabbitCommon::CRecentMenu (
127- tr (" Recently" ),
128- QIcon::fromTheme (" document-open-recent" ),
129- this );
127+ tr (" Recently" ), QIcon::fromTheme (" document-open-recent" ), true , this );
130128 check = connect (m_pRecentMenu, SIGNAL (recentFileTriggered (const QString&)),
131129 this , SLOT (slotOpenFile (const QString&)));
132130 Q_ASSERT (check);
@@ -200,7 +198,6 @@ MainWindow::MainWindow(QWidget *parent)
200198 m_pToolBarMenuAction->setVisible (false );
201199#endif
202200
203- m_Manager.EnumPlugins (this );
204201 check = connect (&m_Parameter, SIGNAL (sigStartByTypeChanged ()),
205202 this , SLOT (slotStartByType ()));
206203 Q_ASSERT (check);
@@ -238,23 +235,23 @@ MainWindow::MainWindow(QWidget *parent)
238235 m_pDockListRecent = new QDockWidget (this );
239236 if (m_pDockListRecent)
240237 {
241- CFrmListRecent* pListRecent
238+ m_pListRecent
242239 = new CFrmListRecent (this , &m_Manager, m_Parameter, true ,
243240 m_pDockListRecent);
244- if (pListRecent ) {
245- if (pListRecent ->m_pDockTitleBar )
241+ if (m_pListRecent ) {
242+ if (m_pListRecent ->m_pDockTitleBar )
246243 m_pDockListRecent->setTitleBarWidget (
247- pListRecent ->m_pDockTitleBar );
248- check = connect (pListRecent ,
244+ m_pListRecent ->m_pDockTitleBar );
245+ check = connect (m_pListRecent ,
249246 SIGNAL (sigStart (const QString&, bool )),
250247 this , SLOT (slotOpenFile (const QString&, bool )));
251248 Q_ASSERT (check);
252- check = connect (pListRecent , SIGNAL (sigAddToFavorite (QString,QString,QIcon,QString)),
249+ check = connect (m_pListRecent , SIGNAL (sigAddToFavorite (QString,QString,QIcon,QString)),
253250 m_pFavoriteView, SLOT (slotAddToFavorite (QString,QString,QIcon,QString)));
254251 Q_ASSERT (check);
255- m_pDockListRecent->setWidget (pListRecent );
252+ m_pDockListRecent->setWidget (m_pListRecent );
256253 m_pDockListRecent->setWindowTitle (
257- pListRecent ->windowTitle ());
254+ m_pListRecent ->windowTitle ());
258255 }
259256 // Must set ObjectName then restore it. See: saveState help document
260257 m_pDockListRecent->setObjectName (" dockListRecent" );
@@ -385,10 +382,6 @@ MainWindow::MainWindow(QWidget *parent)
385382 }
386383 #endif
387384 }
388-
389- slotEnableSystemTrayIcon ();
390-
391- LoadOperateLasterClose ();
392385}
393386
394387MainWindow::~MainWindow ()
@@ -398,6 +391,48 @@ MainWindow::~MainWindow()
398391 delete ui;
399392}
400393
394+ // ! For time-consuming operations
395+ void MainWindow::slotInitial ()
396+ {
397+ qDebug (log) << Q_FUNC_INFO;
398+
399+ setEnabled (false );
400+
401+ slotInformation (tr (" Load plugins ......" ));
402+ qApp->processEvents ();
403+ m_Manager.Initial ();
404+ m_Manager.EnumPlugins (this );
405+
406+ if (m_pRecentMenu) {
407+ slotInformation (tr (" Load recent menu ......" ));
408+ qApp->processEvents ();
409+ m_pRecentMenu->slotRestoreState ();
410+ }
411+
412+ if (m_pFavoriteView) {
413+ slotInformation (tr (" Load favorite ......" ));
414+ qApp->processEvents ();
415+ m_pFavoriteView->Load ();
416+ }
417+
418+ if (m_pListRecent) {
419+ slotInformation (tr (" Load list recent dock ......" ));
420+ qApp->processEvents ();
421+ m_pListRecent->slotLoadFiles ();
422+ }
423+ slotEnableSystemTrayIcon ();
424+
425+ setEnabled (true );
426+
427+ slotInformation (tr (" Load laster operate ......" ));
428+ qApp->processEvents ();
429+ LoadOperateLasterClose ();
430+
431+ slotInformation (tr (" Ready" ));
432+
433+ return ;
434+ }
435+
401436void MainWindow::SetView (CView* pView)
402437{
403438 qDebug (log) << Q_FUNC_INFO;
0 commit comments