mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 16:28:14 +00:00
fix multiple minor issues (c-style casts, default branch, etc.)
This commit is contained in:
parent
b4a65c52cc
commit
9deca92e07
8 changed files with 16 additions and 13 deletions
|
@ -49,13 +49,15 @@ namespace {
|
||||||
DaemonManager * DaemonManager::m_instance = nullptr;
|
DaemonManager * DaemonManager::m_instance = nullptr;
|
||||||
QStringList DaemonManager::m_clArgs;
|
QStringList DaemonManager::m_clArgs;
|
||||||
|
|
||||||
DaemonManager *DaemonManager::instance(const QStringList *args)
|
DaemonManager *DaemonManager::instance(const QStringList *args/* = nullptr*/)
|
||||||
{
|
{
|
||||||
if (!m_instance) {
|
if (!m_instance) {
|
||||||
m_instance = new DaemonManager;
|
m_instance = new DaemonManager;
|
||||||
// store command line arguments for later use
|
// store command line arguments for later use
|
||||||
m_clArgs = *args;
|
if (args != nullptr)
|
||||||
m_clArgs.removeFirst();
|
{
|
||||||
|
m_clArgs = *args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_instance;
|
return m_instance;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DaemonManager : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static DaemonManager * instance(const QStringList *args);
|
static DaemonManager * instance(const QStringList *args = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
|
Q_INVOKABLE bool start(const QString &flags, NetworkType::Type nettype, const QString &dataDir = "", const QString &bootstrapNodeAddress = "", bool noSync = false);
|
||||||
Q_INVOKABLE void stopAsync(NetworkType::Type nettype, const QJSValue& callback);
|
Q_INVOKABLE void stopAsync(NetworkType::Type nettype, const QJSValue& callback);
|
||||||
|
|
|
@ -792,7 +792,7 @@ QString Wallet::signMessage(const QString &message, bool filename) const
|
||||||
file.close();
|
file.close();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::string signature = m_walletImpl->signMessage(std::string((const char*)data, size));
|
std::string signature = m_walletImpl->signMessage(std::string(reinterpret_cast<const char*>(data), size));
|
||||||
file.unmap(data);
|
file.unmap(data);
|
||||||
file.close();
|
file.close();
|
||||||
return QString::fromStdString(signature);
|
return QString::fromStdString(signature);
|
||||||
|
@ -828,7 +828,7 @@ bool Wallet::verifySignedMessage(const QString &message, const QString &address,
|
||||||
file.close();
|
file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool ret = m_walletImpl->verifySignedMessage(std::string((const char*)data, size), address.toStdString(), signature.toStdString());
|
bool ret = m_walletImpl->verifySignedMessage(std::string(reinterpret_cast<const char*>(data), size), address.toStdString(), signature.toStdString());
|
||||||
file.unmap(data);
|
file.unmap(data);
|
||||||
file.close();
|
file.close();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -164,10 +164,10 @@ int main(int argc, char *argv[])
|
||||||
isOpenGL = false;
|
isOpenGL = false;
|
||||||
|
|
||||||
// disable "QApplication: invalid style override passed" warning
|
// disable "QApplication: invalid style override passed" warning
|
||||||
if (isDesktop) putenv((char*)"QT_STYLE_OVERRIDE=fusion");
|
if (isDesktop) qputenv("QT_STYLE_OVERRIDE", "fusion");
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
// force platform xcb
|
// force platform xcb
|
||||||
if (isDesktop) putenv((char*)"QT_QPA_PLATFORM=xcb");
|
if (isDesktop) qputenv("QT_QPA_PLATFORM", "xcb");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// enable High DPI scaling
|
// enable High DPI scaling
|
||||||
|
@ -393,8 +393,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// Exclude daemon manager from IOS
|
// Exclude daemon manager from IOS
|
||||||
#ifndef Q_OS_IOS
|
#ifndef Q_OS_IOS
|
||||||
const QStringList arguments = (QStringList) QCoreApplication::arguments().at(0);
|
DaemonManager * daemonManager = DaemonManager::instance();
|
||||||
DaemonManager * daemonManager = DaemonManager::instance(&arguments);
|
|
||||||
engine.rootContext()->setContextProperty("daemonManager", daemonManager);
|
engine.rootContext()->setContextProperty("daemonManager", daemonManager);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,8 @@ QVariant AddressBookModel::data(const QModelIndex &index, int role) const
|
||||||
// Qt doesnt support size_t overload type casting
|
// Qt doesnt support size_t overload type casting
|
||||||
result.setValue(row.getRowId());
|
result.setValue(row.getRowId());
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
qCritical() << "Unimplemented role " << role;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ int SubaddressAccountModel::rowCount(const QModelIndex &) const
|
||||||
|
|
||||||
QVariant SubaddressAccountModel::data(const QModelIndex &index, int role) const
|
QVariant SubaddressAccountModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() < 0 || (unsigned)index.row() >= m_subaddressAccount->count())
|
if (!index.isValid() || index.row() < 0 || static_cast<quint64>(index.row()) >= m_subaddressAccount->count())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
QVariant result;
|
QVariant result;
|
||||||
|
|
|
@ -54,7 +54,7 @@ int SubaddressModel::rowCount(const QModelIndex &) const
|
||||||
|
|
||||||
QVariant SubaddressModel::data(const QModelIndex &index, int role) const
|
QVariant SubaddressModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() < 0 || (unsigned)index.row() >= m_subaddress->count())
|
if (!index.isValid() || index.row() < 0 || static_cast<quint64>(index.row()) >= m_subaddress->count())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
QVariant result;
|
QVariant result;
|
||||||
|
|
|
@ -157,7 +157,7 @@ QVariant WalletKeysFilesModel::data(const QModelIndex & index, int role) const {
|
||||||
else if (role == PathRole)
|
else if (role == PathRole)
|
||||||
return walletKeyFile.path();
|
return walletKeyFile.path();
|
||||||
else if (role == NetworkTypeRole)
|
else if (role == NetworkTypeRole)
|
||||||
return walletKeyFile.networkType();
|
return static_cast<uint>(walletKeyFile.networkType());
|
||||||
else if (role == AddressRole)
|
else if (role == AddressRole)
|
||||||
return walletKeyFile.address();
|
return walletKeyFile.address();
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
Loading…
Reference in a new issue