Skip to content

Commit

Permalink
An update dialog skelton (#364)
Browse files Browse the repository at this point in the history
* An update dialog skelton

* Update update-checker.cpp

* Update plugin-main.c
  • Loading branch information
umireon authored Jul 2, 2023
1 parent 7f30479 commit fc748c9
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ target_sources(
PRIVATE src/plugin-main.c
src/ort-utils/ort-session-utils.cpp
src/obs-utils/obs-utils.cpp
src/update-checker/update-checker.cpp
src/update-checker/UpdateDialog.cpp
src/background-filter-info.c
src/background-filter.cpp
src/enhance-filter.cpp
Expand Down
6 changes: 3 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0",
"CODESIGN_IDENTITY": "$penv{CODESIGN_IDENT}",
"CODESIGN_TEAM": "$penv{CODESIGN_TEAM}",
"ENABLE_FRONTEND_API": false,
"ENABLE_FRONTEND_API": true,
"ENABLE_QT": true
}
},
Expand Down Expand Up @@ -53,7 +53,7 @@
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_SYSTEM_VERSION": "10.0.18363.657",
"ENABLE_FRONTEND_API": false,
"ENABLE_FRONTEND_API": true,
"ENABLE_QT": true
}
},
Expand Down Expand Up @@ -81,7 +81,7 @@
"cacheVariables": {
"QT_VERSION": "6",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"ENABLE_FRONTEND_API": false,
"ENABLE_FRONTEND_API": true,
"ENABLE_QT": true
}
},
Expand Down
2 changes: 2 additions & 0 deletions src/plugin-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ with this program. If not, see <https://www.gnu.org/licenses/>

#include <plugin-support.h>

#include "update-checker/update-checker.h"

OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE(PLUGIN_NAME, "en-US")

Expand Down
10 changes: 10 additions & 0 deletions src/update-checker/UpdateDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "UpdateDialog.hpp"

UpdateDialog::UpdateDialog(QWidget *parent)
: QDialog(parent), layout(new QVBoxLayout)
{
setWindowTitle("Update available!");
setLayout(layout);
QLabel *label = new QLabel("OBS Background Removal: Update available!");
layout->addWidget(label);
}
10 changes: 10 additions & 0 deletions src/update-checker/UpdateDialog.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <QtWidgets>

class UpdateDialog : public QDialog {
Q_OBJECT
public:
UpdateDialog(QWidget *parent = nullptr);

private:
QVBoxLayout *layout;
};
15 changes: 15 additions & 0 deletions src/update-checker/update-checker.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <QTimer>

#include "update-checker.h"
#include "UpdateDialog.hpp"

#include <obs-frontend-api.h>

UpdateDialog *update_dialog;

void check_update(void)
{
update_dialog =
new UpdateDialog((QWidget *)obs_frontend_get_main_window());
QTimer::singleShot(2000, update_dialog, &UpdateDialog::exec);
}
11 changes: 11 additions & 0 deletions src/update-checker/update-checker.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

void check_update(void);

#ifdef __cplusplus
}
#endif

0 comments on commit fc748c9

Please sign in to comment.