walletManager: coding conventions

Signed-off-by: Jaquee <jaquee.monero@gmail.com>
This commit is contained in:
Jaquee 2016-11-27 00:16:09 +01:00
parent 0ae3d67750
commit 01549a3040
No known key found for this signature in database
GPG key ID: 384E52B09F45DC39
5 changed files with 24 additions and 27 deletions

View file

@ -108,10 +108,8 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance());
engine.addImageProvider(QLatin1String("qrcode"), new QRCodeImageProvider());
engine.rootContext()->setContextProperty("daemonManager", DaemonManager::instance(QCoreApplication::arguments()));
DaemonManager * daemonManager = DaemonManager::instance(QCoreApplication::arguments());
const QStringList arguments = QCoreApplication::arguments();
DaemonManager * daemonManager = DaemonManager::instance(&arguments);
QObject::connect(&app, SIGNAL(aboutToQuit()), daemonManager, SLOT(closing()));
engine.rootContext()->setContextProperty("daemonManager", daemonManager);

View file

@ -9,15 +9,15 @@
#include <QProcess>
DaemonManager * DaemonManager::m_instance = nullptr;
QStringList DaemonManager::clArgs;
QStringList DaemonManager::m_clArgs;
DaemonManager *DaemonManager::instance(QStringList args)
DaemonManager *DaemonManager::instance(const QStringList *args)
{
if (!m_instance) {
m_instance = new DaemonManager;
// store command line arguments for later use
clArgs = args;
clArgs.removeFirst();
m_clArgs = *args;
m_clArgs.removeFirst();
}
return m_instance;
@ -25,7 +25,6 @@ DaemonManager *DaemonManager::instance(QStringList args)
bool DaemonManager::start()
{
//
QString process;
#ifdef Q_OS_WIN
@ -42,7 +41,7 @@ bool DaemonManager::start()
// prepare command line arguments and pass to monerod
QStringList arguments;
foreach (const QString &str, clArgs) {
foreach (const QString &str, m_clArgs) {
qDebug() << QString(" [%1] ").arg(str);
arguments << str;
}

View file

@ -11,7 +11,7 @@ class DaemonManager : public QObject
public:
static DaemonManager * instance(QStringList args);
static DaemonManager * instance(const QStringList *args);
Q_INVOKABLE bool start();
Q_INVOKABLE bool stop();
@ -34,7 +34,7 @@ private:
explicit DaemonManager(QObject *parent = 0);
static DaemonManager * m_instance;
static QStringList clArgs;
static QStringList m_clArgs;
QProcess *m_daemon;
bool initialized = false;

View file

@ -88,7 +88,7 @@ Wallet::Status Wallet::status() const
return static_cast<Status>(m_walletImpl->status());
}
Wallet::ConnectionStatus Wallet::connected()
Wallet::ConnectionStatus Wallet::connected() const
{
// cache connection status
if (!m_initialized || m_connectionStatusTime.elapsed() / 1000 > m_connectionStatusTtl) {

View file

@ -63,7 +63,7 @@ public:
Status status() const;
//! returns whether the wallet is connected, and version status
ConnectionStatus connected();
ConnectionStatus connected() const;
//! returns true if wallet was ever synchronized
bool synchronized() const;
@ -196,7 +196,7 @@ signals:
// emitted when transaction is created async
void transactionCreated(PendingTransaction * transaction, QString address, QString paymentId, quint32 mixinCount);
void connectionStatusChanged();
void connectionStatusChanged() const;
private:
Wallet(QObject * parent = nullptr);
@ -219,10 +219,10 @@ private:
mutable QTime m_daemonBlockChainTargetHeightTime;
mutable quint64 m_daemonBlockChainTargetHeight;
int m_daemonBlockChainTargetHeightTtl;
ConnectionStatus m_connectionStatus;
mutable ConnectionStatus m_connectionStatus;
int m_connectionStatusTtl;
mutable QTime m_connectionStatusTime;
bool m_initialized;
mutable bool m_initialized;
};