2017-08-05 15:20:02 +10:00
|
|
|
/****************************************
|
2017-11-06 15:35:25 +11:00
|
|
|
*
|
2017-08-05 15:20:02 +10:00
|
|
|
* theShell - Desktop Environment
|
2018-01-08 18:26:23 +11:00
|
|
|
* Copyright (C) 2018 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-11-06 15:35:25 +11:00
|
|
|
*
|
2017-08-05 15:20:02 +10:00
|
|
|
* *************************************/
|
|
|
|
|
2016-03-17 19:46:40 +11:00
|
|
|
#ifndef BACKGROUND_H
|
|
|
|
#define BACKGROUND_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2016-03-29 17:42:24 +11:00
|
|
|
#include <QSettings>
|
2016-05-01 22:01:03 +10:00
|
|
|
#include <QMenu>
|
|
|
|
#include <QDesktopWidget>
|
2016-07-01 14:01:19 +10:00
|
|
|
#include <QSvgRenderer>
|
2018-05-19 01:33:40 +10:00
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkRequest>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QJsonArray>
|
|
|
|
#include <QJsonDocument>
|
2018-05-19 21:28:54 +10:00
|
|
|
#include <QPaintEvent>
|
2016-05-01 22:01:03 +10:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "choosebackground.h"
|
|
|
|
|
2016-06-29 21:29:55 +10:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
2016-05-01 22:01:03 +10:00
|
|
|
class ChooseBackground;
|
2016-03-17 19:46:40 +11:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class Background;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Background : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
public:
|
|
|
|
explicit Background(MainWindow* mainwindow, bool imageGetter, QRect screenGeometry, QWidget *parent = 0);
|
|
|
|
~Background();
|
2016-03-17 19:46:40 +11:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
void show();
|
2016-06-29 21:29:55 +10:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
public slots:
|
2018-05-19 17:44:46 +10:00
|
|
|
void setCommunityBackground(QString background);
|
2016-05-01 22:01:03 +10:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
void getNewCommunityBackground();
|
2016-05-01 22:01:03 +10:00
|
|
|
|
2018-05-19 21:28:54 +10:00
|
|
|
void changeBackground();
|
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
signals:
|
2018-05-19 17:44:46 +10:00
|
|
|
void setAllBackgrounds(QString background);
|
2016-05-01 22:01:03 +10:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
void reloadBackground();
|
2016-05-01 22:01:03 +10:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
private slots:
|
|
|
|
void on_actionOpen_Status_Center_triggered();
|
2016-05-01 22:01:03 +10:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
void on_actionOpen_theShell_Settings_triggered();
|
2016-09-25 22:34:47 +10:00
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
void on_actionChange_Background_triggered();
|
|
|
|
|
|
|
|
void on_Background_customContextMenuRequested(const QPoint &pos);
|
|
|
|
|
|
|
|
void loadCommunityBackgroundMetadata();
|
|
|
|
|
|
|
|
void setTimer();
|
|
|
|
|
2018-05-19 17:44:46 +10:00
|
|
|
void setNewBackgroundTimer();
|
|
|
|
|
2018-05-19 01:33:40 +10:00
|
|
|
private:
|
|
|
|
Ui::Background *ui;
|
|
|
|
|
|
|
|
void reject();
|
|
|
|
bool imageGetter;
|
|
|
|
bool set = false;
|
|
|
|
QSettings settings;
|
2018-05-19 17:44:46 +10:00
|
|
|
int numberDone;
|
2018-05-19 20:14:40 +10:00
|
|
|
QString currentBackground;
|
2018-05-19 21:28:54 +10:00
|
|
|
QRect screenGeometry;
|
2018-05-19 01:33:40 +10:00
|
|
|
|
|
|
|
MainWindow* mainwindow;
|
|
|
|
QNetworkAccessManager manager;
|
|
|
|
QPixmap background;
|
2018-05-19 17:44:46 +10:00
|
|
|
QTimer* timer = nullptr, *newBackgroundTimer = nullptr;
|
2018-05-19 21:28:54 +10:00
|
|
|
|
|
|
|
void paintEvent(QPaintEvent* event);
|
2016-03-17 19:46:40 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BACKGROUND_H
|