Skip to content

Commit

Permalink
Add the batch of release v3.1.1 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-at-bcn committed May 28, 2018
1 parent b9daab8 commit 0029eac
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 62 deletions.
5 changes: 5 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Release Notes

### v3.1.1

- Added ability to notify the user about the new version of the app available.
- Updated the Bytecoin daemons.

### v3.1.0

- Increment the major version to conform with the daemon versioning.
Expand Down
36 changes: 35 additions & 1 deletion src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
#include "checkproofdialog.h"
#include "walletdparamsdialog.h"
#include "questiondialog.h"
#include "filedownloader.h"
#include "version.h"

namespace WalletGUI {

const char VERSION_DATA_URL[] = "https://raw.githubusercontent.com/bcndev/bytecoin-gui/master/LatestStableVersion.txt?1"; // use ?1 trick to force reload and bypass cache

WalletApplication::WalletApplication(int& argc, char** argv)
: QApplication(argc, argv)
, m_systemTrayIcon(new QSystemTrayIcon(this))
Expand All @@ -41,16 +45,21 @@ WalletApplication::WalletApplication(int& argc, char** argv)
, addressBookManager_(nullptr)
, walletd_(nullptr)
, walletModel_(new WalletModel(this))
, downloader_(new FileDownloader(this))
, crashDialog_(new CrashDialog())
, m_isAboutToQuit(false)
{
setApplicationName("bytecoin"); // do not change becasuse it also changes data directory under Mac and Win
setApplicationDisplayName(tr("Bytecoin Wallet"));
setApplicationVersion("2.0.0");
setApplicationVersion(VERSION);
setQuitOnLastWindowClosed(false);
QLocale::setDefault(QLocale::c());
loadFonts();

checkForUpdateTimer_.setInterval(12*60*60*1000); // 12 hours
connect(&checkForUpdateTimer_, &QTimer::timeout, this, &WalletApplication::checkForUpdate);
checkForUpdateTimer_.start();

connect(this, &WalletApplication::createWalletdSignal, this, &WalletApplication::createWalletd, Qt::QueuedConnection);
}

Expand Down Expand Up @@ -130,11 +139,16 @@ bool WalletApplication::init()
connect(this, &WalletApplication::builtinRunSignal, m_mainWindow, &MainWindow::builtinRun);
connect(this, &WalletApplication::aboutToQuit, this, &WalletApplication::prepareToQuit);

connect(downloader_, &FileDownloader::downloaded, this, &WalletApplication::updateReceived);
connect(this, &WalletApplication::updateIsReadySignal, m_mainWindow, &MainWindow::updateIsReady);

if(isFirstRun)
firstRun();
else
// createWalletd();
emit createWalletdSignal(QPrivateSignal{});

checkForUpdate();
return true;
}

Expand Down Expand Up @@ -558,4 +572,24 @@ void WalletApplication::exportKeys()
emit exportKeysSignal(m_mainWindow, QPrivateSignal{});
}

void WalletApplication::checkForUpdate()
{
downloader_->download(QUrl::fromUserInput(VERSION_DATA_URL));
}

void WalletApplication::updateReceived()
{
const QString newVersionStr = downloader_->downloadedData();
const QString currentVersionStr = VERSION;
bool ok = false;
const int newVersion = QString(newVersionStr).remove('.').toInt(&ok);
if (!ok)
return;
ok = false;
const int currentVersion = QString(currentVersionStr).remove('.').toInt(&ok);
Q_ASSERT(ok);
if (newVersion > currentVersion)
emit updateIsReadySignal(newVersionStr);
}

}
7 changes: 7 additions & 0 deletions src/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <QApplication>
#include <QSystemTrayIcon>
#include <QScopedPointer>
#include <QTimer>

#include "rpcapi.h"
#include "walletd.h"
Expand All @@ -25,6 +26,7 @@ class AddressBookManager;
class CrashDialog;

class MainWindow;
class FileDownloader;

class WalletApplication: public QApplication
{
Expand All @@ -46,6 +48,8 @@ class WalletApplication: public QApplication
AddressBookManager* addressBookManager_;
RemoteWalletd* walletd_;
WalletModel* walletModel_;
FileDownloader* downloader_;
QTimer checkForUpdateTimer_;

QScopedPointer<CrashDialog> crashDialog_;
bool m_isAboutToQuit;
Expand All @@ -68,6 +72,7 @@ class WalletApplication: public QApplication
void createWalletdSignal(QPrivateSignal);
void exportViewOnlyKeysSignal(QWidget* parent/*, const QString& exportPath*/, QPrivateSignal);
void exportKeysSignal(QWidget* parent, QPrivateSignal);
void updateIsReadySignal(const QString& newVersion);

public slots:
void createTx(const RpcApi::CreateTransaction::Request& req);
Expand Down Expand Up @@ -103,6 +108,8 @@ private slots:
void requestPasswordWithConfirmation();
void requestPasswordForExport(QProcess* walletd, QString* pass);
void requestWalletdAuth(QAuthenticator* authenticator);
void checkForUpdate();
void updateReceived();

#ifdef Q_OS_MAC
private:
Expand Down
8 changes: 5 additions & 3 deletions src/bytecoin-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TEMPLATE = app
macx: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
macx: ICON = images/bytecoin.icns
win32: RC_ICONS = images/bytecoin.ico
win32: VERSION = 3.18.5.21
win32: VERSION = 3.18.5.24

#QMAKE_CXXFLAGS += -fno-omit-frame-pointer -fsanitize=address,undefined
#LIBS += -lasan -lubsan
Expand Down Expand Up @@ -100,7 +100,8 @@ SOURCES += main.cpp\
createproofdialog.cpp \
checkproofdialog.cpp \
walletdparamsdialog.cpp \
exportkeydialog.cpp
exportkeydialog.cpp \
filedownloader.cpp

HEADERS += mainwindow.h \
signalhandler.h \
Expand Down Expand Up @@ -161,7 +162,8 @@ HEADERS += mainwindow.h \
checkproofdialog.h \
walletdparamsdialog.h \
exportkeydialog.h \
version.h
version.h \
filedownloader.h

FORMS += mainwindow.ui \
overviewframe.ui \
Expand Down
11 changes: 11 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ MainWindow::MainWindow(
{
m_ui->setupUi(this);

m_ui->m_updateLabel->setText("");
m_ui->m_updateLabel->hide();
m_ui->m_viewOnlyLabel->setText("");
setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, this->size(), qApp->desktop()->availableGeometry()));
setWindowIcon(QIcon(":images/bytecoin_lin"));
clearTitle();
Expand Down Expand Up @@ -459,4 +462,12 @@ void MainWindow::exportKeys()
emit exportKeysSignal();
}

void MainWindow::updateIsReady(const QString& newVersion)
{
m_ui->m_updateLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
m_ui->m_updateLabel->setOpenExternalLinks(true);
m_ui->m_updateLabel->setText(QString("New version %1 of Bytecoin wallet is available.").arg(QString("<a href=\"https://bytecoin.org/downloads\">%1</a>").arg(newVersion)));
m_ui->m_updateLabel->show();
}

}
1 change: 1 addition & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class MainWindow : public QMainWindow
Q_SLOT void importKeys();
Q_SLOT void exportViewOnlyKeys();
Q_SLOT void exportKeys();
Q_SLOT void updateIsReady(const QString& newVersion);

protected:
void changeEvent(QEvent* event) override;
Expand Down
124 changes: 74 additions & 50 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,64 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_updateLabel">
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="text">
<string>New version %1 of Bytecoin wallet is available!</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_addressLabel">
<property name="sizePolicy">
Expand All @@ -191,46 +231,33 @@
<item>
<widget class="QLabel" name="m_viewOnlyLabel">
<property name="text">
<string/>
<string>(View Only)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>34</width>
<height>20</height>
</size>
</property>
</spacer>
<layout class="QVBoxLayout" name="verticalLayout_7"/>
</item>
<item>
<spacer name="horizontalSpacer_8">
Expand Down Expand Up @@ -337,9 +364,6 @@
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7"/>
</item>
</layout>
</widget>
</item>
Expand Down
8 changes: 6 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#ifndef VERSION_H
#define VERSION_H

constexpr char VERSION[] = "3.1.0";
namespace WalletGUI {

constexpr char VERSION[] = "3.1.1";
constexpr char VERSION_SUFFIX[] = "stable";
constexpr char REVISION[] = "20180521";
constexpr char REVISION[] = "20180524";

}

#endif // VERSION_H
Loading

0 comments on commit 0029eac

Please sign in to comment.