2020-12-22 10:14:58 +08:00
|
|
|
/*
|
|
|
|
*
|
2021-01-29 11:43:07 +08:00
|
|
|
* Copyright (C) 2020, KylinSoft Co., Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2020-12-22 10:14:58 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2021-01-29 11:43:07 +08:00
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2020-12-22 10:14:58 +08:00
|
|
|
*
|
|
|
|
* 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
|
2021-01-29 11:43:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors: zhangjiaping <zhangjiaping@kylinos.cn>
|
|
|
|
* Modified by: zhangpengfei <zhangpengfei@kylinos.cn>
|
2020-12-22 10:14:58 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
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>
|
2021-01-21 14:20:44 +08:00
|
|
|
#include <QKeyEvent>
|
2020-12-22 10:14:58 +08:00
|
|
|
#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"
|
2021-02-27 17:32:41 +08:00
|
|
|
#include "search-app-thread.h"
|
2021-03-26 11:39:08 +08:00
|
|
|
#include "xatom-helper.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);
|
2021-01-26 18:43:03 +08:00
|
|
|
void moveToPanel();
|
2021-03-30 17:04:44 +08:00
|
|
|
void centerToScreen(QWidget* widget);
|
2021-03-26 11:39:08 +08:00
|
|
|
MotifWmHints m_hints;
|
2020-12-22 10:14:58 +08:00
|
|
|
|
|
|
|
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;//内容栏
|
|
|
|
|
2021-01-18 10:07:02 +08:00
|
|
|
SeachBarWidget * m_searchWidget = nullptr;//搜索栏
|
|
|
|
SearchBarHLayout * m_searchLayout = nullptr;
|
2020-12-22 10:14:58 +08:00
|
|
|
|
|
|
|
bool m_winFlag = false;
|
|
|
|
|
|
|
|
QGSettings * m_transparency_gsettings = nullptr;
|
|
|
|
double getTransparentData();
|
|
|
|
|
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;
|
2021-02-27 17:32:41 +08:00
|
|
|
SearchAppThread * m_seach_app_thread = nullptr;
|
2021-01-11 20:34:51 +08:00
|
|
|
|
2021-03-17 10:23:21 +08:00
|
|
|
SearchManager* m_searcher = nullptr;
|
2021-03-30 17:55:08 +08:00
|
|
|
SettingsMatch *m_settingsMatch = 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 *);
|
2021-01-21 14:20:44 +08:00
|
|
|
void keyPressEvent(QKeyEvent *event);
|
2020-12-22 10:14:58 +08:00
|
|
|
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
|