2017-08-05 15:20:02 +10:00
|
|
|
/****************************************
|
2017-08-12 21:47:17 +10:00
|
|
|
*
|
2017-08-05 15:20:02 +10:00
|
|
|
* theShell - Desktop Environment
|
2019-01-01 21:52:05 +11:00
|
|
|
* Copyright (C) 2019 Victor Tran
|
2017-08-05 15:20:02 +10:00
|
|
|
*
|
|
|
|
* 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 of the License, 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/>.
|
2017-08-12 21:47:17 +10:00
|
|
|
*
|
2017-08-05 15:20:02 +10:00
|
|
|
* *************************************/
|
|
|
|
|
2016-02-17 17:24:00 +11:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2016-03-17 19:46:40 +11:00
|
|
|
#include <QTimer>
|
|
|
|
#include <QList>
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QSignalMapper>
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QtDBus/QDBusConnection>
|
|
|
|
#include <QMessageBox>
|
2016-03-29 17:42:24 +11:00
|
|
|
#include <QSettings>
|
2016-04-03 10:41:46 +10:00
|
|
|
#include <QSoundEffect>
|
|
|
|
#include <QPainter>
|
2016-06-21 17:42:44 +10:00
|
|
|
#include <QMenu>
|
2016-11-25 15:24:09 +11:00
|
|
|
#include <QAction>
|
2018-02-14 14:08:18 +11:00
|
|
|
#include <QMutex>
|
2016-04-01 21:05:25 +11:00
|
|
|
#include <math.h>
|
2016-03-17 19:46:40 +11:00
|
|
|
#include "window.h"
|
|
|
|
#include "upowerdbus.h"
|
|
|
|
#include "infopanedropdown.h"
|
2016-06-11 17:07:36 +10:00
|
|
|
#include "systrayicons.h"
|
2016-06-29 21:29:55 +10:00
|
|
|
#include "fadebutton.h"
|
2016-05-29 17:03:52 +10:00
|
|
|
#include "FlowLayout/flowlayout.h"
|
2016-12-17 23:58:08 +11:00
|
|
|
#include "tutorialwindow.h"
|
2017-01-12 01:00:27 +11:00
|
|
|
#include "audiomanager.h"
|
2017-08-04 21:18:42 +10:00
|
|
|
#include "taskbarmanager.h"
|
2016-05-29 17:03:52 +10:00
|
|
|
#include <systemd/sd-login.h>
|
|
|
|
#include <systemd/sd-daemon.h>
|
2018-05-14 18:26:30 +10:00
|
|
|
#include "location/locationservices.h"
|
2018-01-22 18:20:33 +11:00
|
|
|
#include "screenrecorder.h"
|
2016-05-29 17:03:52 +10:00
|
|
|
|
2016-07-07 22:45:59 +10:00
|
|
|
class Menu;
|
2017-04-01 13:27:31 +11:00
|
|
|
class InfoPaneDropdown;
|
|
|
|
|
2019-01-22 23:16:37 +11:00
|
|
|
class ChunkWatcher : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ChunkWatcher(QWidget* chunk) : QObject(chunk) {
|
|
|
|
chunk->installEventFilter(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void visibilityChanged(bool isVisible);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool eventFilter(QObject* watched, QEvent* event) {
|
|
|
|
if (event->type() == QEvent::Show) {
|
|
|
|
emit visibilityChanged(true);
|
|
|
|
} else if (event->type() == QEvent::Hide) {
|
|
|
|
emit visibilityChanged(false);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-02-17 17:24:00 +11:00
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2016-03-29 17:42:24 +11:00
|
|
|
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
|
2016-02-17 17:24:00 +11:00
|
|
|
|
|
|
|
public:
|
2018-08-22 21:25:44 +10:00
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
2016-02-17 17:24:00 +11:00
|
|
|
~MainWindow();
|
2016-03-29 17:42:24 +11:00
|
|
|
void setGeometry(int x, int y, int w, int h);
|
|
|
|
void setGeometry(QRect geometry);
|
2016-05-01 22:01:03 +10:00
|
|
|
InfoPaneDropdown* getInfoPane();
|
2019-03-23 00:34:48 +11:00
|
|
|
Menu* getMenu();
|
2016-06-29 21:29:55 +10:00
|
|
|
void show();
|
2016-02-17 17:24:00 +11:00
|
|
|
|
2016-07-06 12:37:05 +10:00
|
|
|
bool isMprisAvailable();
|
|
|
|
bool isMprisPlaying();
|
|
|
|
void nextSong();
|
|
|
|
void playPause();
|
|
|
|
void play();
|
|
|
|
void pause();
|
|
|
|
void previousSong();
|
|
|
|
QString mprisApp();
|
|
|
|
QString songName();
|
|
|
|
QString songArtist();
|
|
|
|
QString songAlbum();
|
|
|
|
|
2016-07-03 23:07:04 +10:00
|
|
|
public slots:
|
2017-11-07 22:23:15 +11:00
|
|
|
void openMenu();
|
2016-07-03 23:07:04 +10:00
|
|
|
|
2016-07-07 22:45:59 +10:00
|
|
|
void doUpdate();
|
2017-02-10 17:40:34 +11:00
|
|
|
|
|
|
|
void updateStruts();
|
|
|
|
|
2018-02-06 00:17:11 +11:00
|
|
|
void reloadBar();
|
|
|
|
|
2016-03-17 19:46:40 +11:00
|
|
|
private slots:
|
|
|
|
void on_time_clicked();
|
|
|
|
|
2016-03-29 17:42:24 +11:00
|
|
|
void on_date_clicked();
|
|
|
|
|
|
|
|
void on_batteryLabel_clicked();
|
|
|
|
|
2016-04-01 21:05:25 +11:00
|
|
|
void on_volumeFrame_MouseEnter();
|
|
|
|
|
|
|
|
void on_volumeFrame_MouseExit();
|
|
|
|
|
|
|
|
void on_volumeSlider_sliderMoved(int position);
|
|
|
|
|
|
|
|
void on_volumeSlider_valueChanged(int value);
|
|
|
|
|
|
|
|
void on_brightnessFrame_MouseEnter();
|
|
|
|
|
|
|
|
void on_brightnessFrame_MouseExit();
|
|
|
|
|
|
|
|
void on_brightnessSlider_sliderMoved(int position);
|
|
|
|
|
|
|
|
void on_brightnessSlider_valueChanged(int value);
|
|
|
|
|
2016-04-03 10:41:46 +10:00
|
|
|
void on_volumeSlider_sliderReleased();
|
|
|
|
|
2016-05-29 17:03:52 +10:00
|
|
|
void pullDownGesture();
|
|
|
|
|
|
|
|
void setTimer(QString timer);
|
|
|
|
|
|
|
|
void setTimerVisible(bool visible);
|
|
|
|
|
|
|
|
void setTimerEnabled(bool enable);
|
|
|
|
|
|
|
|
void on_timerIcon_clicked();
|
|
|
|
|
|
|
|
void on_timer_clicked();
|
|
|
|
|
2016-06-12 11:28:41 +10:00
|
|
|
void DBusNewService(QString name);
|
|
|
|
|
2018-06-16 22:19:40 +10:00
|
|
|
void setMprisCurrentApp(QString app);
|
|
|
|
|
2016-06-12 11:28:41 +10:00
|
|
|
void on_mprisPause_clicked();
|
|
|
|
|
|
|
|
void on_mprisBack_clicked();
|
|
|
|
|
2016-07-06 12:37:05 +10:00
|
|
|
void on_mprisForward_clicked();
|
2016-06-12 11:28:41 +10:00
|
|
|
|
|
|
|
void on_mprisSongName_clicked();
|
|
|
|
|
2016-06-21 17:42:44 +10:00
|
|
|
void ActivateWindow();
|
|
|
|
|
2016-06-29 21:29:55 +10:00
|
|
|
void reloadScreens();
|
|
|
|
|
2016-06-30 16:07:29 +10:00
|
|
|
void on_desktopNext_clicked();
|
|
|
|
|
|
|
|
void on_desktopBack_clicked();
|
2016-07-07 22:45:59 +10:00
|
|
|
|
|
|
|
void on_openMenu_clicked();
|
|
|
|
|
2016-09-29 21:32:45 +10:00
|
|
|
void on_mprisSelection_triggered(QAction *arg1);
|
|
|
|
|
2016-10-24 22:10:28 +11:00
|
|
|
void updateMpris();
|
|
|
|
|
2018-06-16 22:19:40 +10:00
|
|
|
void updateMpris(QString interfaceName, QMap<QString, QVariant> properties, QStringList changedProperties);
|
|
|
|
|
2017-01-12 01:00:27 +11:00
|
|
|
void on_time_dragging(int , int );
|
|
|
|
|
|
|
|
void on_time_mouseReleased();
|
|
|
|
|
|
|
|
void on_date_dragging(int , int );
|
|
|
|
|
|
|
|
void on_date_mouseReleased();
|
|
|
|
|
|
|
|
void on_batteryLabel_dragging(int , int );
|
|
|
|
|
|
|
|
void on_batteryLabel_mouseReleased();
|
|
|
|
|
2017-04-24 15:49:10 +10:00
|
|
|
void on_actionNone_triggered();
|
|
|
|
|
|
|
|
void on_actionNotifications_triggered();
|
|
|
|
|
|
|
|
void on_actionMute_triggered();
|
|
|
|
|
2017-08-04 21:18:42 +10:00
|
|
|
void updateWindow(WmWindow window);
|
|
|
|
|
|
|
|
void deleteWindow(WmWindow window);
|
|
|
|
|
2018-01-22 18:20:33 +11:00
|
|
|
void on_stopRecordingButton_clicked();
|
|
|
|
|
2018-02-06 00:17:11 +11:00
|
|
|
void on_MainWindow_customContextMenuRequested(const QPoint &pos);
|
|
|
|
|
|
|
|
void on_openMenu_customContextMenuRequested(const QPoint &pos);
|
|
|
|
|
|
|
|
void on_openStatusCenterButton_clicked();
|
|
|
|
|
2018-08-14 15:39:03 +10:00
|
|
|
void on_actionCriticalOnly_triggered();
|
|
|
|
|
2018-08-31 23:40:21 +10:00
|
|
|
void lockMovement(QString reason);
|
2018-08-22 21:25:44 +10:00
|
|
|
|
2018-08-31 23:40:21 +10:00
|
|
|
void unlockMovement(QString reason);
|
2018-08-22 21:25:44 +10:00
|
|
|
|
2018-09-19 18:45:40 +10:00
|
|
|
void remakeBar();
|
2018-09-19 17:01:34 +10:00
|
|
|
void showStatusBarProgress(bool show);
|
2018-09-19 18:45:40 +10:00
|
|
|
|
2017-11-18 18:18:44 +11:00
|
|
|
signals:
|
2016-07-01 14:01:19 +10:00
|
|
|
void reloadBackgrounds();
|
2016-06-30 16:07:29 +10:00
|
|
|
|
2016-02-17 17:24:00 +11:00
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
2017-08-04 21:18:42 +10:00
|
|
|
//QList<WmWindow> windowList;
|
2016-07-07 22:45:59 +10:00
|
|
|
Menu* gatewayMenu;
|
2017-08-04 21:18:42 +10:00
|
|
|
TaskbarManager* taskbarManager;
|
|
|
|
|
|
|
|
QMap<Window, FadeButton*> buttonWindowMap;
|
2016-03-17 19:46:40 +11:00
|
|
|
|
2016-07-01 14:01:19 +10:00
|
|
|
QSettings settings;
|
|
|
|
|
2016-03-17 19:46:40 +11:00
|
|
|
int hideTop = 0;
|
2016-03-29 17:42:24 +11:00
|
|
|
bool lockHide = false;
|
2018-08-22 21:25:44 +10:00
|
|
|
int lockHideCount = 0;
|
2016-06-28 16:48:19 +10:00
|
|
|
int attentionDemandingWindows = 0;
|
2016-06-29 21:29:55 +10:00
|
|
|
int oldDesktop = 0;
|
|
|
|
Window oldActiveWindow = 0;
|
2016-06-28 16:48:19 +10:00
|
|
|
bool borderBlinkOn = true;
|
|
|
|
bool warningAnimCreated = false;
|
|
|
|
int warningWidth = 0;
|
2016-06-29 21:29:55 +10:00
|
|
|
bool forceWindowMove = false;
|
2016-03-29 17:42:24 +11:00
|
|
|
|
2016-06-12 11:28:41 +10:00
|
|
|
QString mprisCurrentAppName = "";
|
|
|
|
QStringList mprisDetectedApps;
|
2016-07-06 12:37:05 +10:00
|
|
|
QString mprisTitle;
|
|
|
|
QString mprisArtist;
|
|
|
|
QString mprisAlbum;
|
|
|
|
bool mprisPlaying;
|
2016-09-29 21:32:45 +10:00
|
|
|
bool pauseMprisMenuUpdate = false;
|
2018-02-14 14:08:18 +11:00
|
|
|
QMutex mprisUpdaterLocker;
|
2016-06-12 11:28:41 +10:00
|
|
|
|
2016-03-29 17:42:24 +11:00
|
|
|
void closeEvent(QCloseEvent*);
|
2016-06-29 21:29:55 +10:00
|
|
|
void paintEvent(QPaintEvent *event);
|
2017-08-12 21:47:17 +10:00
|
|
|
bool eventFilter(QObject *watched, QEvent *event);
|
2017-11-24 17:46:07 +11:00
|
|
|
void enterEvent(QEvent* event);
|
2017-12-10 23:20:51 +11:00
|
|
|
void changeEvent(QEvent* event);
|
2018-09-11 23:17:07 +10:00
|
|
|
void resizeEvent(QResizeEvent* event);
|
2018-08-22 21:25:44 +10:00
|
|
|
bool event(QEvent* event);
|
2016-03-17 19:46:40 +11:00
|
|
|
|
2016-03-29 17:42:24 +11:00
|
|
|
InfoPaneDropdown *infoPane;
|
2017-02-10 17:40:34 +11:00
|
|
|
|
2018-08-22 21:25:44 +10:00
|
|
|
QPoint lastTouchPoint;
|
|
|
|
QPoint lastTouchScreenPoint;
|
|
|
|
int currentTouch = -1;
|
|
|
|
|
2018-09-26 17:12:52 +10:00
|
|
|
tVariantAnimation* barAnim;
|
2018-09-08 16:37:37 +10:00
|
|
|
|
2018-09-19 17:01:34 +10:00
|
|
|
int statusBarPercentage = -2;
|
|
|
|
QTimer* statusBarProgressTimer;
|
|
|
|
int statusBarNormalY;
|
|
|
|
|
|
|
|
QWidget* seperatorWidget;
|
|
|
|
|
2017-02-10 17:40:34 +11:00
|
|
|
QGraphicsOpacityEffect* statusBarOpacityEffect;
|
|
|
|
bool statusBarVisible = false;
|
2016-02-17 17:24:00 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|