build: fix all warnings, treat warnings as errors

This commit is contained in:
xiphon
2020-02-16 02:52:53 +00:00
parent eb7fae92ef
commit 98abdaa5d5
21 changed files with 36 additions and 73 deletions

View File

@@ -38,7 +38,7 @@ QPair<bool, QFuture<void>> FutureScheduler::run(std::function<void()> function)
});
}
QPair<bool, QFuture<QJSValueList>> FutureScheduler::run(std::function<QJSValueList() noexcept> function, const QJSValue &callback)
QPair<bool, QFuture<QJSValueList>> FutureScheduler::run(std::function<QJSValueList()> function, const QJSValue &callback)
{
if (!callback.isCallable())
{

View File

@@ -22,20 +22,12 @@ public:
void shutdownWaitForFinished() noexcept;
QPair<bool, QFuture<void>> run(std::function<void()> function) noexcept;
QPair<bool, QFuture<QJSValueList>> run(std::function<QJSValueList() noexcept> function, const QJSValue &callback);
QPair<bool, QFuture<QJSValueList>> run(std::function<QJSValueList()> function, const QJSValue &callback);
private:
bool add() noexcept;
void done() noexcept;
template<typename T>
QFutureWatcher<T> *newWatcher()
{
QFutureWatcher<T> *watcher = new QFutureWatcher<T>();
return watcher;
}
template<typename T>
QPair<bool, QFuture<T>> execute(std::function<QFuture<T>(QFutureWatcher<T> *)> makeFuture) noexcept
{
@@ -43,8 +35,8 @@ private:
{
try
{
auto *watcher = newWatcher<T>();
connect(watcher, &QFutureWatcher<T>::finished, [this, watcher] {
auto *watcher = new QFutureWatcher<T>();
connect(watcher, &QFutureWatcher<T>::finished, [watcher] {
watcher->deleteLater();
});
watcher->setFuture(makeFuture(watcher));

View File

@@ -43,8 +43,8 @@
#include "KeysFiles.h"
WalletKeysFiles::WalletKeysFiles(const qint64 &modified, const qint64 &created, const QString &path, const quint8 &networkType, const QString &address)
: m_modified(modified), m_created(created), m_path(path), m_networkType(networkType), m_address(address)
WalletKeysFiles::WalletKeysFiles(const qint64 &modified, const QString &path, const quint8 &networkType, const QString &address)
: m_modified(modified), m_path(path), m_networkType(networkType), m_address(address)
{
}
@@ -58,11 +58,6 @@ QString WalletKeysFiles::address() const
return m_address;
}
qint64 WalletKeysFiles::created() const
{
return m_created;
}
QString WalletKeysFiles::path() const
{
return m_path;
@@ -134,10 +129,8 @@ void WalletKeysFilesModel::findWallets(const QString &moneroAccountsDir)
const QFileInfo info(wallet);
const QDateTime modifiedAt = info.lastModified();
const QDateTime createdAt = info.created(); // @TODO: QFileInfo::birthTime() >= Qt 5.10
this->addWalletKeysFile(WalletKeysFiles(modifiedAt.toSecsSinceEpoch(),
createdAt.toSecsSinceEpoch(),
info.absoluteFilePath(), networkType, address));
}
}
@@ -167,8 +160,6 @@ QVariant WalletKeysFilesModel::data(const QModelIndex & index, int role) const {
return walletKeyFile.networkType();
else if (role == AddressRole)
return walletKeyFile.address();
else if (role == CreatedRole)
return walletKeyFile.created();
return QVariant();
}
@@ -178,6 +169,5 @@ QHash<int, QByteArray> WalletKeysFilesModel::roleNames() const {
roles[PathRole] = "path";
roles[NetworkTypeRole] = "networktype";
roles[AddressRole] = "address";
roles[CreatedRole] = "created";
return roles;
}

View File

@@ -37,17 +37,15 @@
class WalletKeysFiles
{
public:
WalletKeysFiles(const qint64 &modified, const qint64 &created, const QString &path, const quint8 &networkType, const QString &address);
WalletKeysFiles(const qint64 &modified, const QString &path, const quint8 &networkType, const QString &address);
qint64 modified() const;
qint64 created() const;
QString path() const;
quint8 networkType() const;
QString address() const;
private:
qint64 m_modified;
qint64 m_created;
QString m_path;
quint8 m_networkType;
QString m_address;
@@ -61,8 +59,7 @@ public:
ModifiedRole = Qt::UserRole + 1,
PathRole,
NetworkTypeRole,
AddressRole,
CreatedRole
AddressRole
};
WalletKeysFilesModel(WalletManager *walletManager, QObject *parent = 0);