2020-12-22 10:14:58 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-12-21 16:26:59 +08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2020-12-22 10:14:58 +08:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QPropertyAnimation>
|
|
|
|
#include <QPaintEvent>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QtMath>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QSpacerItem>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
#include <QPropertyAnimation>
|
|
|
|
#include <QGraphicsDropShadowEffect>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QPropertyAnimation>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QFrame>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QGSettings/QGSettings>
|
2021-01-13 18:35:48 +08:00
|
|
|
#include <QSystemTrayIcon>
|
2020-12-22 10:14:58 +08:00
|
|
|
#include "content-widget.h"
|
|
|
|
#include "input-box.h"
|
2020-12-25 19:16:44 +08:00
|
|
|
#include "index/index-generator.h"
|
2020-12-29 20:31:48 +08:00
|
|
|
#include "settings-widget.h"
|
2021-01-11 20:34:51 +08:00
|
|
|
#include "libsearch.h"
|
2020-12-21 16:26:59 +08:00
|
|
|
|
2021-01-11 20:34:51 +08:00
|
|
|
class SearchResult;
|
2020-12-21 16:26:59 +08:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
2021-01-11 20:34:51 +08:00
|
|
|
friend class SearchResult;
|
2020-12-21 16:26:59 +08:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-12-22 10:14:58 +08:00
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
2020-12-21 16:26:59 +08:00
|
|
|
~MainWindow();
|
2020-12-22 10:14:58 +08:00
|
|
|
/**
|
|
|
|
* @brief Load the main window
|
|
|
|
*/
|
|
|
|
void searchContent(QString searchcontent);
|
|
|
|
|
|
|
|
private:
|
2020-12-28 17:21:25 +08:00
|
|
|
bool nativeEvent(const QByteArray&, void *, long *);
|
|
|
|
|
2020-12-22 10:14:58 +08:00
|
|
|
QFrame * m_line = nullptr;//Vertical dividing line
|
|
|
|
QFrame * m_frame = nullptr;
|
|
|
|
|
|
|
|
QFrame * m_titleFrame = nullptr;//标题栏
|
|
|
|
QHBoxLayout * m_titleLyt = nullptr;
|
|
|
|
QLabel * m_iconLabel = nullptr;
|
|
|
|
QLabel * m_titleLabel = nullptr;
|
|
|
|
QPushButton * m_menuBtn = nullptr;
|
2020-12-29 20:31:48 +08:00
|
|
|
SettingsWidget * m_settingsWidget = nullptr;
|
2020-12-22 10:14:58 +08:00
|
|
|
|
|
|
|
ContentWidget * m_contentFrame = nullptr;//内容栏
|
|
|
|
|
|
|
|
UKuiSeachBarWidget * m_searchWidget = nullptr;//搜索栏
|
|
|
|
UkuiSearchBarHLayout * m_searchLayout = nullptr;
|
|
|
|
|
|
|
|
bool m_winFlag = false;
|
|
|
|
|
|
|
|
QGSettings * m_transparency_gsettings = nullptr;
|
|
|
|
double getTransparentData();
|
|
|
|
|
2021-01-15 15:34:43 +08:00
|
|
|
QVector<QStringList> m_app_setting_lists;
|
2021-01-08 20:48:20 +08:00
|
|
|
QStringList m_dirList;
|
2021-01-11 20:34:51 +08:00
|
|
|
|
|
|
|
QQueue<QString> *m_search_result_file = nullptr;
|
|
|
|
QQueue<QString> *m_search_result_dir = nullptr;
|
|
|
|
QQueue<QPair<QString,QStringList>> *m_search_result_content = nullptr;
|
|
|
|
SearchResult * m_search_result_thread = nullptr;
|
|
|
|
|
|
|
|
FileSearcher* m_searcher = nullptr;
|
2021-01-13 18:35:48 +08:00
|
|
|
QSystemTrayIcon *m_sys_tray_icon;
|
2021-01-11 20:34:51 +08:00
|
|
|
|
2020-12-22 10:14:58 +08:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
void initUi();
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
/**
|
|
|
|
* @brief Monitor screen resolution
|
|
|
|
* @param rect: Screen resolution
|
|
|
|
*/
|
|
|
|
void monitorResolutionChange(QRect rect);
|
|
|
|
/**
|
|
|
|
* @brief Monitor primary screen changes
|
|
|
|
* @param screen: Primary screen
|
|
|
|
*/
|
|
|
|
void primaryScreenChangedSlot(QScreen *screen);
|
|
|
|
|
|
|
|
void bootOptionsFilter(QString opt); // 过滤终端命令
|
|
|
|
void clearSearchResult(); //清空搜索结果
|
2020-12-21 16:26:59 +08:00
|
|
|
};
|
2020-12-22 10:14:58 +08:00
|
|
|
|
2020-12-21 16:26:59 +08:00
|
|
|
#endif // MAINWINDOW_H
|