Skip to content

Commit 5d7fee5

Browse files
committed
Alhumdulillah! Notify the user is an update is available 🎉
1 parent 01c2fbf commit 5d7fee5

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Change Log
2+
## 1.4.0
3+
* Fixes a serious bug [#26](https://github.com/OpenBangla/OpenBangla-Keyboard/issues/26).
4+
* OpenBangla Keyboard will check for updates automatically and notify the user if an update is available.
25
## 1.3.0
36
* OpenBangla Keyboard now features a Phonetic AutoCorrect Preference Dialog [#20](https://github.com/OpenBangla/OpenBangla-Keyboard/pull/20). User now can view/edit/add AutoCorrect entries.
47
* Better Topbar integration with X11 windowing system and reduce the size of TopBar [#22](https://github.com/OpenBangla/OpenBangla-Keyboard/pull/22).

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ Use iBus UI or run `ibus-setup` to add **OpenBangla Keyboard**. To get help on c
8787
## Acknowledgements
8888
- Mehdi Hasan Khan for originally developing and maintaining Avro Keyboard,
8989
- Rifat Nabi for porting Avro Phonetic to Javascript,
90-
- [Sarim Khan](https://github.com/sarim) for writing ibus-avro.
90+
- [Sarim Khan](https://github.com/sarim) for writing ibus-avro,
91+
- [QSimpleUpdater](https://github.com/alex-spataru/QSimpleUpdater) for providing update mechanism.
9192

9293
## License
9394
Licensed under [GPL 3 Licence](https://opensource.org/licenses/GPL-3.0).

src/frontend/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include_directories(../engine/ ../shared ../engine/libengine)
1+
include_directories(../engine/ ../shared ../engine/libengine 3rdParty)
22
set(CMAKE_AUTOMOC ON)
33
set(CMAKE_AUTOUIC ON)
44
set(CMAKE_AUTORCC ON)

src/frontend/TopBar.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@
3232
#include "SettingsDialog.h"
3333
#include "LayoutConverter.h"
3434
#include "AutoCorrectDialog.h"
35+
#include "QSimpleUpdater.h"
3536
#include "ui_TopBar.h"
3637

38+
static const QString DEFS_URL = "https://raw.githubusercontent.com/OpenBangla/OpenBangla-Keyboard/master/UPDATES.json";
39+
3740
TopBar::TopBar(QWidget *parent) :
3841
QMainWindow(parent),
3942
ui(new Ui::TopBar)
@@ -42,6 +45,7 @@ TopBar::TopBar(QWidget *parent) :
4245

4346
gLayout = new Layout();
4447
gSettings = new Settings();
48+
updater = QSimpleUpdater::getInstance();
4549

4650
/* Dialogs */
4751
aboutDialog = new AboutDialog(this);
@@ -54,6 +58,7 @@ TopBar::TopBar(QWidget *parent) :
5458
SetupTopBar();
5559
SetupPopupMenus();
5660
SetupTrayIcon();
61+
checkForUpdate();
5762
}
5863

5964
TopBar::~TopBar()
@@ -92,6 +97,13 @@ void TopBar::SetupTopBar() {
9297
}
9398
}
9499

100+
void TopBar::checkForUpdate() {
101+
updater->setModuleVersion(DEFS_URL, PROJECT_VERSION);
102+
updater->setNotifyOnUpdate(DEFS_URL, true);
103+
updater->setDownloaderEnabled(DEFS_URL, false);
104+
updater->checkForUpdates(DEFS_URL);
105+
}
106+
95107
void TopBar::SetupPopupMenus() {
96108
// Layout Popup Menu
97109
layoutMenu = new QMenu("Select keyboard layout", this);

src/frontend/TopBar.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class AboutDialog;
3535
class AboutFile;
3636
class SettingsDialog;
3737
class AutoCorrectDialog;
38+
class QSimpleUpdater;
3839

3940
class TopBar : public QMainWindow
4041
{
@@ -81,6 +82,7 @@ private slots:
8182
bool canMoveTopbar;
8283
int pressedMouseX, pressedMouseY;
8384
QSystemTrayIcon *tray;
85+
QSimpleUpdater *updater;
8486

8587
/* Dialogs */
8688
AboutDialog *aboutDialog;
@@ -120,6 +122,7 @@ private slots:
120122
void SetupTopBar();
121123
void SetupPopupMenus();
122124
void SetupTrayIcon();
125+
void checkForUpdate();
123126

124127
void RefreshLayouts();
125128
};

src/frontend/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
int main(int argc, char *argv []) {
2525
QApplication app(argc, argv);
26+
app.setApplicationName("OpenBangla Keyboard");
27+
app.setApplicationVersion(PROJECT_VERSION);
2628

2729
// Prevent many instances of the app to be launched
2830
QString name = "com.openbangla.keyboard";

0 commit comments

Comments
 (0)