modernize-shrink-to-fit,
modernize-use-auto,
modernize-use-bool-literals,
+ modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-noexcept,
modernize-use-transparent-functors,
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
+CheckOptions:
+ - key: modernize-use-default-member-init.UseAssignment
+ value: 1
#include <QPainter>
QProgressIndicator::QProgressIndicator(QWidget* parent)
- : QWidget(parent),
- m_angle(0),
- m_timerId(-1),
- m_delay(40),
- m_displayedWhenStopped(false),
- m_color(Qt::black)
+ : QWidget(parent)
{
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setFocusPolicy(Qt::NoFocus);
virtual void timerEvent(QTimerEvent * event);
virtual void paintEvent(QPaintEvent * event);
private:
- int m_angle;
- int m_timerId;
- int m_delay;
- bool m_displayedWhenStopped;
- QColor m_color;
+ int m_angle = 0;
+ int m_timerId = -1;
+ int m_delay = 40;
+ bool m_displayedWhenStopped = false;
+ QColor m_color = Qt::black;
};
#endif // QPROGRESSINDICATOR_H
typedef typename T::value_type char_type;
struct State {
- bool inQuote;
- bool inEscape;
- char_type quoteChar;
- State() : inQuote(false), inEscape(false), quoteChar('\0') {}
+ bool inQuote = false;
+ bool inEscape = false;
+ char_type quoteChar = '\0';
};
QTokenizerPrivate(const T& _string, const T& _delims) :
Q_LOGGING_CATEGORY(lcSql, "nextcloud.sync.database.sql", QtInfoMsg)
SqlDatabase::SqlDatabase()
- : _db(nullptr)
- , _errId(0)
{
}
bool openHelper(const QString &filename, int sqliteFlags);
CheckDbResult checkDb();
- sqlite3 *_db;
+ sqlite3 *_db = nullptr;
QString _error; // last error string
- int _errId;
+ int _errId = 0;
friend class SqlQuery;
QSet<SqlQuery *> _queries;
namespace OCC {
SyncJournalFileRecord::SyncJournalFileRecord()
- : _inode(0)
- , _type(ItemTypeSkip)
- , _fileSize(0)
- , _serverHasIgnoredFiles(false)
{
}
QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); }
QByteArray _path;
- quint64 _inode;
- qint64 _modtime;
- ItemType _type;
+ quint64 _inode = 0;
+ qint64 _modtime = 0;
+ ItemType _type = ItemTypeSkip;
QByteArray _etag;
QByteArray _fileId;
- qint64 _fileSize;
+ qint64 _fileSize = 0;
RemotePermissions _remotePerm;
- bool _serverHasIgnoredFiles;
+ bool _serverHasIgnoredFiles = false;
QByteArray _checksumHeader;
QByteArray _e2eMangledName;
};
typedef struct csync_file_stat_s csync_file_stat_t;
struct OCSYNC_EXPORT csync_file_stat_s {
- time_t modtime;
- int64_t size;
- uint64_t inode;
+ time_t modtime = 0;
+ int64_t size = 0;
+ uint64_t inode = 0;
OCC::RemotePermissions remotePerm;
ItemType type BITFIELD(4);
QByteArray checksumHeader;
QByteArray e2eMangledName;
- CSYNC_STATUS error_status;
+ CSYNC_STATUS error_status = CSYNC_STATUS_OK;
- enum csync_instructions_e instruction; /* u32 */
+ enum csync_instructions_e instruction = CSYNC_INSTRUCTION_NONE; /* u32 */
csync_file_stat_s()
- : modtime(0)
- , size(0)
- , inode(0)
- , type(ItemTypeSkip)
+ : type(ItemTypeSkip)
, child_modified(false)
, has_ignored_files(false)
, is_hidden(false)
- , error_status(CSYNC_STATUS_OK)
- , instruction(CSYNC_INSTRUCTION_NONE)
{ }
static std::unique_ptr<csync_file_stat_t> fromSyncJournalFileRecord(const OCC::SyncJournalFileRecord &rec);
ShibbolethCredentials::ShibbolethCredentials()
: AbstractCredentials()
- , _url()
- , _ready(false)
- , _stillValid(false)
- , _browser(nullptr)
- , _keychainMigration(false)
{
}
QUrl _url;
QByteArray prepareCookieData() const;
- bool _ready;
- bool _stillValid;
+ bool _ready = false;
+ bool _stillValid = false;
QPointer<ShibbolethWebView> _browser;
QNetworkCookie _shibCookie;
QString _user;
- bool _keychainMigration;
+ bool _keychainMigration = false;
};
} // namespace OCC
#endif
WebFlowCredentials::WebFlowCredentials()
- : _ready(false)
- , _credentialsValid(false)
- , _keychainMigration(false)
- , _retryOnKeyChainError(false)
{
}
, _clientSslCaCertificates(caCertificates)
, _ready(true)
, _credentialsValid(true)
- , _keychainMigration(false)
- , _retryOnKeyChainError(false)
{
}
QSslCertificate _clientSslCertificate;
QList<QSslCertificate> _clientSslCaCertificates;
- bool _ready;
- bool _credentialsValid;
- bool _keychainMigration;
+ bool _ready = false;
+ bool _credentialsValid = false;
+ bool _keychainMigration = false;
bool _retryOnKeyChainError = true; // true if we haven't done yet any reading from keychain
- WebFlowCredentialsDialog *_askDialog;
+ WebFlowCredentialsDialog *_askDialog = nullptr;
};
} // namespace OCC
ElidedLabel::ElidedLabel(QWidget *parent)
: QLabel(parent)
- , _elideMode(Qt::ElideNone)
{
}
private:
QString _text;
- Qt::TextElideMode _elideMode;
+ Qt::TextElideMode _elideMode = Qt::ElideNone;
};
}
FolderMan::FolderMan(QObject *parent)
: QObject(parent)
- , _currentSyncFolder(nullptr)
- , _syncEnabled(true)
, _lockWatcher(new LockWatcher)
, _navigationPaneHelper(this)
- , _appRestartRequired(false)
{
ASSERT(!_instance);
_instance = this;
QSet<Folder *> _disabledFolders;
Folder::Map _folderMap;
QString _folderConfigPath;
- Folder *_currentSyncFolder;
+ Folder *_currentSyncFolder = nullptr;
QPointer<Folder> _lastSyncFolder;
- bool _syncEnabled;
+ bool _syncEnabled = true;
/// Starts regular etag query jobs
QTimer _etagPollTimer;
QScopedPointer<SocketApi> _socketApi;
NavigationPaneHelper _navigationPaneHelper;
- bool _appRestartRequired;
+ bool _appRestartRequired = false;
static FolderMan *_instance;
explicit FolderMan(QObject *parent = nullptr);
FolderStatusModel::FolderStatusModel(QObject *parent)
: QAbstractItemModel(parent)
- , _accountState(nullptr)
- , _dirty(false)
{
}
private:
QStringList createBlackList(OCC::FolderStatusModel::SubFolderInfo *root,
const QStringList &oldBlackList) const;
- const AccountState *_accountState;
- bool _dirty; // If the selective sync checkboxes were changed
+ const AccountState *_accountState = nullptr;
+ bool _dirty = false; // If the selective sync checkboxes were changed
/**
* Keeps track of items that are fetching data from the server.
GeneralSettings::GeneralSettings(QWidget *parent)
: QWidget(parent)
, _ui(new Ui::GeneralSettings)
- , _currentlyLoading(false)
{
_ui->setupUi(this);
Ui::GeneralSettings *_ui;
QPointer<IgnoreListEditor> _ignoreEditor;
QPointer<SyncLogDialog> _syncLogDialog;
- bool _currentlyLoading;
+ bool _currentlyLoading = false;
};
}
ProxyAuthHandler::ProxyAuthHandler()
- : _blocked(false)
- , _waitingForDialog(0)
- , _waitingForKeychain(0)
- , _keychainJobRunning(false)
{
_dialog = new ProxyAuthDialog();
/// If the user cancels the credential dialog, blocked will be set to
/// true and we won't bother him again.
- bool _blocked;
+ bool _blocked = false;
/// In several instances handleProxyAuthenticationRequired() can be called
/// while it is still running. These counters detect what we're currently
/// waiting for.
- int _waitingForDialog;
- int _waitingForKeychain;
- bool _keychainJobRunning;
+ int _waitingForDialog = 0;
+ int _waitingForKeychain = 0;
+ bool _keychainJobRunning = false;
QPointer<ProxyAuthDialog> _dialog;
}
Systray::Systray()
- : _isOpen(false)
- , _syncIsPaused(false)
- , _trayEngine(new QQmlApplicationEngine(this))
+ : _trayEngine(new QQmlApplicationEngine(this))
{
_trayEngine->addImportPath("qrc:/qml/theme");
_trayEngine->addImageProvider("avatars", new ImageProvider);
private:
static Systray *_instance;
Systray();
- bool _isOpen;
- bool _syncIsPaused;
+ bool _isOpen = false;
+ bool _syncIsPaused = false;
QQmlApplicationEngine *_trayEngine;
};
UserModel::UserModel(QObject *parent)
: QAbstractListModel(parent)
- , _currentUserId()
{
// TODO: Remember selected user from last quit via settings file
if (AccountManager::instance()->accounts().size() > 0) {
static UserModel *_instance;
UserModel(QObject *parent = 0);
QList<User*> _users;
- int _currentUserId;
+ int _currentUserId = 0;
bool _init = true;
void buildUserList();
namespace OCC {
Flow2AuthCredsPage::Flow2AuthCredsPage()
- : AbstractCredentialsWizardPage(),
- _flow2AuthWidget(nullptr)
+ : AbstractCredentialsWizardPage()
{
_layout = new QVBoxLayout(this);
QString _appPassword;
private:
- Flow2AuthWidget *_flow2AuthWidget;
- QVBoxLayout *_layout;
+ Flow2AuthWidget *_flow2AuthWidget = nullptr;
+ QVBoxLayout *_layout = nullptr;
};
} // namespace OCC
Flow2AuthWidget::Flow2AuthWidget(QWidget *parent)
: QWidget(parent)
- , _account(nullptr)
- , _ui()
, _progressIndi(new QProgressIndicator(this))
- , _statusUpdateSkipCount(0)
{
_ui.setupUi(this);
void pollNow();
private:
- Account *_account;
+ Account *_account = nullptr;
QScopedPointer<Flow2Auth> _asyncAuth;
Ui_Flow2AuthWidget _ui;
void customizeStyle();
QProgressIndicator *_progressIndi;
- int _statusUpdateSkipCount;
+ int _statusUpdateSkipCount = 0;
};
} // namespace OCC
OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
: QWizardPage()
- , _ui()
- , _checking(false)
- , _created(false)
- , _localFolderValid(false)
, _progressIndi(new QProgressIndicator(this))
- , _remoteFolder()
- , _rSize(-1)
- , _rSelectedSize(-1)
{
_ui.setupUi(this);
void customizeStyle();
Ui_OwncloudAdvancedSetupPage _ui;
- bool _checking;
- bool _created;
- bool _localFolderValid;
+ bool _checking = false;
+ bool _created = false;
+ bool _localFolderValid = false;
QProgressIndicator *_progressIndi;
QString _remoteFolder;
QStringList _selectiveSyncBlacklist;
- qint64 _rSize;
- qint64 _rSelectedSize;
+ qint64 _rSize = -1;
+ qint64 _rSelectedSize = -1;
};
} // namespace OCC
OwncloudSetupPage::OwncloudSetupPage(QWidget *parent)
: QWizardPage()
- , _ui()
- , _oCUrl()
- , _ocUser()
- , _authTypeKnown(false)
- , _checking(false)
- , _authType(DetermineAuthTypeJob::Basic)
, _progressIndi(new QProgressIndicator(this))
+ , _ocWizard(qobject_cast<OwncloudWizard *>(parent))
{
_ui.setupUi(this);
- _ocWizard = qobject_cast<OwncloudWizard *>(parent);
Theme *theme = Theme::instance();
setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(theme->appNameGUI())));
QString _oCUrl;
QString _ocUser;
- bool _authTypeKnown;
- bool _checking;
- bool _multipleFoldersExist;
- DetermineAuthTypeJob::AuthType _authType;
+ bool _authTypeKnown = false;
+ bool _checking = false;
+ DetermineAuthTypeJob::AuthType _authType = DetermineAuthTypeJob::Basic;
QProgressIndicator *_progressIndi;
- QButtonGroup *_selectiveSyncButtons;
- QString _remoteFolder;
- AddCertificateDialog *addCertDial;
OwncloudWizard *_ocWizard;
+ AddCertificateDialog *addCertDial = nullptr;
};
} // namespace OCC
OwncloudShibbolethCredsPage::OwncloudShibbolethCredsPage()
: AbstractCredentialsWizardPage()
- , _browser(nullptr)
- , _afterInitialSetup(false)
{
}
void setupBrowser();
QPointer<ShibbolethWebView> _browser;
- bool _afterInitialSetup;
+ bool _afterInitialSetup = false;
QNetworkCookie _cookie;
};
, _setupPage(new OwncloudSetupPage(this))
, _httpCredsPage(new OwncloudHttpCredsPage(this))
, _browserCredsPage(new OwncloudOAuthCredsPage)
- , _flow2CredsPage(new Flow2AuthCredsPage)
#ifndef NO_SHIBBOLETH
, _shibbolethCredsPage(new OwncloudShibbolethCredsPage)
#endif
+ , _flow2CredsPage(new Flow2AuthCredsPage)
, _advancedSetupPage(new OwncloudAdvancedSetupPage)
, _resultPage(new OwncloudWizardResultPage)
- , _credentialsPage(nullptr)
, _webViewPage(new WebViewPage(this))
- , _setupLog()
- , _registration(false)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setPage(WizardCommon::Page_ServerSetup, _setupPage);
Flow2AuthCredsPage *_flow2CredsPage;
OwncloudAdvancedSetupPage *_advancedSetupPage;
OwncloudWizardResultPage *_resultPage;
- AbstractCredentialsWizardPage *_credentialsPage;
+ AbstractCredentialsWizardPage *_credentialsPage = nullptr;
WebViewPage *_webViewPage;
QStringList _setupLog;
- bool _registration;
+ bool _registration = false;
friend class OwncloudSetupWizard;
};
OwncloudWizardResultPage::OwncloudWizardResultPage()
: QWizardPage()
- , _localFolder()
- , _remoteFolder()
- , _complete(false)
- , _ui()
{
_ui.setupUi(this);
// no fields to register.
private:
QString _localFolder;
QString _remoteFolder;
- bool _complete;
+ bool _complete = false;
Ui_OwncloudWizardResultPage _ui;
};
Q_LOGGING_CATEGORY(lcCredentials, "nextcloud.sync.credentials", QtInfoMsg)
AbstractCredentials::AbstractCredentials()
- : _account(nullptr)
- , _wasFetched(false)
{
}
void asked();
protected:
- Account *_account;
- bool _wasFetched;
+ Account *_account = nullptr;
+ bool _wasFetched = false;
};
} // namespace OCC
}
HttpCredentials::HttpCredentials()
- : _ready(false)
- , _keychainMigration(false)
{
}
QString _previousPassword;
QString _fetchErrorString;
- bool _ready;
+ bool _ready = false;
QSslKey _clientSslKey;
QSslCertificate _clientSslCertificate;
- bool _keychainMigration;
+ bool _keychainMigration = false;
bool _retryOnKeyChainError = true; // true if we haven't done yet any reading from keychain
};
{
QString path;
QString msg;
- int code;
+ int code = EIO;
std::deque<std::unique_ptr<csync_file_stat_t>> list;
- DiscoveryDirectoryResult()
- : code(EIO)
- {
- }
};
/**
Logger::Logger(QObject *parent)
: QObject(parent)
- , _showTime(true)
- , _logWindowActivated(false)
- , _doFileFlush(false)
- , _logExpire(0)
- , _logDebug(false)
{
qSetMessagePattern("[%{function} \t%{message}");
#ifndef NO_MSG_HANDLER
Logger(QObject *parent = nullptr);
~Logger();
QList<Log> _logs;
- bool _showTime;
- bool _logWindowActivated;
+ bool _showTime = true;
+ bool _logWindowActivated = false;
QFile _logFile;
- bool _doFileFlush;
- int _logExpire;
- bool _logDebug;
+ bool _doFileFlush = false;
+ int _logExpire = 0;
+ bool _logDebug = false;
QScopedPointer<QTextStream> _logstream;
mutable QMutex _mutex;
QString _logDirectory;
*/
struct OWNCLOUDSYNC_EXPORT Progress
{
- Progress()
- : _progressPerSec(0)
- , _prevCompleted(0)
- , _initialSmoothing(1.0)
- , _completed(0)
- , _total(0)
- {
- }
-
/** Returns the estimates about progress per second and eta. */
Estimates estimates() const;
void setCompleted(quint64 completed);
// Updated by update()
- double _progressPerSec;
- quint64 _prevCompleted;
+ double _progressPerSec = 0;
+ quint64 _prevCompleted = 0;
// Used to get to a good value faster when
// progress measurement stats. See update().
- double _initialSmoothing;
+ double _initialSmoothing = 1.0;
// Set and updated by ProgressInfo
- quint64 _completed;
- quint64 _total;
+ quint64 _completed = 0;
+ quint64 _total = 0;
friend class ProgressInfo;
};
, _errorMayBeBlacklisted(false)
, _status(NoStatus)
, _isRestoration(false)
- , _httpErrorCode(0)
- , _affectedItems(1)
- , _instruction(CSYNC_INSTRUCTION_NONE)
- , _modtime(0)
- , _size(0)
- , _inode(0)
- , _previousSize(0)
- , _previousModtime(0)
{
}
// Variables useful to report to the user
Status _status BITFIELD(4);
bool _isRestoration BITFIELD(1); // The original operation was forbidden, and this is a restoration
- quint16 _httpErrorCode;
+ quint16 _httpErrorCode = 0;
RemotePermissions _remotePerm;
QString _errorString; // Contains a string only in case of error
QByteArray _responseTimeStamp;
- quint32 _affectedItems; // the number of affected items by the operation on this item.
+ quint32 _affectedItems = 1; // the number of affected items by the operation on this item.
// usually this value is 1, but for removes on dirs, it might be much higher.
// Variables used by the propagator
- csync_instructions_e _instruction;
+ csync_instructions_e _instruction = CSYNC_INSTRUCTION_NONE;
QString _originalFile; // as it is in the csync tree
- time_t _modtime;
+ time_t _modtime = 0;
QByteArray _etag;
- quint64 _size;
- quint64 _inode;
+ quint64 _size = 0;
+ quint64 _inode = 0;
QByteArray _fileId;
// This is the value for the 'new' side, matching with _size and _modtime.
QByteArray _checksumHeader;
// The size and modtime of the file getting overwritten (on the disk for downloads, on the server for uploads).
- quint64 _previousSize;
- time_t _previousModtime;
+ quint64 _previousSize = 0;
+ time_t _previousModtime = 0;
QString _directDownloadUrl;
QString _directDownloadCookies;
namespace OCC {
SyncFileStatus::SyncFileStatus()
- : _tag(StatusNone)
- , _shared(false)
{
}
QString toSocketAPIString() const;
private:
- SyncFileStatusTag _tag;
- bool _shared;
+ SyncFileStatusTag _tag = StatusNone;
+ bool _shared = false;
};
inline bool operator==(const SyncFileStatus &a, const SyncFileStatus &b)
namespace OCC {
SyncResult::SyncResult()
- : _status(Undefined)
- , _foundFilesNotSynced(false)
- , _folderStructureWasChanged(false)
- , _numNewItems(0)
- , _numRemovedItems(0)
- , _numUpdatedItems(0)
- , _numRenamedItems(0)
- , _numNewConflictItems(0)
- , _numOldConflictItems(0)
- , _numErrorItems(0)
- , _numLockedItems(0)
-
{
}
void processCompletedItem(const SyncFileItemPtr &item);
private:
- Status _status;
+ Status _status = Undefined;
SyncFileItemVector _syncItems;
QDateTime _syncTime;
QString _folder;
* when the sync tool support this...
*/
QStringList _errors;
- bool _foundFilesNotSynced;
- bool _folderStructureWasChanged;
+ bool _foundFilesNotSynced = false;
+ bool _folderStructureWasChanged = false;
// count new, removed and updated items
- int _numNewItems;
- int _numRemovedItems;
- int _numUpdatedItems;
- int _numRenamedItems;
- int _numNewConflictItems;
- int _numOldConflictItems;
- int _numErrorItems;
- int _numLockedItems;
+ int _numNewItems = 0;
+ int _numRemovedItems = 0;
+ int _numUpdatedItems = 0;
+ int _numRenamedItems = 0;
+ int _numNewConflictItems = 0;
+ int _numOldConflictItems = 0;
+ int _numErrorItems = 0;
+ int _numLockedItems = 0;
SyncFileItemPtr _firstItemNew;
SyncFileItemPtr _firstItemDeleted;
Theme::Theme()
: QObject(nullptr)
- , _mono(false)
{
}
Theme &operator=(Theme const &);
static Theme *_instance;
- bool _mono;
+ bool _mono = false;
#ifndef TOKEN_AUTH_ONLY
mutable QHash<QString, QIcon> _iconCache;
#endif