2020-09-09 03:06:15 +00:00
|
|
|
// Copyright (c) 2020 Michael Fabian Dirks <info@xaymar.com>
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
|
|
// copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
// SOFTWARE.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "ui-common.hpp"
|
|
|
|
#include "updater.hpp"
|
|
|
|
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-disable.hpp"
|
2020-09-09 03:06:15 +00:00
|
|
|
#include <QAction>
|
2022-08-18 19:18:51 +00:00
|
|
|
#include <QActionGroup>
|
2020-09-09 03:06:15 +00:00
|
|
|
#include <QBoxLayout>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QWidgetAction>
|
|
|
|
#include "ui_updater.h"
|
|
|
|
|
2022-06-11 06:02:41 +00:00
|
|
|
Q_DECLARE_METATYPE(::streamfx::version_stage);
|
2020-09-09 03:06:15 +00:00
|
|
|
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-enable.hpp"
|
2020-09-09 03:06:15 +00:00
|
|
|
|
|
|
|
namespace streamfx::ui {
|
|
|
|
class updater_dialog : public QDialog, public Ui::Updater {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QUrl _update_url;
|
|
|
|
|
|
|
|
public:
|
|
|
|
updater_dialog();
|
|
|
|
~updater_dialog();
|
|
|
|
|
2022-06-11 06:02:41 +00:00
|
|
|
void show(streamfx::version_info current, streamfx::version_info update);
|
2020-09-30 00:20:16 +00:00
|
|
|
void hide();
|
2020-09-09 03:06:15 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
; // Needed by some linters.
|
|
|
|
void on_ok();
|
|
|
|
void on_cancel();
|
|
|
|
};
|
|
|
|
|
|
|
|
class updater : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<streamfx::updater> _updater;
|
|
|
|
|
|
|
|
updater_dialog* _dialog;
|
|
|
|
|
|
|
|
QMessageBox* _gdpr;
|
|
|
|
|
|
|
|
QAction* _cfu;
|
|
|
|
QAction* _cfu_auto;
|
|
|
|
QAction* _channel;
|
|
|
|
QMenu* _channel_menu;
|
|
|
|
QAction* _channel_stable;
|
2022-06-11 06:02:41 +00:00
|
|
|
QAction* _channel_candidate;
|
|
|
|
QAction* _channel_beta;
|
|
|
|
QAction* _channel_alpha;
|
2020-09-09 03:06:15 +00:00
|
|
|
QActionGroup* _channel_group;
|
|
|
|
|
|
|
|
public:
|
|
|
|
updater(QMenu* menu);
|
|
|
|
~updater();
|
|
|
|
|
2020-09-30 00:20:16 +00:00
|
|
|
void create_gdpr_box();
|
|
|
|
|
2020-09-09 03:06:15 +00:00
|
|
|
void on_updater_automation_changed(streamfx::updater&, bool);
|
2022-06-11 06:02:41 +00:00
|
|
|
void on_updater_channel_changed(streamfx::updater&, streamfx::version_stage);
|
2020-09-09 03:06:15 +00:00
|
|
|
void on_updater_refreshed(streamfx::updater&);
|
|
|
|
|
2021-01-21 01:42:56 +00:00
|
|
|
void obs_ready();
|
|
|
|
|
2020-09-09 03:06:15 +00:00
|
|
|
signals:
|
|
|
|
; // Needed by some linters.
|
|
|
|
|
|
|
|
void autoupdate_changed(bool);
|
2022-06-11 06:02:41 +00:00
|
|
|
void channel_changed(streamfx::version_stage);
|
2020-09-09 03:06:15 +00:00
|
|
|
void update_detected();
|
|
|
|
void check_active(bool);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
; // Needed by some liners.
|
|
|
|
|
|
|
|
// Internal
|
|
|
|
void on_autoupdate_changed(bool);
|
2022-06-11 06:02:41 +00:00
|
|
|
void on_channel_changed(streamfx::version_stage);
|
2020-09-09 03:06:15 +00:00
|
|
|
void on_update_detected();
|
|
|
|
void on_check_active(bool);
|
|
|
|
|
|
|
|
// Qt
|
|
|
|
void on_gdpr_button(QAbstractButton*);
|
|
|
|
void on_cfu_triggered(bool);
|
|
|
|
void on_cfu_auto_toggled(bool);
|
|
|
|
void on_channel_group_triggered(QAction*);
|
|
|
|
|
|
|
|
public:
|
|
|
|
static std::shared_ptr<streamfx::ui::updater> instance(QMenu* menu = nullptr);
|
|
|
|
};
|
|
|
|
} // namespace streamfx::ui
|