diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e9edb09..93dd2b342 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ include(CheckCXXSourceCompiles) option(WITH_TESTS "Enable building of unit tests" ON) option(WITH_GUI_TESTS "Enable building of GUI tests" OFF) option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF) -option(WITH_CXX11 "Build with the C++ 11 standard" ON) set(KEEPASSX_VERSION "2.0 beta 2") set(KEEPASSX_VERSION_NUM "1.9.92") @@ -115,16 +114,24 @@ if(WITH_LTO) endif() endif() -if (WITH_CXX11) - add_gcc_compiler_cxxflags("-std=c++0x") - add_gcc_compiler_cflags("-ansi") - if(APPLE) - add_gcc_compiler_cxxflags("-stdlib=libc++") - endif() +check_cxx_compiler_flag("-std=c++11" CXX11_AVAILABLE) +if (CXX11_AVAILABLE) + add_gcc_compiler_cxxflags("-std=c++11") else() - add_gcc_compiler_flags("-ansi") + check_cxx_compiler_flag("-std=c++0x" CXX0X_AVAILABLE) + if(CXX0X_AVAILABLE) + add_gcc_compiler_cxxflags("-std=c++0x") + else() + message(FATAL_ERROR "Compiler doesn't support C++11") + endif() endif() +if(APPLE) + add_gcc_compiler_cxxflags("-stdlib=libc++") +endif() + +add_gcc_compiler_cflags("-ansi") + if(MINGW) set(CMAKE_RC_COMPILER_INIT windres) enable_language(RC) diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp index 92349dc58..5e22d9204 100644 --- a/src/autotype/AutoType.cpp +++ b/src/autotype/AutoType.cpp @@ -32,7 +32,7 @@ #include "core/Tools.h" #include "gui/MessageBox.h" -AutoType* AutoType::m_instance = Q_NULLPTR; +AutoType* AutoType::m_instance = nullptr; AutoType::AutoType(QObject* parent, bool test) : QObject(parent) @@ -40,8 +40,8 @@ AutoType::AutoType(QObject* parent, bool test) , m_currentGlobalKey(static_cast(0)) , m_currentGlobalModifiers(0) , m_pluginLoader(new QPluginLoader(this)) - , m_plugin(Q_NULLPTR) - , m_executor(Q_NULLPTR) + , m_plugin(nullptr) + , m_executor(nullptr) , m_windowFromGlobal(0) { // prevent crash when the plugin has unresolved symbols @@ -68,7 +68,7 @@ AutoType::~AutoType() { if (m_executor) { delete m_executor; - m_executor = Q_NULLPTR; + m_executor = nullptr; } } @@ -195,11 +195,11 @@ void AutoType::performGlobalAutoType(const QList& dbList) QString message = tr("Couldn't find an entry that matches the window title:"); message.append("\n\n"); message.append(windowTitle); - MessageBox::information(Q_NULLPTR, tr("Auto-Type - KeePassX"), message); + MessageBox::information(nullptr, tr("Auto-Type - KeePassX"), message); } else if ((entryList.size() == 1) && !config()->get("security/autotypeask").toBool()) { m_inAutoType = false; - performAutoType(entryList.first(), Q_NULLPTR, sequenceHash[entryList.first()]); + performAutoType(entryList.first(), nullptr, sequenceHash[entryList.first()]); } else { m_windowFromGlobal = m_plugin->activeWindow(); @@ -219,7 +219,7 @@ void AutoType::performAutoTypeFromGlobal(Entry* entry, const QString& sequence) Q_ASSERT(m_inAutoType); m_inAutoType = false; - performAutoType(entry, Q_NULLPTR, sequence, m_windowFromGlobal); + performAutoType(entry, nullptr, sequence, m_windowFromGlobal); } void AutoType::resetInAutoType() @@ -233,12 +233,12 @@ void AutoType::unloadPlugin() { if (m_executor) { delete m_executor; - m_executor = Q_NULLPTR; + m_executor = nullptr; } if (m_plugin) { m_plugin->unload(); - m_plugin = Q_NULLPTR; + m_plugin = nullptr; } } diff --git a/src/autotype/AutoType.h b/src/autotype/AutoType.h index f3d626c8f..d1c88174c 100644 --- a/src/autotype/AutoType.h +++ b/src/autotype/AutoType.h @@ -22,8 +22,6 @@ #include #include -#include "core/Global.h" - class AutoTypeAction; class AutoTypeExecutor; class AutoTypePlatformInterface; @@ -37,7 +35,7 @@ class AutoType : public QObject public: QStringList windowTitles(); - void performAutoType(const Entry* entry, QWidget* hideWindow = Q_NULLPTR, + void performAutoType(const Entry* entry, QWidget* hideWindow = nullptr, const QString& customSequence = QString(), WId window = 0); bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); void unregisterGlobalShortcut(); @@ -62,7 +60,7 @@ private Q_SLOTS: void unloadPlugin(); private: - explicit AutoType(QObject* parent = Q_NULLPTR, bool test = false); + explicit AutoType(QObject* parent = nullptr, bool test = false); ~AutoType(); void loadPlugin(const QString& pluginPath); bool parseActions(const QString& sequence, const Entry* entry, QList& actions); diff --git a/src/autotype/AutoTypeSelectDialog.h b/src/autotype/AutoTypeSelectDialog.h index 4f455c751..c0dbfe473 100644 --- a/src/autotype/AutoTypeSelectDialog.h +++ b/src/autotype/AutoTypeSelectDialog.h @@ -22,8 +22,6 @@ #include #include -#include "core/Global.h" - class AutoTypeSelectView; class Entry; @@ -32,7 +30,7 @@ class AutoTypeSelectDialog : public QDialog Q_OBJECT public: - explicit AutoTypeSelectDialog(QWidget* parent = Q_NULLPTR); + explicit AutoTypeSelectDialog(QWidget* parent = nullptr); void setEntries(const QList& entries, const QHash& sequences); Q_SIGNALS: diff --git a/src/autotype/AutoTypeSelectView.h b/src/autotype/AutoTypeSelectView.h index bcbb26278..749f6a9f3 100644 --- a/src/autotype/AutoTypeSelectView.h +++ b/src/autotype/AutoTypeSelectView.h @@ -18,7 +18,6 @@ #ifndef KEEPASSX_AUTOTYPESELECTVIEW_H #define KEEPASSX_AUTOTYPESELECTVIEW_H -#include "core/Global.h" #include "gui/entry/EntryView.h" class Entry; @@ -28,10 +27,10 @@ class AutoTypeSelectView : public EntryView Q_OBJECT public: - explicit AutoTypeSelectView(QWidget* parent = Q_NULLPTR); + explicit AutoTypeSelectView(QWidget* parent = nullptr); protected: - void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent* event) override; private Q_SLOTS: void selectFirstEntry(); diff --git a/src/autotype/ShortcutWidget.h b/src/autotype/ShortcutWidget.h index 5ff306c05..60898ab7e 100644 --- a/src/autotype/ShortcutWidget.h +++ b/src/autotype/ShortcutWidget.h @@ -20,21 +20,19 @@ #include -#include "core/Global.h" - class ShortcutWidget : public QLineEdit { Q_OBJECT public: - explicit ShortcutWidget(QWidget* parent = Q_NULLPTR); + explicit ShortcutWidget(QWidget* parent = nullptr); Qt::Key key() const; Qt::KeyboardModifiers modifiers() const; void setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); protected: - void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE; - void keyReleaseEvent(QKeyEvent* event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent* event) override; + void keyReleaseEvent(QKeyEvent* event) override; private: void keyEvent(QKeyEvent* event); diff --git a/src/autotype/WindowSelectComboBox.h b/src/autotype/WindowSelectComboBox.h index 661bc84ea..244119afe 100644 --- a/src/autotype/WindowSelectComboBox.h +++ b/src/autotype/WindowSelectComboBox.h @@ -20,19 +20,17 @@ #include -#include "core/Global.h" - class WindowSelectComboBox : public QComboBox { Q_OBJECT public: - explicit WindowSelectComboBox(QWidget* parent = Q_NULLPTR); + explicit WindowSelectComboBox(QWidget* parent = nullptr); void refreshWindowList(); - void showPopup() Q_DECL_OVERRIDE; - QSize sizeHint() const Q_DECL_OVERRIDE; - QSize minimumSizeHint() const Q_DECL_OVERRIDE; + void showPopup() override; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; }; #endif // KEEPASSX_WINDOWSELECTCOMBOBOX_H diff --git a/src/autotype/test/AutoTypeTest.h b/src/autotype/test/AutoTypeTest.h index 442830a9e..2d652ced4 100644 --- a/src/autotype/test/AutoTypeTest.h +++ b/src/autotype/test/AutoTypeTest.h @@ -23,7 +23,6 @@ #include "autotype/AutoTypePlatformPlugin.h" #include "autotype/AutoTypeAction.h" #include "autotype/test/AutoTypeTestInterface.h" -#include "core/Global.h" class AutoTypePlatformTest : public QObject, public AutoTypePlatformInterface, diff --git a/src/autotype/xcb/AutoTypeXCB.cpp b/src/autotype/xcb/AutoTypeXCB.cpp index 22bd81f9d..bac9e8ca1 100644 --- a/src/autotype/xcb/AutoTypeXCB.cpp +++ b/src/autotype/xcb/AutoTypeXCB.cpp @@ -24,7 +24,7 @@ bool AutoTypePlatformX11::m_catchXErrors = false; bool AutoTypePlatformX11::m_xErrorOccured = false; -int (*AutoTypePlatformX11::m_oldXErrorHandler)(Display*, XErrorEvent*) = Q_NULLPTR; +int (*AutoTypePlatformX11::m_oldXErrorHandler)(Display*, XErrorEvent*) = nullptr; AutoTypePlatformX11::AutoTypePlatformX11() { @@ -46,8 +46,8 @@ AutoTypePlatformX11::AutoTypePlatformX11() m_currentGlobalKey = static_cast(0); m_currentGlobalModifiers = 0; - m_keysymTable = Q_NULLPTR; - m_xkb = Q_NULLPTR; + m_keysymTable = nullptr; + m_xkb = nullptr; m_remapKeycode = 0; m_currentRemapKeysym = NoSymbol; m_modifierMask = ControlMask | ShiftMask | Mod1Mask | Mod4Mask; @@ -94,7 +94,7 @@ WId AutoTypePlatformX11::activeWindow() Window root; Window parent; - Window* children = Q_NULLPTR; + Window* children = nullptr; unsigned int numChildren; tree = XQueryTree(m_dpy, window, &root, &parent, &children, &numChildren); window = parent; @@ -231,7 +231,7 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist) int format; unsigned long nitems; unsigned long after; - unsigned char* data = Q_NULLPTR; + unsigned char* data = nullptr; // the window manager spec says we should read _NET_WM_NAME first, then fall back to WM_NAME @@ -245,7 +245,7 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist) XTextProperty textProp; retVal = XGetTextProperty(m_dpy, window, &textProp, m_atomWmName); if ((retVal != 0) && textProp.value) { - char** textList = Q_NULLPTR; + char** textList = nullptr; int count; if (textProp.encoding == m_atomUtf8String) { @@ -297,8 +297,8 @@ QString AutoTypePlatformX11::windowClassName(Window window) QString className; XClassHint wmClass; - wmClass.res_name = Q_NULLPTR; - wmClass.res_class = Q_NULLPTR; + wmClass.res_name = nullptr; + wmClass.res_class = nullptr; if (XGetClassHint(m_dpy, window, &wmClass) && wmClass.res_name) { className = QString::fromLocal8Bit(wmClass.res_name); @@ -337,7 +337,7 @@ QStringList AutoTypePlatformX11::windowTitlesRecursive(Window window) Window root; Window parent; - Window* children = Q_NULLPTR; + Window* children = nullptr; unsigned int numChildren; if (XQueryTree(m_dpy, window, &root, &parent, &children, &numChildren) && children) { for (uint i = 0; i < numChildren; i++) { @@ -357,7 +357,7 @@ bool AutoTypePlatformX11::isTopLevelWindow(Window window) int format; unsigned long nitems; unsigned long after; - unsigned char* data = Q_NULLPTR; + unsigned char* data = nullptr; int retVal = XGetWindowProperty(m_dpy, window, m_atomWmState, 0, 0, false, AnyPropertyType, &type, &format, &nitems, &after, &data); if (data) { @@ -512,7 +512,7 @@ void AutoTypePlatformX11::updateKeymap() timespec ts; ts.tv_sec = 0; ts.tv_nsec = 30 * 1000 * 1000; - nanosleep(&ts, Q_NULLPTR); + nanosleep(&ts, nullptr); } bool AutoTypePlatformX11::isRemapKeycodeValid() diff --git a/src/autotype/xcb/AutoTypeXCB.h b/src/autotype/xcb/AutoTypeXCB.h index 973c40a55..46af6ed9b 100644 --- a/src/autotype/xcb/AutoTypeXCB.h +++ b/src/autotype/xcb/AutoTypeXCB.h @@ -31,7 +31,6 @@ #include "autotype/AutoTypePlatformPlugin.h" #include "autotype/AutoTypeAction.h" -#include "core/Global.h" #define N_MOD_INDICES (Mod5MapIndex + 1) @@ -43,7 +42,7 @@ class AutoTypePlatformX11 : public QObject, public AutoTypePlatformInterface public: AutoTypePlatformX11(); - void unload() Q_DECL_OVERRIDE; + void unload() override; QStringList windowTitles(); WId activeWindow(); QString activeWindowTitle(); diff --git a/src/core/AutoTypeAssociations.h b/src/core/AutoTypeAssociations.h index 1b5871b3e..491a5db1c 100644 --- a/src/core/AutoTypeAssociations.h +++ b/src/core/AutoTypeAssociations.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class AutoTypeAssociations : public QObject { Q_OBJECT @@ -36,7 +34,7 @@ public: bool operator!=(const AutoTypeAssociations::Association& other) const; }; - explicit AutoTypeAssociations(QObject* parent = Q_NULLPTR); + explicit AutoTypeAssociations(QObject* parent = nullptr); void copyDataFrom(const AutoTypeAssociations* other); void add(const AutoTypeAssociations::Association& association); void remove(int index); diff --git a/src/core/Config.cpp b/src/core/Config.cpp index a93926dc9..b2dd125b5 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -23,7 +23,7 @@ #include #include -Config* Config::m_instance(Q_NULLPTR); +Config* Config::m_instance(nullptr); QVariant Config::get(const QString& key) { diff --git a/src/core/Config.h b/src/core/Config.h index ca0f74cb5..09aa02fb1 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -21,8 +21,6 @@ #include #include -#include "core/Global.h" - class QSettings; class Config : public QObject diff --git a/src/core/Database.cpp b/src/core/Database.cpp index a020e028f..6f9423570 100644 --- a/src/core/Database.cpp +++ b/src/core/Database.cpp @@ -104,7 +104,7 @@ Entry* Database::recFindEntry(const Uuid& uuid, Group* group) } } - return Q_NULLPTR; + return nullptr; } Group* Database::resolveGroup(const Uuid& uuid) @@ -125,7 +125,7 @@ Group* Database::recFindGroup(const Uuid& uuid, Group* group) } } - return Q_NULLPTR; + return nullptr; } QList Database::deletedObjects() diff --git a/src/core/DatabaseIcons.cpp b/src/core/DatabaseIcons.cpp index d6e816fb9..4e62f79e4 100644 --- a/src/core/DatabaseIcons.cpp +++ b/src/core/DatabaseIcons.cpp @@ -19,7 +19,7 @@ #include "core/FilePath.h" -DatabaseIcons* DatabaseIcons::m_instance(Q_NULLPTR); +DatabaseIcons* DatabaseIcons::m_instance(nullptr); const int DatabaseIcons::IconCount(69); const int DatabaseIcons::ExpiredIconIndex(45); const char* const DatabaseIcons::m_indexToName[] = { diff --git a/src/core/DatabaseIcons.h b/src/core/DatabaseIcons.h index 68d1e0cb0..a1d9480b6 100644 --- a/src/core/DatabaseIcons.h +++ b/src/core/DatabaseIcons.h @@ -23,8 +23,6 @@ #include #include -#include "core/Global.h" - class DatabaseIcons { public: diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index 19c42e20c..754e6c443 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -28,7 +28,7 @@ Entry::Entry() : m_attributes(new EntryAttributes(this)) , m_attachments(new EntryAttachments(this)) , m_autoTypeAssociations(new AutoTypeAssociations(this)) - , m_tmpHistoryItem(Q_NULLPTR) + , m_tmpHistoryItem(nullptr) , m_modifiedSinceBegin(false) , m_updateTimeinfo(true) { @@ -513,7 +513,7 @@ void Entry::endUpdate() delete m_tmpHistoryItem; } - m_tmpHistoryItem = Q_NULLPTR; + m_tmpHistoryItem = nullptr; } void Entry::updateModifiedSinceBegin() @@ -574,7 +574,7 @@ const Database* Entry::database() const return m_group->database(); } else { - return Q_NULLPTR; + return nullptr; } } diff --git a/src/core/Entry.h b/src/core/Entry.h index ae07ed453..0893ab614 100644 --- a/src/core/Entry.h +++ b/src/core/Entry.h @@ -30,7 +30,6 @@ #include "core/AutoTypeAssociations.h" #include "core/EntryAttachments.h" #include "core/EntryAttributes.h" -#include "core/Global.h" #include "core/TimeInfo.h" #include "core/Uuid.h" diff --git a/src/core/EntryAttachments.h b/src/core/EntryAttachments.h index 3446b315c..903ca10bb 100644 --- a/src/core/EntryAttachments.h +++ b/src/core/EntryAttachments.h @@ -21,14 +21,12 @@ #include #include -#include "core/Global.h" - class EntryAttachments : public QObject { Q_OBJECT public: - explicit EntryAttachments(QObject* parent = Q_NULLPTR); + explicit EntryAttachments(QObject* parent = nullptr); QList keys() const; bool hasKey(const QString& key) const; QList values() const; diff --git a/src/core/EntryAttributes.h b/src/core/EntryAttributes.h index 334eb0ab3..c6bbf298d 100644 --- a/src/core/EntryAttributes.h +++ b/src/core/EntryAttributes.h @@ -23,14 +23,12 @@ #include #include -#include "core/Global.h" - class EntryAttributes : public QObject { Q_OBJECT public: - explicit EntryAttributes(QObject* parent = Q_NULLPTR); + explicit EntryAttributes(QObject* parent = nullptr); QList keys() const; bool hasKey(const QString& key) const; QList customKeys(); diff --git a/src/core/FilePath.cpp b/src/core/FilePath.cpp index 0a356a417..8eabb1737 100644 --- a/src/core/FilePath.cpp +++ b/src/core/FilePath.cpp @@ -23,7 +23,7 @@ #include "config-keepassx.h" -FilePath* FilePath::m_instance(Q_NULLPTR); +FilePath* FilePath::m_instance(nullptr); QString FilePath::dataPath(const QString& name) { diff --git a/src/core/FilePath.h b/src/core/FilePath.h index 9e98d3e39..c37a90887 100644 --- a/src/core/FilePath.h +++ b/src/core/FilePath.h @@ -22,8 +22,6 @@ #include #include -#include "core/Global.h" - class FilePath { public: diff --git a/src/core/Group.cpp b/src/core/Group.cpp index 8d81dc5c7..84b4011ca 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -371,7 +371,7 @@ void Group::setParent(Database* db) cleanupParent(); - m_parent = Q_NULLPTR; + m_parent = nullptr; recSetDatabase(db); QObject::setParent(db); diff --git a/src/core/InactivityTimer.h b/src/core/InactivityTimer.h index e0a21e081..ba571a5ef 100644 --- a/src/core/InactivityTimer.h +++ b/src/core/InactivityTimer.h @@ -21,8 +21,6 @@ #include #include -#include "core/Global.h" - class QTimer; class InactivityTimer : public QObject @@ -30,7 +28,7 @@ class InactivityTimer : public QObject Q_OBJECT public: - explicit InactivityTimer(QObject* parent = Q_NULLPTR); + explicit InactivityTimer(QObject* parent = nullptr); void setInactivityTimeout(int inactivityTimeout); void activate(); void deactivate(); diff --git a/src/core/Metadata.h b/src/core/Metadata.h index 4164fb63e..cb8294a39 100644 --- a/src/core/Metadata.h +++ b/src/core/Metadata.h @@ -24,7 +24,6 @@ #include #include -#include "core/Global.h" #include "core/Uuid.h" class Database; @@ -35,7 +34,7 @@ class Metadata : public QObject Q_OBJECT public: - explicit Metadata(QObject* parent = Q_NULLPTR); + explicit Metadata(QObject* parent = nullptr); struct MetadataData { diff --git a/src/core/PasswordGenerator.h b/src/core/PasswordGenerator.h index 6a9d21245..cc8196f55 100644 --- a/src/core/PasswordGenerator.h +++ b/src/core/PasswordGenerator.h @@ -22,8 +22,6 @@ #include #include -#include "core/Global.h" - typedef QVector PasswordGroup; class PasswordGenerator diff --git a/src/core/SignalMultiplexer.cpp b/src/core/SignalMultiplexer.cpp index a70e9efcc..ebf38bf64 100644 --- a/src/core/SignalMultiplexer.cpp +++ b/src/core/SignalMultiplexer.cpp @@ -24,7 +24,7 @@ SignalMultiplexer::SignalMultiplexer() SignalMultiplexer::~SignalMultiplexer() { // disconnect all connections - setCurrentObject(Q_NULLPTR); + setCurrentObject(nullptr); } QObject* SignalMultiplexer::currentObject() const diff --git a/src/core/SignalMultiplexer.h b/src/core/SignalMultiplexer.h index 6d39cd5bb..b27e1f3a6 100644 --- a/src/core/SignalMultiplexer.h +++ b/src/core/SignalMultiplexer.h @@ -21,8 +21,6 @@ #include #include -#include "core/Global.h" - class SignalMultiplexer { public: diff --git a/src/core/Tools.cpp b/src/core/Tools.cpp index 009d226cd..ee0b09577 100644 --- a/src/core/Tools.cpp +++ b/src/core/Tools.cpp @@ -161,7 +161,7 @@ void sleep(int ms) timespec ts; ts.tv_sec = ms / 1000; ts.tv_nsec = (ms % 1000) * 1000 * 1000; - nanosleep(&ts, Q_NULLPTR); + nanosleep(&ts, nullptr); #endif } diff --git a/src/core/Tools.h b/src/core/Tools.h index 07341da02..19c6094b8 100644 --- a/src/core/Tools.h +++ b/src/core/Tools.h @@ -22,8 +22,6 @@ #include #include -#include "core/Global.h" - class QIODevice; namespace Tools { diff --git a/src/crypto/Crypto.cpp b/src/crypto/Crypto.cpp index 24422602f..d39d12aa0 100644 --- a/src/crypto/Crypto.cpp +++ b/src/crypto/Crypto.cpp @@ -74,18 +74,18 @@ bool Crypto::backendSelfTest() bool Crypto::checkAlgorithms() { - if (gcry_cipher_algo_info(GCRY_CIPHER_AES256, GCRYCTL_TEST_ALGO, Q_NULLPTR, Q_NULLPTR) != 0) { + if (gcry_cipher_algo_info(GCRY_CIPHER_AES256, GCRYCTL_TEST_ALGO, nullptr, nullptr) != 0) { m_errorStr = "GCRY_CIPHER_AES256 not found."; qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr)); return false; } - if (gcry_cipher_algo_info(GCRY_CIPHER_TWOFISH, GCRYCTL_TEST_ALGO, Q_NULLPTR, Q_NULLPTR) != 0) { + if (gcry_cipher_algo_info(GCRY_CIPHER_TWOFISH, GCRYCTL_TEST_ALGO, nullptr, nullptr) != 0) { m_errorStr = "GCRY_CIPHER_TWOFISH not found."; qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr)); return false; } #ifdef GCRYPT_HAS_SALSA20 - if (gcry_cipher_algo_info(GCRY_CIPHER_SALSA20, GCRYCTL_TEST_ALGO, Q_NULLPTR, Q_NULLPTR) != 0) { + if (gcry_cipher_algo_info(GCRY_CIPHER_SALSA20, GCRYCTL_TEST_ALGO, nullptr, nullptr) != 0) { m_errorStr = "GCRY_CIPHER_SALSA20 not found."; qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr)); return false; diff --git a/src/crypto/Crypto.h b/src/crypto/Crypto.h index b801cbb54..e6187c28a 100644 --- a/src/crypto/Crypto.h +++ b/src/crypto/Crypto.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class Crypto { public: diff --git a/src/crypto/Random.cpp b/src/crypto/Random.cpp index 2a375f3b1..dc0667fae 100644 --- a/src/crypto/Random.cpp +++ b/src/crypto/Random.cpp @@ -19,15 +19,16 @@ #include +#include "core/Global.h" #include "crypto/Crypto.h" class RandomBackendGcrypt : public RandomBackend { public: - void randomize(void* data, int len) Q_DECL_OVERRIDE; + void randomize(void* data, int len) override; }; -Random* Random::m_instance(Q_NULLPTR); +Random* Random::m_instance(nullptr); void Random::randomize(QByteArray& ba) { diff --git a/src/crypto/SymmetricCipher.cpp b/src/crypto/SymmetricCipher.cpp index 37b7aadbe..12ec264f5 100644 --- a/src/crypto/SymmetricCipher.cpp +++ b/src/crypto/SymmetricCipher.cpp @@ -65,7 +65,7 @@ SymmetricCipherBackend* SymmetricCipher::createBackend(SymmetricCipher::Algorith default: Q_ASSERT(false); - return Q_NULLPTR; + return nullptr; } } diff --git a/src/crypto/SymmetricCipher.h b/src/crypto/SymmetricCipher.h index b8b3eb130..4fc06b7de 100644 --- a/src/crypto/SymmetricCipher.h +++ b/src/crypto/SymmetricCipher.h @@ -22,7 +22,6 @@ #include #include -#include "core/Global.h" #include "crypto/SymmetricCipherBackend.h" class SymmetricCipher diff --git a/src/crypto/SymmetricCipherGcrypt.cpp b/src/crypto/SymmetricCipherGcrypt.cpp index 585f3ab4d..cd4324065 100644 --- a/src/crypto/SymmetricCipherGcrypt.cpp +++ b/src/crypto/SymmetricCipherGcrypt.cpp @@ -22,7 +22,7 @@ SymmetricCipherGcrypt::SymmetricCipherGcrypt(SymmetricCipher::Algorithm algo, SymmetricCipher::Mode mode, SymmetricCipher::Direction direction) - : m_ctx(Q_NULLPTR) + : m_ctx(nullptr) , m_algo(gcryptAlgo(algo)) , m_mode(gcryptMode(mode)) , m_direction(direction) @@ -93,7 +93,7 @@ bool SymmetricCipherGcrypt::init() } size_t blockSizeT; - error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, Q_NULLPTR, &blockSizeT); + error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, nullptr, &blockSizeT); if (error != 0) { setErrorString(error); return false; @@ -161,10 +161,10 @@ bool SymmetricCipherGcrypt::processInPlace(QByteArray& data) gcry_error_t error; if (m_direction == SymmetricCipher::Decrypt) { - error = gcry_cipher_decrypt(m_ctx, data.data(), data.size(), Q_NULLPTR, 0); + error = gcry_cipher_decrypt(m_ctx, data.data(), data.size(), nullptr, 0); } else { - error = gcry_cipher_encrypt(m_ctx, data.data(), data.size(), Q_NULLPTR, 0); + error = gcry_cipher_encrypt(m_ctx, data.data(), data.size(), nullptr, 0); } if (error != 0) { @@ -186,7 +186,7 @@ bool SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds) if (m_direction == SymmetricCipher::Decrypt) { for (quint64 i = 0; i != rounds; ++i) { - error = gcry_cipher_decrypt(m_ctx, rawData, size, Q_NULLPTR, 0); + error = gcry_cipher_decrypt(m_ctx, rawData, size, nullptr, 0); if (error != 0) { setErrorString(error); @@ -196,7 +196,7 @@ bool SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds) } else { for (quint64 i = 0; i != rounds; ++i) { - error = gcry_cipher_encrypt(m_ctx, rawData, size, Q_NULLPTR, 0); + error = gcry_cipher_encrypt(m_ctx, rawData, size, nullptr, 0); if (error != 0) { setErrorString(error); diff --git a/src/format/KeePass1Reader.cpp b/src/format/KeePass1Reader.cpp index 929632bf0..24a944293 100644 --- a/src/format/KeePass1Reader.cpp +++ b/src/format/KeePass1Reader.cpp @@ -49,9 +49,9 @@ private: KeePass1Reader::KeePass1Reader() - : m_db(Q_NULLPTR) - , m_tmpParent(Q_NULLPTR) - , m_device(Q_NULLPTR) + : m_db(nullptr) + , m_tmpParent(nullptr) + , m_device(nullptr) , m_encryptionFlags(0) , m_transformRounds(0) , m_error(false) @@ -72,16 +72,16 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor if (keyfileData.isEmpty()) { raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString())); - return Q_NULLPTR; + return nullptr; } if (!keyfileDevice->seek(0)) { raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString())); - return Q_NULLPTR; + return nullptr; } if (!newFileKey.load(keyfileDevice)) { raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString())); - return Q_NULLPTR; + return nullptr; } } @@ -96,72 +96,72 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor quint32 signature1 = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok || signature1 != KeePass1::SIGNATURE_1) { raiseError(tr("Not a KeePass database.")); - return Q_NULLPTR; + return nullptr; } quint32 signature2 = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok || signature2 != KeePass1::SIGNATURE_2) { raiseError(tr("Not a KeePass database.")); - return Q_NULLPTR; + return nullptr; } m_encryptionFlags = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok || !(m_encryptionFlags & KeePass1::Rijndael || m_encryptionFlags & KeePass1::Twofish)) { raiseError(tr("Unsupported encryption algorithm.")); - return Q_NULLPTR; + return nullptr; } quint32 version = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok || (version & KeePass1::FILE_VERSION_CRITICAL_MASK) != (KeePass1::FILE_VERSION & KeePass1::FILE_VERSION_CRITICAL_MASK)) { raiseError(tr("Unsupported KeePass database version.")); - return Q_NULLPTR; + return nullptr; } m_masterSeed = m_device->read(16); if (m_masterSeed.size() != 16) { raiseError("Unable to read master seed"); - return Q_NULLPTR; + return nullptr; } m_encryptionIV = m_device->read(16); if (m_encryptionIV.size() != 16) { raiseError("Unable to read encryption IV"); - return Q_NULLPTR; + return nullptr; } quint32 numGroups = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok) { raiseError("Invalid number of groups"); - return Q_NULLPTR; + return nullptr; } quint32 numEntries = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok) { raiseError("Invalid number of entries"); - return Q_NULLPTR; + return nullptr; } m_contentHashHeader = m_device->read(32); if (m_contentHashHeader.size() != 32) { raiseError("Invalid content hash size"); - return Q_NULLPTR; + return nullptr; } m_transformSeed = m_device->read(32); if (m_transformSeed.size() != 32) { raiseError("Invalid transform seed size"); - return Q_NULLPTR; + return nullptr; } m_transformRounds = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); if (!ok) { raiseError("Invalid number of transform rounds"); - return Q_NULLPTR; + return nullptr; } if (!m_db->setTransformRounds(m_transformRounds)) { raiseError(tr("Unable to calculate master key")); - return Q_NULLPTR; + return nullptr; } qint64 contentPos = m_device->pos(); @@ -169,14 +169,14 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor QScopedPointer cipherStream(testKeys(password, keyfileData, contentPos)); if (!cipherStream) { - return Q_NULLPTR; + return nullptr; } QList groups; for (quint32 i = 0; i < numGroups; i++) { Group* group = readGroup(cipherStream.data()); if (!group) { - return Q_NULLPTR; + return nullptr; } groups.append(group); } @@ -185,14 +185,14 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor for (quint32 i = 0; i < numEntries; i++) { Entry* entry = readEntry(cipherStream.data()); if (!entry) { - return Q_NULLPTR; + return nullptr; } entries.append(entry); } if (!constructGroupTree(groups)) { raiseError("Unable to construct group tree"); - return Q_NULLPTR; + return nullptr; } Q_FOREACH (Entry* entry, entries) { @@ -243,7 +243,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor if (!db->setKey(key)) { raiseError(tr("Unable to calculate master key")); - return Q_NULLPTR; + return nullptr; } return db.take(); @@ -257,7 +257,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor keyFile.reset(new QFile(keyfileName)); if (!keyFile->open(QFile::ReadOnly)) { raiseError(keyFile->errorString()); - return Q_NULLPTR; + return nullptr; } } @@ -272,14 +272,14 @@ Database* KeePass1Reader::readDatabase(const QString& filename, const QString& p QFile dbFile(filename); if (!dbFile.open(QFile::ReadOnly)) { raiseError(dbFile.errorString()); - return Q_NULLPTR; + return nullptr; } Database* db = readDatabase(&dbFile, password, keyfileName); if (dbFile.error() != QFile::NoError) { raiseError(dbFile.errorString()); - return Q_NULLPTR; + return nullptr; } return db; @@ -337,7 +337,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q QByteArray finalKey = key(passwordData, keyfileData); if (finalKey.isEmpty()) { - return Q_NULLPTR; + return nullptr; } if (m_encryptionFlags & KeePass1::Rijndael) { cipherStream.reset(new SymmetricCipherStream(m_device, SymmetricCipher::Aes256, @@ -350,11 +350,11 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q if (!cipherStream->init(finalKey, m_encryptionIV)) { raiseError(cipherStream->errorString()); - return Q_NULLPTR; + return nullptr; } if (!cipherStream->open(QIODevice::ReadOnly)) { raiseError(cipherStream->errorString()); - return Q_NULLPTR; + return nullptr; } bool success = verifyKey(cipherStream.data()); @@ -368,7 +368,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q } raiseError(msg); - return Q_NULLPTR; + return nullptr; } cipherStream->open(QIODevice::ReadOnly); @@ -442,19 +442,19 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) quint16 fieldType = Endian::readUInt16(cipherStream, KeePass1::BYTEORDER, &ok); if (!ok) { raiseError("Invalid group field type number"); - return Q_NULLPTR; + return nullptr; } int fieldSize = static_cast(Endian::readUInt32(cipherStream, KeePass1::BYTEORDER, &ok)); if (!ok) { raiseError("Invalid group field size"); - return Q_NULLPTR; + return nullptr; } QByteArray fieldData = cipherStream->read(fieldSize); if (fieldData.size() != fieldSize) { raiseError("Read group field data doesn't match size"); - return Q_NULLPTR; + return nullptr; } switch (fieldType) { @@ -464,7 +464,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) case 0x0001: if (fieldSize != 4) { raiseError("Incorrect group id field size"); - return Q_NULLPTR; + return nullptr; } groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER); groupIdSet = true; @@ -476,7 +476,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) { if (fieldSize != 5) { raiseError("Incorrect group creation time field size"); - return Q_NULLPTR; + return nullptr; } QDateTime dateTime = dateFromPackedStruct(fieldData); if (dateTime.isValid()) { @@ -488,7 +488,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) { if (fieldSize != 5) { raiseError("Incorrect group modification time field size"); - return Q_NULLPTR; + return nullptr; } QDateTime dateTime = dateFromPackedStruct(fieldData); if (dateTime.isValid()) { @@ -523,7 +523,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) { if (fieldSize != 4) { raiseError("Incorrect group icon field size"); - return Q_NULLPTR; + return nullptr; } quint32 iconNumber = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER); group->setIcon(iconNumber); @@ -533,7 +533,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) { if (fieldSize != 2) { raiseError("Incorrect group level field size"); - return Q_NULLPTR; + return nullptr; } groupLevel = Endian::bytesToUInt16(fieldData, KeePass1::BYTEORDER); groupLevelSet = true; @@ -548,13 +548,13 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream) default: // invalid field raiseError("Invalid group field type"); - return Q_NULLPTR; + return nullptr; } } while (!reachedEnd); if (!groupIdSet || !groupLevelSet) { raiseError("Missing group id or level"); - return Q_NULLPTR; + return nullptr; } group->setUuid(Uuid::random()); @@ -580,19 +580,19 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) quint16 fieldType = Endian::readUInt16(cipherStream, KeePass1::BYTEORDER, &ok); if (!ok) { raiseError("Missing entry field type number"); - return Q_NULLPTR; + return nullptr; } int fieldSize = static_cast(Endian::readUInt32(cipherStream, KeePass1::BYTEORDER, &ok)); if (!ok) { raiseError("Invalid entry field size"); - return Q_NULLPTR; + return nullptr; } QByteArray fieldData = cipherStream->read(fieldSize); if (fieldData.size() != fieldSize) { raiseError("Read entry field data doesn't match size"); - return Q_NULLPTR; + return nullptr; } switch (fieldType) { @@ -602,7 +602,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) case 0x0001: if (fieldSize != 16) { raiseError("Invalid entry uuid field size"); - return Q_NULLPTR; + return nullptr; } m_entryUuids.insert(fieldData, entry.data()); break; @@ -610,7 +610,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) { if (fieldSize != 4) { raiseError("Invalid entry group id field size"); - return Q_NULLPTR; + return nullptr; } quint32 groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER); m_entryGroupIds.insert(entry.data(), groupId); @@ -620,7 +620,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) { if (fieldSize != 4) { raiseError("Invalid entry icon field size"); - return Q_NULLPTR; + return nullptr; } quint32 iconNumber = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER); entry->setIcon(iconNumber); @@ -645,7 +645,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) { if (fieldSize != 5) { raiseError("Invalid entry creation time field size"); - return Q_NULLPTR; + return nullptr; } QDateTime dateTime = dateFromPackedStruct(fieldData); if (dateTime.isValid()) { @@ -657,7 +657,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) { if (fieldSize != 5) { raiseError("Invalid entry modification time field size"); - return Q_NULLPTR; + return nullptr; } QDateTime dateTime = dateFromPackedStruct(fieldData); if (dateTime.isValid()) { @@ -669,7 +669,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) { if (fieldSize != 5) { raiseError("Invalid entry creation time field size"); - return Q_NULLPTR; + return nullptr; } QDateTime dateTime = dateFromPackedStruct(fieldData); if (dateTime.isValid()) { @@ -681,7 +681,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) { if (fieldSize != 5) { raiseError("Invalid entry expiry time field size"); - return Q_NULLPTR; + return nullptr; } QDateTime dateTime = dateFromPackedStruct(fieldData); if (dateTime.isValid()) { @@ -704,7 +704,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream) default: // invalid field raiseError("Invalid entry field type"); - return Q_NULLPTR; + return nullptr; } } while (!reachedEnd); diff --git a/src/format/KeePass2Reader.cpp b/src/format/KeePass2Reader.cpp index 2a25001c6..a3f58dd31 100644 --- a/src/format/KeePass2Reader.cpp +++ b/src/format/KeePass2Reader.cpp @@ -33,12 +33,12 @@ #include "streams/SymmetricCipherStream.h" KeePass2Reader::KeePass2Reader() - : m_device(Q_NULLPTR) - , m_headerStream(Q_NULLPTR) + : m_device(nullptr) + , m_headerStream(nullptr) , m_error(false) , m_headerEnd(false) , m_saveXml(false) - , m_db(Q_NULLPTR) + , m_db(nullptr) { } @@ -66,13 +66,13 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke quint32 signature1 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok); if (!ok || signature1 != KeePass2::SIGNATURE_1) { raiseError(tr("Not a KeePass database.")); - return Q_NULLPTR; + return nullptr; } quint32 signature2 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok); if (!ok || signature2 != KeePass2::SIGNATURE_2) { raiseError(tr("Not a KeePass database.")); - return Q_NULLPTR; + return nullptr; } quint32 version = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok) @@ -80,7 +80,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke quint32 maxVersion = KeePass2::FILE_VERSION & KeePass2::FILE_VERSION_CRITICAL_MASK; if (!ok || (version < KeePass2::FILE_VERSION_MIN) || (version > maxVersion)) { raiseError(tr("Unsupported KeePass database version.")); - return Q_NULLPTR; + return nullptr; } while (readHeaderField() && !hasError()) { @@ -89,7 +89,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke headerStream.close(); if (hasError()) { - return Q_NULLPTR; + return nullptr; } // check if all required headers were present @@ -97,12 +97,12 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke || m_streamStartBytes.isEmpty() || m_protectedStreamKey.isEmpty() || m_db->cipher().isNull()) { raiseError("missing database headers"); - return Q_NULLPTR; + return nullptr; } if (!m_db->setKey(key, m_transformSeed, false)) { raiseError(tr("Unable to calculate master key")); - return Q_NULLPTR; + return nullptr; } CryptoHash hash(CryptoHash::Sha256); @@ -114,24 +114,24 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke SymmetricCipher::Cbc, SymmetricCipher::Decrypt); if (!cipherStream.init(finalKey, m_encryptionIV)) { raiseError(cipherStream.errorString()); - return Q_NULLPTR; + return nullptr; } if (!cipherStream.open(QIODevice::ReadOnly)) { raiseError(cipherStream.errorString()); - return Q_NULLPTR; + return nullptr; } QByteArray realStart = cipherStream.read(32); if (realStart != m_streamStartBytes) { raiseError(tr("Wrong key or database file is corrupt.")); - return Q_NULLPTR; + return nullptr; } HashedBlockStream hashedStream(&cipherStream); if (!hashedStream.open(QIODevice::ReadOnly)) { raiseError(hashedStream.errorString()); - return Q_NULLPTR; + return nullptr; } QIODevice* xmlDevice; @@ -145,7 +145,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke ioCompressor->setStreamFormat(QtIOCompressor::GzipFormat); if (!ioCompressor->open(QIODevice::ReadOnly)) { raiseError(ioCompressor->errorString()); - return Q_NULLPTR; + return nullptr; } xmlDevice = ioCompressor.data(); } @@ -153,7 +153,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke KeePass2RandomStream randomStream; if (!randomStream.init(m_protectedStreamKey)) { raiseError(randomStream.errorString()); - return Q_NULLPTR; + return nullptr; } QScopedPointer buffer; @@ -170,7 +170,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke if (xmlReader.hasError()) { raiseError(xmlReader.errorString()); - return Q_NULLPTR; + return nullptr; } Q_ASSERT(version < 0x00030001 || !xmlReader.headerHash().isEmpty()); @@ -179,7 +179,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke QByteArray headerHash = CryptoHash::hash(headerStream.storedData(), CryptoHash::Sha256); if (headerHash != xmlReader.headerHash()) { raiseError("Head doesn't match hash"); - return Q_NULLPTR; + return nullptr; } } @@ -191,14 +191,14 @@ Database* KeePass2Reader::readDatabase(const QString& filename, const CompositeK QFile file(filename); if (!file.open(QFile::ReadOnly)) { raiseError(file.errorString()); - return Q_NULLPTR; + return nullptr; } QScopedPointer db(readDatabase(&file, key)); if (file.error() != QFile::NoError) { raiseError(file.errorString()); - return Q_NULLPTR; + return nullptr; } return db.take(); diff --git a/src/format/KeePass2XmlReader.cpp b/src/format/KeePass2XmlReader.cpp index 787d3ff7f..2b975951e 100644 --- a/src/format/KeePass2XmlReader.cpp +++ b/src/format/KeePass2XmlReader.cpp @@ -31,10 +31,10 @@ typedef QPair StringPair; KeePass2XmlReader::KeePass2XmlReader() - : m_randomStream(Q_NULLPTR) - , m_db(Q_NULLPTR) - , m_meta(Q_NULLPTR) - , m_tmpParent(Q_NULLPTR) + : m_randomStream(nullptr) + , m_db(nullptr) + , m_meta(nullptr) + , m_tmpParent(nullptr) , m_error(false) , m_strictMode(false) { @@ -1144,7 +1144,7 @@ QByteArray KeePass2XmlReader::readCompressedBinary() Group* KeePass2XmlReader::getGroup(const Uuid& uuid) { if (uuid.isNull()) { - return Q_NULLPTR; + return nullptr; } if (m_groups.contains(uuid)) { @@ -1163,7 +1163,7 @@ Group* KeePass2XmlReader::getGroup(const Uuid& uuid) Entry* KeePass2XmlReader::getEntry(const Uuid& uuid) { if (uuid.isNull()) { - return Q_NULLPTR; + return nullptr; } if (m_entries.contains(uuid)) { diff --git a/src/format/KeePass2XmlReader.h b/src/format/KeePass2XmlReader.h index ca311b0e4..d2e0e0025 100644 --- a/src/format/KeePass2XmlReader.h +++ b/src/format/KeePass2XmlReader.h @@ -25,7 +25,6 @@ #include #include -#include "core/Global.h" #include "core/TimeInfo.h" #include "core/Uuid.h" @@ -42,7 +41,7 @@ class KeePass2XmlReader public: KeePass2XmlReader(); Database* readDatabase(QIODevice* device); - void readDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = Q_NULLPTR); + void readDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = nullptr); Database* readDatabase(const QString& filename); bool hasError(); QString errorString(); diff --git a/src/format/KeePass2XmlWriter.cpp b/src/format/KeePass2XmlWriter.cpp index 02b721c29..1bece16dd 100644 --- a/src/format/KeePass2XmlWriter.cpp +++ b/src/format/KeePass2XmlWriter.cpp @@ -25,9 +25,9 @@ #include "streams/QtIOCompressor" KeePass2XmlWriter::KeePass2XmlWriter() - : m_db(Q_NULLPTR) - , m_meta(Q_NULLPTR) - , m_randomStream(Q_NULLPTR) + : m_db(nullptr) + , m_meta(nullptr) + , m_randomStream(nullptr) , m_error(false) { m_xml.setAutoFormatting(true); diff --git a/src/format/KeePass2XmlWriter.h b/src/format/KeePass2XmlWriter.h index ea6212448..09b42cabf 100644 --- a/src/format/KeePass2XmlWriter.h +++ b/src/format/KeePass2XmlWriter.h @@ -36,7 +36,7 @@ class KeePass2XmlWriter { public: KeePass2XmlWriter(); - void writeDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = Q_NULLPTR, + void writeDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = nullptr, const QByteArray& headerHash = QByteArray()); void writeDatabase(const QString& filename, Database* db); bool hasError(); diff --git a/src/gui/AboutDialog.h b/src/gui/AboutDialog.h index 1436aee4e..08db6c887 100644 --- a/src/gui/AboutDialog.h +++ b/src/gui/AboutDialog.h @@ -21,8 +21,6 @@ #include #include -#include "core/Global.h" - namespace Ui { class AboutDialog; } @@ -32,7 +30,7 @@ class AboutDialog : public QDialog Q_OBJECT public: - explicit AboutDialog(QWidget* parent = Q_NULLPTR); + explicit AboutDialog(QWidget* parent = nullptr); ~AboutDialog(); private: diff --git a/src/gui/Application.cpp b/src/gui/Application.cpp index eb50a80f4..a334fded9 100644 --- a/src/gui/Application.cpp +++ b/src/gui/Application.cpp @@ -27,7 +27,7 @@ class XcbEventFilter : public QAbstractNativeEventFilter { public: - virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) Q_DECL_OVERRIDE + virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) override { Q_UNUSED(result) diff --git a/src/gui/Application.h b/src/gui/Application.h index 5c375c7e9..57df5fe0f 100644 --- a/src/gui/Application.h +++ b/src/gui/Application.h @@ -21,8 +21,6 @@ #include -#include "core/Global.h" - class Application : public QApplication { Q_OBJECT @@ -30,7 +28,7 @@ class Application : public QApplication public: Application(int& argc, char** argv); - bool event(QEvent* event) Q_DECL_OVERRIDE; + bool event(QEvent* event) override; Q_SIGNALS: void openFile(const QString& filename); diff --git a/src/gui/ChangeMasterKeyWidget.h b/src/gui/ChangeMasterKeyWidget.h index 46fc3efc9..8985ff7a8 100644 --- a/src/gui/ChangeMasterKeyWidget.h +++ b/src/gui/ChangeMasterKeyWidget.h @@ -33,7 +33,7 @@ class ChangeMasterKeyWidget : public DialogyWidget Q_OBJECT public: - explicit ChangeMasterKeyWidget(QWidget* parent = Q_NULLPTR); + explicit ChangeMasterKeyWidget(QWidget* parent = nullptr); ~ChangeMasterKeyWidget(); void clearForms(); CompositeKey newMasterKey(); diff --git a/src/gui/Clipboard.cpp b/src/gui/Clipboard.cpp index d4f34a187..52dd6c16a 100644 --- a/src/gui/Clipboard.cpp +++ b/src/gui/Clipboard.cpp @@ -23,7 +23,7 @@ #include "core/Config.h" -Clipboard* Clipboard::m_instance(Q_NULLPTR); +Clipboard* Clipboard::m_instance(nullptr); Clipboard::Clipboard(QObject* parent) : QObject(parent) diff --git a/src/gui/Clipboard.h b/src/gui/Clipboard.h index 8b6ea69f5..9c0b6eae7 100644 --- a/src/gui/Clipboard.h +++ b/src/gui/Clipboard.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class QTimer; class Clipboard : public QObject @@ -38,7 +36,7 @@ private Q_SLOTS: void cleanup(); private: - explicit Clipboard(QObject* parent = Q_NULLPTR); + explicit Clipboard(QObject* parent = nullptr); static Clipboard* m_instance; diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 717326a98..14f3baa06 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -30,7 +30,7 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent) : DialogyWidget(parent) , m_ui(new Ui::DatabaseOpenWidget()) - , m_db(Q_NULLPTR) + , m_db(nullptr) { m_ui->setupUi(this); diff --git a/src/gui/DatabaseOpenWidget.h b/src/gui/DatabaseOpenWidget.h index ad40c5711..339bc2210 100644 --- a/src/gui/DatabaseOpenWidget.h +++ b/src/gui/DatabaseOpenWidget.h @@ -35,7 +35,7 @@ class DatabaseOpenWidget : public DialogyWidget Q_OBJECT public: - explicit DatabaseOpenWidget(QWidget* parent = Q_NULLPTR); + explicit DatabaseOpenWidget(QWidget* parent = nullptr); ~DatabaseOpenWidget(); void load(const QString& filename); void enterKey(const QString& pw, const QString& keyFile); diff --git a/src/gui/DatabaseSettingsWidget.cpp b/src/gui/DatabaseSettingsWidget.cpp index 007c44a08..d4ca8ddba 100644 --- a/src/gui/DatabaseSettingsWidget.cpp +++ b/src/gui/DatabaseSettingsWidget.cpp @@ -26,7 +26,7 @@ DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent) : DialogyWidget(parent) , m_ui(new Ui::DatabaseSettingsWidget()) - , m_db(Q_NULLPTR) + , m_db(nullptr) { m_ui->setupUi(this); diff --git a/src/gui/DatabaseSettingsWidget.h b/src/gui/DatabaseSettingsWidget.h index a7d283266..040e0dbe7 100644 --- a/src/gui/DatabaseSettingsWidget.h +++ b/src/gui/DatabaseSettingsWidget.h @@ -33,7 +33,7 @@ class DatabaseSettingsWidget : public DialogyWidget Q_OBJECT public: - explicit DatabaseSettingsWidget(QWidget* parent = Q_NULLPTR); + explicit DatabaseSettingsWidget(QWidget* parent = nullptr); ~DatabaseSettingsWidget(); void load(Database* db); diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 7adeea8e5..88299dc58 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -37,8 +37,8 @@ #include "gui/group/GroupView.h" DatabaseManagerStruct::DatabaseManagerStruct() - : dbWidget(Q_NULLPTR) - , lockFile(Q_NULLPTR) + : dbWidget(nullptr) + , lockFile(nullptr) , saveToFilename(false) , modified(false) , readOnly(false) @@ -160,7 +160,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw, if (result == QMessageBox::No) { dbStruct.readOnly = true; delete lockFile; - lockFile = Q_NULLPTR; + lockFile = nullptr; } else { // take over the lock file if possible @@ -558,7 +558,7 @@ Database* DatabaseTabWidget::indexDatabase(int index) } } - return Q_NULLPTR; + return nullptr; } DatabaseManagerStruct DatabaseTabWidget::indexDatabaseManagerStruct(int index) @@ -586,7 +586,7 @@ Database* DatabaseTabWidget::databaseFromDatabaseWidget(DatabaseWidget* dbWidget } } - return Q_NULLPTR; + return nullptr; } void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct) @@ -611,7 +611,7 @@ DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget() return m_dbList[db].dbWidget; } else { - return Q_NULLPTR; + return nullptr; } } diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h index aafe666cb..de4a9ca12 100644 --- a/src/gui/DatabaseTabWidget.h +++ b/src/gui/DatabaseTabWidget.h @@ -51,7 +51,7 @@ class DatabaseTabWidget : public QTabWidget Q_OBJECT public: - explicit DatabaseTabWidget(QWidget* parent = Q_NULLPTR); + explicit DatabaseTabWidget(QWidget* parent = nullptr); ~DatabaseTabWidget(); void openDatabase(const QString& fileName, const QString& pw = QString(), const QString& keyFile = QString()); @@ -101,7 +101,7 @@ private: Database* databaseFromDatabaseWidget(DatabaseWidget* dbWidget); void insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct); void updateLastDatabases(const QString& filename); - void connectDatabase(Database* newDb, Database* oldDb = Q_NULLPTR); + void connectDatabase(Database* newDb, Database* oldDb = nullptr); KeePass2Writer m_writer; QHash m_dbList; diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 31ef9c780..c4c54c556 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -51,9 +51,9 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent) , m_db(db) , m_searchUi(new Ui::SearchWidget()) , m_searchWidget(new QWidget()) - , m_newGroup(Q_NULLPTR) - , m_newEntry(Q_NULLPTR) - , m_newParent(Q_NULLPTR) + , m_newGroup(nullptr) + , m_newEntry(nullptr) + , m_newParent(nullptr) { m_searchUi->setupUi(m_searchWidget); @@ -173,7 +173,7 @@ DatabaseWidget::~DatabaseWidget() DatabaseWidget::Mode DatabaseWidget::currentMode() const { - if (currentWidget() == Q_NULLPTR) { + if (currentWidget() == nullptr) { return DatabaseWidget::None; } else if (currentWidget() == m_mainWidget) { @@ -552,8 +552,8 @@ void DatabaseWidget::switchToView(bool accepted) delete m_newGroup; } - m_newGroup = Q_NULLPTR; - m_newParent = Q_NULLPTR; + m_newGroup = nullptr; + m_newParent = nullptr; } else if (m_newEntry) { if (accepted) { @@ -565,8 +565,8 @@ void DatabaseWidget::switchToView(bool accepted) delete m_newEntry; } - m_newEntry = Q_NULLPTR; - m_newParent = Q_NULLPTR; + m_newEntry = nullptr; + m_newParent = nullptr; } setCurrentWidget(m_mainWidget); @@ -636,9 +636,9 @@ void DatabaseWidget::openDatabase(bool accepted) // We won't need those anymore and KeePass1OpenWidget closes // the file in its dtor. delete m_databaseOpenWidget; - m_databaseOpenWidget = Q_NULLPTR; + m_databaseOpenWidget = nullptr; delete m_keepass1OpenWidget; - m_keepass1OpenWidget = Q_NULLPTR; + m_keepass1OpenWidget = nullptr; } else { if (m_databaseOpenWidget->database()) { @@ -881,7 +881,7 @@ bool DatabaseWidget::isInSearchMode() const void DatabaseWidget::clearLastGroup(Group* group) { if (group) { - m_lastGroup = Q_NULLPTR; + m_lastGroup = nullptr; m_searchWidget->hide(); } } @@ -930,7 +930,7 @@ QStringList DatabaseWidget::customEntryAttributes() const bool DatabaseWidget::isGroupSelected() const { - return m_groupView->currentGroup() != Q_NULLPTR; + return m_groupView->currentGroup() != nullptr; } bool DatabaseWidget::currentEntryHasTitle() diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 1ba3dd1f5..a0bcf79d1 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -21,7 +21,6 @@ #include #include -#include "core/Global.h" #include "core/Uuid.h" #include "gui/entry/EntryModel.h" @@ -59,7 +58,7 @@ public: LockedMode }; - explicit DatabaseWidget(Database* db, QWidget* parent = Q_NULLPTR); + explicit DatabaseWidget(Database* db, QWidget* parent = nullptr); ~DatabaseWidget(); Database* database(); bool dbHasKey() const; diff --git a/src/gui/DatabaseWidgetStateSync.cpp b/src/gui/DatabaseWidgetStateSync.cpp index 66b8492e2..430380c5a 100644 --- a/src/gui/DatabaseWidgetStateSync.cpp +++ b/src/gui/DatabaseWidgetStateSync.cpp @@ -22,7 +22,7 @@ DatabaseWidgetStateSync::DatabaseWidgetStateSync(QObject* parent) : QObject(parent) - , m_activeDbWidget(Q_NULLPTR) + , m_activeDbWidget(nullptr) , m_blockUpdates(false) { m_splitterSizes = variantToIntList(config()->get("GUI/SplitterState")); diff --git a/src/gui/DatabaseWidgetStateSync.h b/src/gui/DatabaseWidgetStateSync.h index f6a87cd9a..906d87cc0 100644 --- a/src/gui/DatabaseWidgetStateSync.h +++ b/src/gui/DatabaseWidgetStateSync.h @@ -26,7 +26,7 @@ class DatabaseWidgetStateSync : public QObject Q_OBJECT public: - explicit DatabaseWidgetStateSync(QObject* parent = Q_NULLPTR); + explicit DatabaseWidgetStateSync(QObject* parent = nullptr); ~DatabaseWidgetStateSync(); public Q_SLOTS: diff --git a/src/gui/DialogyWidget.h b/src/gui/DialogyWidget.h index 9dd05283e..f6bbc3cdd 100644 --- a/src/gui/DialogyWidget.h +++ b/src/gui/DialogyWidget.h @@ -21,17 +21,15 @@ #include #include -#include "core/Global.h" - class DialogyWidget : public QWidget { Q_OBJECT public: - explicit DialogyWidget(QWidget* parent = Q_NULLPTR); + explicit DialogyWidget(QWidget* parent = nullptr); protected: - virtual void keyPressEvent(QKeyEvent* e) Q_DECL_OVERRIDE; + virtual void keyPressEvent(QKeyEvent* e) override; private: bool clickButton(QDialogButtonBox::StandardButton standardButton); diff --git a/src/gui/DragTabBar.h b/src/gui/DragTabBar.h index 1b6005df8..a6117a047 100644 --- a/src/gui/DragTabBar.h +++ b/src/gui/DragTabBar.h @@ -20,21 +20,19 @@ #include -#include "core/Global.h" - class DragTabBar : public QTabBar { Q_OBJECT public: - explicit DragTabBar(QWidget* parent = Q_NULLPTR); + explicit DragTabBar(QWidget* parent = nullptr); protected: - void dragEnterEvent(QDragEnterEvent* event) Q_DECL_OVERRIDE; - void dragMoveEvent(QDragMoveEvent* event) Q_DECL_OVERRIDE; - void dragLeaveEvent(QDragLeaveEvent* event) Q_DECL_OVERRIDE; - void dropEvent(QDropEvent* event) Q_DECL_OVERRIDE; - void tabLayoutChange() Q_DECL_OVERRIDE; + void dragEnterEvent(QDragEnterEvent* event) override; + void dragMoveEvent(QDragMoveEvent* event) override; + void dragLeaveEvent(QDragLeaveEvent* event) override; + void dropEvent(QDropEvent* event) override; + void tabLayoutChange() override; private Q_SLOTS: void dragSwitchTab(); diff --git a/src/gui/EditWidget.h b/src/gui/EditWidget.h index d27abe9ba..c5f507ac9 100644 --- a/src/gui/EditWidget.h +++ b/src/gui/EditWidget.h @@ -33,7 +33,7 @@ class EditWidget : public DialogyWidget Q_OBJECT public: - explicit EditWidget(QWidget* parent = Q_NULLPTR); + explicit EditWidget(QWidget* parent = nullptr); ~EditWidget(); void add(const QString& labelText, QWidget* widget); diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp index 5ea4db736..33a0a9ffa 100644 --- a/src/gui/EditWidgetIcons.cpp +++ b/src/gui/EditWidgetIcons.cpp @@ -35,7 +35,7 @@ IconStruct::IconStruct() EditWidgetIcons::EditWidgetIcons(QWidget* parent) : QWidget(parent) , m_ui(new Ui::EditWidgetIcons()) - , m_database(Q_NULLPTR) + , m_database(nullptr) , m_defaultIconModel(new DefaultIconModel(this)) , m_customIconModel(new CustomIconModel(this)) { @@ -85,7 +85,7 @@ IconStruct EditWidgetIcons::save() } } - m_database = Q_NULLPTR; + m_database = nullptr; m_currentUuid = Uuid(); return iconStruct; } diff --git a/src/gui/EditWidgetIcons.h b/src/gui/EditWidgetIcons.h index e18f4440f..f3f3f11c5 100644 --- a/src/gui/EditWidgetIcons.h +++ b/src/gui/EditWidgetIcons.h @@ -20,7 +20,6 @@ #include -#include "core/Global.h" #include "core/Uuid.h" class Database; @@ -44,7 +43,7 @@ class EditWidgetIcons : public QWidget Q_OBJECT public: - explicit EditWidgetIcons(QWidget* parent = Q_NULLPTR); + explicit EditWidgetIcons(QWidget* parent = nullptr); ~EditWidgetIcons(); IconStruct save(); diff --git a/src/gui/EditWidgetProperties.h b/src/gui/EditWidgetProperties.h index c5d0eb03e..4a2c05917 100644 --- a/src/gui/EditWidgetProperties.h +++ b/src/gui/EditWidgetProperties.h @@ -20,7 +20,6 @@ #include -#include "core/Global.h" #include "core/TimeInfo.h" #include "core/Uuid.h" @@ -33,7 +32,7 @@ class EditWidgetProperties : public QWidget Q_OBJECT public: - explicit EditWidgetProperties(QWidget* parent = Q_NULLPTR); + explicit EditWidgetProperties(QWidget* parent = nullptr); ~EditWidgetProperties(); void setFields(TimeInfo timeInfo, Uuid uuid); diff --git a/src/gui/FileDialog.cpp b/src/gui/FileDialog.cpp index 7dd02b17d..78a897f45 100644 --- a/src/gui/FileDialog.cpp +++ b/src/gui/FileDialog.cpp @@ -19,7 +19,7 @@ #include "core/Config.h" -FileDialog* FileDialog::m_instance(Q_NULLPTR); +FileDialog* FileDialog::m_instance(nullptr); QString FileDialog::getOpenFileName(QWidget* parent, const QString& caption, QString dir, const QString& filter, QString* selectedFilter, diff --git a/src/gui/FileDialog.h b/src/gui/FileDialog.h index 46c635322..9f8fbb547 100644 --- a/src/gui/FileDialog.h +++ b/src/gui/FileDialog.h @@ -20,17 +20,15 @@ #include -#include "core/Global.h" - class FileDialog { public: - QString getOpenFileName(QWidget* parent = Q_NULLPTR, const QString& caption = QString(), + QString getOpenFileName(QWidget* parent = nullptr, const QString& caption = QString(), QString dir = QString(), const QString& filter = QString(), - QString* selectedFilter = Q_NULLPTR, QFileDialog::Options options = 0); - QString getSaveFileName(QWidget* parent = Q_NULLPTR, const QString& caption = QString(), + QString* selectedFilter = nullptr, QFileDialog::Options options = 0); + QString getSaveFileName(QWidget* parent = nullptr, const QString& caption = QString(), QString dir = QString(), const QString& filter = QString(), - QString* selectedFilter = Q_NULLPTR, QFileDialog::Options options = 0, + QString* selectedFilter = nullptr, QFileDialog::Options options = 0, const QString& defaultExtension = QString()); /** diff --git a/src/gui/IconModels.h b/src/gui/IconModels.h index a04efa209..d27f636d2 100644 --- a/src/gui/IconModels.h +++ b/src/gui/IconModels.h @@ -21,7 +21,6 @@ #include #include -#include "core/Global.h" #include "core/Uuid.h" class DefaultIconModel : public QAbstractListModel @@ -29,10 +28,10 @@ class DefaultIconModel : public QAbstractListModel Q_OBJECT public: - explicit DefaultIconModel(QObject* parent = Q_NULLPTR); + explicit DefaultIconModel(QObject* parent = nullptr); - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; }; class CustomIconModel : public QAbstractListModel @@ -40,10 +39,10 @@ class CustomIconModel : public QAbstractListModel Q_OBJECT public: - explicit CustomIconModel(QObject* parent = Q_NULLPTR); + explicit CustomIconModel(QObject* parent = nullptr); - virtual int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; + virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; void setIcons(const QHash& icons, const QList& iconsOrder); Uuid uuidFromIndex(const QModelIndex& index) const; QModelIndex indexFromUuid(const Uuid& uuid) const; diff --git a/src/gui/KeePass1OpenWidget.h b/src/gui/KeePass1OpenWidget.h index a398f9a13..203b78632 100644 --- a/src/gui/KeePass1OpenWidget.h +++ b/src/gui/KeePass1OpenWidget.h @@ -25,10 +25,10 @@ class KeePass1OpenWidget : public DatabaseOpenWidget Q_OBJECT public: - explicit KeePass1OpenWidget(QWidget* parent = Q_NULLPTR); + explicit KeePass1OpenWidget(QWidget* parent = nullptr); protected: - void openDatabase() Q_DECL_OVERRIDE; + void openDatabase() override; }; #endif // KEEPASSX_KEEPASS1OPENWIDGET_H diff --git a/src/gui/LineEdit.h b/src/gui/LineEdit.h index 2672aae71..f5f058401 100644 --- a/src/gui/LineEdit.h +++ b/src/gui/LineEdit.h @@ -22,8 +22,6 @@ #include -#include "core/Global.h" - class QToolButton; class LineEdit : public QLineEdit @@ -31,10 +29,10 @@ class LineEdit : public QLineEdit Q_OBJECT public: - explicit LineEdit(QWidget* parent = Q_NULLPTR); + explicit LineEdit(QWidget* parent = nullptr); protected: - void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent* event) override; private Q_SLOTS: void updateCloseButton(const QString& text); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index bfca42c98..0d837a32f 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -33,7 +33,7 @@ const QString MainWindow::BaseWindowTitle = "KeePassX"; MainWindow::MainWindow() : m_ui(new Ui::MainWindow()) - , m_trayIcon(Q_NULLPTR) + , m_trayIcon(nullptr) { m_ui->setupUi(this); @@ -514,7 +514,7 @@ void MainWindow::updateTrayIcon() if (m_trayIcon) { m_trayIcon->hide(); delete m_trayIcon; - m_trayIcon = Q_NULLPTR; + m_trayIcon = nullptr; } } } diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 695c20d41..32cdad76e 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -44,8 +44,8 @@ public Q_SLOTS: const QString& keyFile = QString()); protected: - void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE; - void changeEvent(QEvent* event) Q_DECL_OVERRIDE; + void closeEvent(QCloseEvent* event) override; + void changeEvent(QEvent* event) override; private Q_SLOTS: void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None); diff --git a/src/gui/MessageBox.h b/src/gui/MessageBox.h index abb12c072..1ea4022ca 100644 --- a/src/gui/MessageBox.h +++ b/src/gui/MessageBox.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class MessageBox { public: diff --git a/src/gui/PasswordComboBox.cpp b/src/gui/PasswordComboBox.cpp index f11311a9a..de52cd865 100644 --- a/src/gui/PasswordComboBox.cpp +++ b/src/gui/PasswordComboBox.cpp @@ -24,7 +24,7 @@ PasswordComboBox::PasswordComboBox(QWidget* parent) : QComboBox(parent) - , m_generator(Q_NULLPTR) + , m_generator(nullptr) , m_alternatives(10) { setEditable(true); diff --git a/src/gui/PasswordComboBox.h b/src/gui/PasswordComboBox.h index 69ce1523f..7c54e278b 100644 --- a/src/gui/PasswordComboBox.h +++ b/src/gui/PasswordComboBox.h @@ -21,8 +21,6 @@ #include -#include "core/Global.h" - class PasswordGenerator; class PasswordComboBox : public QComboBox @@ -30,7 +28,7 @@ class PasswordComboBox : public QComboBox Q_OBJECT public: - explicit PasswordComboBox(QWidget* parent = Q_NULLPTR); + explicit PasswordComboBox(QWidget* parent = nullptr); ~PasswordComboBox(); void setGenerator(PasswordGenerator* generator); diff --git a/src/gui/PasswordEdit.cpp b/src/gui/PasswordEdit.cpp index b68eef68b..e5bbf6b34 100644 --- a/src/gui/PasswordEdit.cpp +++ b/src/gui/PasswordEdit.cpp @@ -17,14 +17,12 @@ #include "PasswordEdit.h" -#include "core/Global.h" - const QColor PasswordEdit::CorrectSoFarColor = QColor(255, 205, 15); const QColor PasswordEdit::ErrorColor = QColor(255, 125, 125); PasswordEdit::PasswordEdit(QWidget* parent) : QLineEdit(parent) - , m_basePasswordEdit(Q_NULLPTR) + , m_basePasswordEdit(nullptr) { } diff --git a/src/gui/PasswordEdit.h b/src/gui/PasswordEdit.h index cfb4a764f..7ce490873 100644 --- a/src/gui/PasswordEdit.h +++ b/src/gui/PasswordEdit.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class PasswordEdit : public QLineEdit { Q_OBJECT @@ -30,7 +28,7 @@ public: static const QColor CorrectSoFarColor; static const QColor ErrorColor; - explicit PasswordEdit(QWidget* parent = Q_NULLPTR); + explicit PasswordEdit(QWidget* parent = nullptr); void enableVerifyMode(PasswordEdit* baseEdit); public Q_SLOTS: diff --git a/src/gui/PasswordGeneratorWidget.h b/src/gui/PasswordGeneratorWidget.h index 96f3f6023..cfb21bbec 100644 --- a/src/gui/PasswordGeneratorWidget.h +++ b/src/gui/PasswordGeneratorWidget.h @@ -21,7 +21,6 @@ #include #include -#include "core/Global.h" #include "core/PasswordGenerator.h" namespace Ui { @@ -35,7 +34,7 @@ class PasswordGeneratorWidget : public QWidget Q_OBJECT public: - explicit PasswordGeneratorWidget(QWidget* parent = Q_NULLPTR); + explicit PasswordGeneratorWidget(QWidget* parent = nullptr); ~PasswordGeneratorWidget(); void loadSettings(); void reset(); diff --git a/src/gui/SettingsWidget.h b/src/gui/SettingsWidget.h index cefbf6d49..3fe621d4d 100644 --- a/src/gui/SettingsWidget.h +++ b/src/gui/SettingsWidget.h @@ -30,7 +30,7 @@ class SettingsWidget : public EditWidget Q_OBJECT public: - explicit SettingsWidget(QWidget* parent = Q_NULLPTR); + explicit SettingsWidget(QWidget* parent = nullptr); ~SettingsWidget(); void loadSettings(); diff --git a/src/gui/SortFilterHideProxyModel.h b/src/gui/SortFilterHideProxyModel.h index aa6f68999..58d9ff703 100644 --- a/src/gui/SortFilterHideProxyModel.h +++ b/src/gui/SortFilterHideProxyModel.h @@ -21,19 +21,17 @@ #include #include -#include "core/Global.h" - class SortFilterHideProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - explicit SortFilterHideProxyModel(QObject* parent = Q_NULLPTR); - Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE; + explicit SortFilterHideProxyModel(QObject* parent = nullptr); + Qt::DropActions supportedDragActions() const override; void hideColumn(int column, bool hide); protected: - bool filterAcceptsColumn(int sourceColumn, const QModelIndex& sourceParent) const Q_DECL_OVERRIDE; + bool filterAcceptsColumn(int sourceColumn, const QModelIndex& sourceParent) const override; private: QBitArray m_hiddenColumns; diff --git a/src/gui/UnlockDatabaseWidget.cpp b/src/gui/UnlockDatabaseWidget.cpp index 944198be1..de703a689 100644 --- a/src/gui/UnlockDatabaseWidget.cpp +++ b/src/gui/UnlockDatabaseWidget.cpp @@ -33,5 +33,5 @@ void UnlockDatabaseWidget::clearForms() m_ui->comboKeyFile->clear(); m_ui->checkPassword->setChecked(false); m_ui->checkKeyFile->setChecked(false); - m_db = Q_NULLPTR; + m_db = nullptr; } diff --git a/src/gui/UnlockDatabaseWidget.h b/src/gui/UnlockDatabaseWidget.h index 052578b76..adb5efbb9 100644 --- a/src/gui/UnlockDatabaseWidget.h +++ b/src/gui/UnlockDatabaseWidget.h @@ -25,7 +25,7 @@ class UnlockDatabaseWidget : public DatabaseOpenWidget Q_OBJECT public: - explicit UnlockDatabaseWidget(QWidget* parent = Q_NULLPTR); + explicit UnlockDatabaseWidget(QWidget* parent = nullptr); void clearForms(); }; diff --git a/src/gui/WelcomeWidget.h b/src/gui/WelcomeWidget.h index 983aaa040..80a0dde1c 100644 --- a/src/gui/WelcomeWidget.h +++ b/src/gui/WelcomeWidget.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - namespace Ui { class WelcomeWidget; } @@ -31,7 +29,7 @@ class WelcomeWidget : public QWidget Q_OBJECT public: - explicit WelcomeWidget(QWidget* parent = Q_NULLPTR); + explicit WelcomeWidget(QWidget* parent = nullptr); ~WelcomeWidget(); private: diff --git a/src/gui/entry/AutoTypeAssociationsModel.cpp b/src/gui/entry/AutoTypeAssociationsModel.cpp index 6d6dc9756..49f6786b3 100644 --- a/src/gui/entry/AutoTypeAssociationsModel.cpp +++ b/src/gui/entry/AutoTypeAssociationsModel.cpp @@ -19,7 +19,7 @@ AutoTypeAssociationsModel::AutoTypeAssociationsModel(QObject* parent) : QAbstractListModel(parent) - , m_autoTypeAssociations(Q_NULLPTR) + , m_autoTypeAssociations(nullptr) { } diff --git a/src/gui/entry/AutoTypeAssociationsModel.h b/src/gui/entry/AutoTypeAssociationsModel.h index ecb4247bd..c75168c32 100644 --- a/src/gui/entry/AutoTypeAssociationsModel.h +++ b/src/gui/entry/AutoTypeAssociationsModel.h @@ -29,12 +29,12 @@ class AutoTypeAssociationsModel : public QAbstractListModel Q_OBJECT public: - explicit AutoTypeAssociationsModel(QObject* parent = Q_NULLPTR); + explicit AutoTypeAssociationsModel(QObject* parent = nullptr); void setAutoTypeAssociations(AutoTypeAssociations* autoTypeAssociations); - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; public Q_SLOTS: void associationChange(int i); diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index f39c73e4a..afc0fe970 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -46,7 +46,7 @@ EditEntryWidget::EditEntryWidget(QWidget* parent) : EditWidget(parent) - , m_entry(Q_NULLPTR) + , m_entry(nullptr) , m_mainUi(new Ui::EditEntryWidgetMain()) , m_advancedUi(new Ui::EditEntryWidgetAdvanced()) , m_autoTypeUi(new Ui::EditEntryWidgetAutoType()) @@ -477,8 +477,8 @@ void EditEntryWidget::cancel() void EditEntryWidget::clear() { - m_entry = Q_NULLPTR; - m_database = Q_NULLPTR; + m_entry = nullptr; + m_database = nullptr; m_entryAttributes->clear(); m_entryAttachments->clear(); m_autoTypeAssoc->clear(); diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h index 03811bf82..3c66b2a57 100644 --- a/src/gui/entry/EditEntryWidget.h +++ b/src/gui/entry/EditEntryWidget.h @@ -52,7 +52,7 @@ class EditEntryWidget : public EditWidget Q_OBJECT public: - explicit EditEntryWidget(QWidget* parent = Q_NULLPTR); + explicit EditEntryWidget(QWidget* parent = nullptr); ~EditEntryWidget(); void loadEntry(Entry* entry, bool create, bool history, const QString& parentName, diff --git a/src/gui/entry/EntryAttachmentsModel.cpp b/src/gui/entry/EntryAttachmentsModel.cpp index e072d177a..baf04549f 100644 --- a/src/gui/entry/EntryAttachmentsModel.cpp +++ b/src/gui/entry/EntryAttachmentsModel.cpp @@ -22,7 +22,7 @@ EntryAttachmentsModel::EntryAttachmentsModel(QObject* parent) : QAbstractListModel(parent) - , m_entryAttachments(Q_NULLPTR) + , m_entryAttachments(nullptr) { } diff --git a/src/gui/entry/EntryAttachmentsModel.h b/src/gui/entry/EntryAttachmentsModel.h index 177cde063..c2e238aeb 100644 --- a/src/gui/entry/EntryAttachmentsModel.h +++ b/src/gui/entry/EntryAttachmentsModel.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class EntryAttachments; class EntryAttachmentsModel : public QAbstractListModel @@ -29,11 +27,11 @@ class EntryAttachmentsModel : public QAbstractListModel Q_OBJECT public: - explicit EntryAttachmentsModel(QObject* parent = Q_NULLPTR); + explicit EntryAttachmentsModel(QObject* parent = nullptr); void setEntryAttachments(EntryAttachments* entry); - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; QString keyByIndex(const QModelIndex& index) const; private Q_SLOTS: diff --git a/src/gui/entry/EntryAttributesModel.cpp b/src/gui/entry/EntryAttributesModel.cpp index f73a2d2e2..d4454adef 100644 --- a/src/gui/entry/EntryAttributesModel.cpp +++ b/src/gui/entry/EntryAttributesModel.cpp @@ -22,7 +22,7 @@ EntryAttributesModel::EntryAttributesModel(QObject* parent) : QAbstractListModel(parent) - , m_entryAttributes(Q_NULLPTR) + , m_entryAttributes(nullptr) , m_nextRenameDataChange(false) { } diff --git a/src/gui/entry/EntryAttributesModel.h b/src/gui/entry/EntryAttributesModel.h index f6ac65149..1eec8bff7 100644 --- a/src/gui/entry/EntryAttributesModel.h +++ b/src/gui/entry/EntryAttributesModel.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class EntryAttributes; class EntryAttributesModel : public QAbstractListModel @@ -29,14 +27,14 @@ class EntryAttributesModel : public QAbstractListModel Q_OBJECT public: - explicit EntryAttributesModel(QObject* parent = Q_NULLPTR); + explicit EntryAttributesModel(QObject* parent = nullptr); void setEntryAttributes(EntryAttributes* entryAttributes); - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) Q_DECL_OVERRIDE; - Qt::ItemFlags flags(const QModelIndex& index) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; + Qt::ItemFlags flags(const QModelIndex& index) const override; QModelIndex indexByKey(const QString& key) const; QString keyByIndex(const QModelIndex& index) const; diff --git a/src/gui/entry/EntryHistoryModel.h b/src/gui/entry/EntryHistoryModel.h index 6c8073ac6..a7434e013 100644 --- a/src/gui/entry/EntryHistoryModel.h +++ b/src/gui/entry/EntryHistoryModel.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class Entry; class EntryHistoryModel : public QAbstractTableModel @@ -29,13 +27,13 @@ class EntryHistoryModel : public QAbstractTableModel Q_OBJECT public: - explicit EntryHistoryModel(QObject* parent = Q_NULLPTR); + explicit EntryHistoryModel(QObject* parent = nullptr); Entry* entryFromIndex(const QModelIndex& index) const; - int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; void setEntries(const QList& entries); void clear(); diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index bad90ba93..ae66298d9 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -27,7 +27,7 @@ EntryModel::EntryModel(QObject* parent) : QAbstractTableModel(parent) - , m_group(Q_NULLPTR) + , m_group(nullptr) { } @@ -71,7 +71,7 @@ void EntryModel::setEntryList(const QList& entries) severConnections(); - m_group = Q_NULLPTR; + m_group = nullptr; m_allGroups.clear(); m_entries = entries; m_orgEntries = entries; @@ -215,7 +215,7 @@ QStringList EntryModel::mimeTypes() const QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const { if (indexes.isEmpty()) { - return Q_NULLPTR; + return nullptr; } QMimeData* data = new QMimeData(); @@ -240,7 +240,7 @@ QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const if (seenEntries.isEmpty()) { delete data; - return Q_NULLPTR; + return nullptr; } else { data->setData(mimeTypes().first(), encoded); @@ -298,11 +298,11 @@ void EntryModel::entryDataChanged(Entry* entry) void EntryModel::severConnections() { if (m_group) { - disconnect(m_group, Q_NULLPTR, this, Q_NULLPTR); + disconnect(m_group, nullptr, this, nullptr); } Q_FOREACH (const Group* group, m_allGroups) { - disconnect(group, Q_NULLPTR, this, Q_NULLPTR); + disconnect(group, nullptr, this, nullptr); } } diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index de87fb3f7..0183c47be 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class Entry; class Group; @@ -38,19 +36,19 @@ public: Url = 3 }; - explicit EntryModel(QObject* parent = Q_NULLPTR); + explicit EntryModel(QObject* parent = nullptr); Entry* entryFromIndex(const QModelIndex& index) const; QModelIndex indexFromEntry(Entry* entry) const; - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; - Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE; - Qt::ItemFlags flags(const QModelIndex& modelIndex) const Q_DECL_OVERRIDE; - QStringList mimeTypes() const Q_DECL_OVERRIDE; - QMimeData* mimeData(const QModelIndexList& indexes) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + Qt::DropActions supportedDropActions() const override; + Qt::DropActions supportedDragActions() const override; + Qt::ItemFlags flags(const QModelIndex& modelIndex) const override; + QStringList mimeTypes() const override; + QMimeData* mimeData(const QModelIndexList& indexes) const override; void setEntryList(const QList& entries); diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index f23ecebf7..e4648d987 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -108,7 +108,7 @@ Entry* EntryView::currentEntry() return m_model->entryFromIndex(m_sortModel->mapToSource(list.first())); } else { - return Q_NULLPTR; + return nullptr; } } @@ -129,7 +129,7 @@ Entry* EntryView::entryFromIndex(const QModelIndex& index) return m_model->entryFromIndex(m_sortModel->mapToSource(index)); } else { - return Q_NULLPTR; + return nullptr; } } diff --git a/src/gui/entry/EntryView.h b/src/gui/entry/EntryView.h index c11d0417d..fb9e3566a 100644 --- a/src/gui/entry/EntryView.h +++ b/src/gui/entry/EntryView.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - #include "gui/entry/EntryModel.h" class Entry; @@ -34,8 +32,8 @@ class EntryView : public QTreeView Q_OBJECT public: - explicit EntryView(QWidget* parent = Q_NULLPTR); - void setModel(QAbstractItemModel* model) Q_DECL_OVERRIDE; + explicit EntryView(QWidget* parent = nullptr); + void setModel(QAbstractItemModel* model) override; Entry* currentEntry(); void setCurrentEntry(Entry* entry); Entry* entryFromIndex(const QModelIndex& index); @@ -52,7 +50,7 @@ Q_SIGNALS: void entrySelectionChanged(); protected: - void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent* event) override; private Q_SLOTS: void emitEntryActivated(const QModelIndex& index); diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp index ebe5cb970..7fdec89a2 100644 --- a/src/gui/group/EditGroupWidget.cpp +++ b/src/gui/group/EditGroupWidget.cpp @@ -28,8 +28,8 @@ EditGroupWidget::EditGroupWidget(QWidget* parent) , m_editGroupWidgetMain(new QWidget()) , m_editGroupWidgetIcons(new EditWidgetIcons()) , m_editWidgetProperties(new EditWidgetProperties()) - , m_group(Q_NULLPTR) - , m_database(Q_NULLPTR) + , m_group(nullptr) + , m_database(nullptr) { m_mainUi->setupUi(m_editGroupWidgetMain); @@ -142,8 +142,8 @@ void EditGroupWidget::cancel() void EditGroupWidget::clear() { - m_group = Q_NULLPTR; - m_database = Q_NULLPTR; + m_group = nullptr; + m_database = nullptr; } void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault) diff --git a/src/gui/group/EditGroupWidget.h b/src/gui/group/EditGroupWidget.h index c6d91a564..94ad891db 100644 --- a/src/gui/group/EditGroupWidget.h +++ b/src/gui/group/EditGroupWidget.h @@ -37,7 +37,7 @@ class EditGroupWidget : public EditWidget Q_OBJECT public: - explicit EditGroupWidget(QWidget* parent = Q_NULLPTR); + explicit EditGroupWidget(QWidget* parent = nullptr); ~EditGroupWidget(); void loadGroup(Group* group, bool create, Database* database); diff --git a/src/gui/group/GroupModel.cpp b/src/gui/group/GroupModel.cpp index b33a5ff54..85314e2bd 100644 --- a/src/gui/group/GroupModel.cpp +++ b/src/gui/group/GroupModel.cpp @@ -28,7 +28,7 @@ GroupModel::GroupModel(Database* db, QObject* parent) : QAbstractItemModel(parent) - , m_db(Q_NULLPTR) + , m_db(nullptr) { changeDatabase(db); } @@ -329,7 +329,7 @@ QStringList GroupModel::mimeTypes() const QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const { if (indexes.isEmpty()) { - return Q_NULLPTR; + return nullptr; } QMimeData* data = new QMimeData(); @@ -354,7 +354,7 @@ QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const if (seenGroups.isEmpty()) { delete data; - return Q_NULLPTR; + return nullptr; } else { data->setData(mimeTypes().first(), encoded); diff --git a/src/gui/group/GroupModel.h b/src/gui/group/GroupModel.h index 173ea3a23..95cf1c1cf 100644 --- a/src/gui/group/GroupModel.h +++ b/src/gui/group/GroupModel.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class Database; class Group; @@ -30,23 +28,23 @@ class GroupModel : public QAbstractItemModel Q_OBJECT public: - explicit GroupModel(Database* db, QObject* parent = Q_NULLPTR); + explicit GroupModel(Database* db, QObject* parent = nullptr); void changeDatabase(Database* newDb); QModelIndex index(Group* group) const; Group* groupFromIndex(const QModelIndex& index) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; int columnCount(const QModelIndex& parent = QModelIndex()) const; - QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex parent(const QModelIndex& index) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; - Qt::ItemFlags flags(const QModelIndex& modelIndex) const Q_DECL_OVERRIDE; + QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex& index) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + Qt::DropActions supportedDropActions() const override; + Qt::ItemFlags flags(const QModelIndex& modelIndex) const override; bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, - const QModelIndex& parent) Q_DECL_OVERRIDE; - QStringList mimeTypes() const Q_DECL_OVERRIDE; - QMimeData* mimeData(const QModelIndexList& indexes) const Q_DECL_OVERRIDE; + const QModelIndex& parent) override; + QStringList mimeTypes() const override; + QMimeData* mimeData(const QModelIndexList& indexes) const override; private: QModelIndex parent(Group* group) const; diff --git a/src/gui/group/GroupView.cpp b/src/gui/group/GroupView.cpp index 817f1bdbe..1f94dc0fc 100644 --- a/src/gui/group/GroupView.cpp +++ b/src/gui/group/GroupView.cpp @@ -75,7 +75,7 @@ void GroupView::dragMoveEvent(QDragMoveEvent* event) Group* GroupView::currentGroup() { if (currentIndex() == QModelIndex()) { - return Q_NULLPTR; + return nullptr; } else { return m_model->groupFromIndex(currentIndex()); diff --git a/src/gui/group/GroupView.h b/src/gui/group/GroupView.h index 98073f633..69c7ee8ee 100644 --- a/src/gui/group/GroupView.h +++ b/src/gui/group/GroupView.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class Database; class Group; class GroupModel; @@ -31,9 +29,9 @@ class GroupView : public QTreeView Q_OBJECT public: - explicit GroupView(Database* db, QWidget* parent = Q_NULLPTR); + explicit GroupView(Database* db, QWidget* parent = nullptr); void changeDatabase(Database* newDb); - void setModel(QAbstractItemModel* model) Q_DECL_OVERRIDE; + void setModel(QAbstractItemModel* model) override; Group* currentGroup(); void setCurrentGroup(Group* group); void expandGroup(Group* group, bool expand = true); diff --git a/src/keys/FileKey.h b/src/keys/FileKey.h index f98543364..7a9b1caf0 100644 --- a/src/keys/FileKey.h +++ b/src/keys/FileKey.h @@ -20,7 +20,6 @@ #include -#include "core/Global.h" #include "keys/Key.h" class QIODevice; @@ -30,11 +29,11 @@ class FileKey : public Key public: FileKey(); bool load(QIODevice* device); - bool load(const QString& fileName, QString* errorMsg = Q_NULLPTR); + bool load(const QString& fileName, QString* errorMsg = nullptr); QByteArray rawKey() const; FileKey* clone() const; static void create(QIODevice* device); - static bool create(const QString& fileName, QString* errorMsg = Q_NULLPTR); + static bool create(const QString& fileName, QString* errorMsg = nullptr); private: bool loadXml(QIODevice* device); diff --git a/src/main.cpp b/src/main.cpp index 1a69e181a..698e0786d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,7 @@ int main(int argc, char** argv) "Fatal error while testing the cryptographic functions."); error.append("\n"); error.append(Crypto::errorString()); - MessageBox::critical(Q_NULLPTR, QCoreApplication::translate("Main", "KeePassX - Error"), error); + MessageBox::critical(nullptr, QCoreApplication::translate("Main", "KeePassX - Error"), error); return 1; } diff --git a/src/streams/HashedBlockStream.h b/src/streams/HashedBlockStream.h index f38d5716a..b0d90c9c3 100644 --- a/src/streams/HashedBlockStream.h +++ b/src/streams/HashedBlockStream.h @@ -35,8 +35,8 @@ public: void close(); protected: - qint64 readData(char* data, qint64 maxSize) Q_DECL_OVERRIDE; - qint64 writeData(const char* data, qint64 maxSize) Q_DECL_OVERRIDE; + qint64 readData(char* data, qint64 maxSize) override; + qint64 writeData(const char* data, qint64 maxSize) override; private: void init(); diff --git a/src/streams/LayeredStream.h b/src/streams/LayeredStream.h index b243e55b2..8586b4134 100644 --- a/src/streams/LayeredStream.h +++ b/src/streams/LayeredStream.h @@ -20,8 +20,6 @@ #include -#include "core/Global.h" - class LayeredStream : public QIODevice { Q_OBJECT @@ -30,12 +28,12 @@ public: explicit LayeredStream(QIODevice* baseDevice); virtual ~LayeredStream(); - bool isSequential() const Q_DECL_OVERRIDE; - bool open(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; + bool isSequential() const override; + bool open(QIODevice::OpenMode mode) override; protected: - qint64 readData(char* data, qint64 maxSize) Q_DECL_OVERRIDE; - qint64 writeData(const char* data, qint64 maxSize) Q_DECL_OVERRIDE; + qint64 readData(char* data, qint64 maxSize) override; + qint64 writeData(const char* data, qint64 maxSize) override; QIODevice* const m_baseDevice; diff --git a/src/streams/StoreDataStream.h b/src/streams/StoreDataStream.h index 414343854..9f39d6a7c 100644 --- a/src/streams/StoreDataStream.h +++ b/src/streams/StoreDataStream.h @@ -26,11 +26,11 @@ class StoreDataStream : public LayeredStream public: explicit StoreDataStream(QIODevice* baseDevice); - bool open(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; + bool open(QIODevice::OpenMode mode) override; QByteArray storedData() const; protected: - qint64 readData(char* data, qint64 maxSize) Q_DECL_OVERRIDE; + qint64 readData(char* data, qint64 maxSize) override; private: QByteArray m_storedData; diff --git a/src/streams/SymmetricCipherStream.h b/src/streams/SymmetricCipherStream.h index fa446053f..b6228e1b8 100644 --- a/src/streams/SymmetricCipherStream.h +++ b/src/streams/SymmetricCipherStream.h @@ -33,13 +33,13 @@ public: SymmetricCipher::Mode mode, SymmetricCipher::Direction direction); ~SymmetricCipherStream(); bool init(const QByteArray& key, const QByteArray& iv); - bool open(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; - bool reset() Q_DECL_OVERRIDE; - void close() Q_DECL_OVERRIDE; + bool open(QIODevice::OpenMode mode) override; + bool reset() override; + void close() override; protected: - qint64 readData(char* data, qint64 maxSize) Q_DECL_OVERRIDE; - qint64 writeData(const char* data, qint64 maxSize) Q_DECL_OVERRIDE; + qint64 readData(char* data, qint64 maxSize) override; + qint64 writeData(const char* data, qint64 maxSize) override; private: void resetInternalState(); diff --git a/tests/FailDevice.h b/tests/FailDevice.h index f81259321..194d61746 100644 --- a/tests/FailDevice.h +++ b/tests/FailDevice.h @@ -20,19 +20,17 @@ #include -#include "core/Global.h" - class FailDevice : public QBuffer { Q_OBJECT public: - explicit FailDevice(int failAfter, QObject* parent = Q_NULLPTR); - bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE; + explicit FailDevice(int failAfter, QObject* parent = nullptr); + bool open(QIODevice::OpenMode openMode) override; protected: - qint64 readData(char* data, qint64 len) Q_DECL_OVERRIDE; - qint64 writeData(const char* data, qint64 len) Q_DECL_OVERRIDE; + qint64 readData(char* data, qint64 len) override; + qint64 writeData(const char* data, qint64 len) override; private: int m_failAfter; diff --git a/tests/TestAutoType.cpp b/tests/TestAutoType.cpp index 818f57c96..d18f4f66e 100644 --- a/tests/TestAutoType.cpp +++ b/tests/TestAutoType.cpp @@ -94,7 +94,7 @@ void TestAutoType::testInternal() void TestAutoType::testAutoTypeWithoutSequence() { - m_autoType->performAutoType(m_entry1, Q_NULLPTR); + m_autoType->performAutoType(m_entry1, nullptr); QCOMPARE(m_test->actionCount(), 14); QCOMPARE(m_test->actionChars(), @@ -105,7 +105,7 @@ void TestAutoType::testAutoTypeWithoutSequence() void TestAutoType::testAutoTypeWithSequence() { - m_autoType->performAutoType(m_entry1, Q_NULLPTR, "{Username}abc{PaSsWoRd}"); + m_autoType->performAutoType(m_entry1, nullptr, "{Username}abc{PaSsWoRd}"); QCOMPARE(m_test->actionCount(), 15); QCOMPARE(m_test->actionChars(), diff --git a/tests/TestKeePass2XmlReader.cpp b/tests/TestKeePass2XmlReader.cpp index b458761db..ff94e9a6d 100644 --- a/tests/TestKeePass2XmlReader.cpp +++ b/tests/TestKeePass2XmlReader.cpp @@ -98,12 +98,12 @@ void TestKeePass2XmlReader::testMetadata() QCOMPARE(m_db->metadata()->protectUrl(), true); QCOMPARE(m_db->metadata()->protectNotes(), false); QCOMPARE(m_db->metadata()->recycleBinEnabled(), true); - QVERIFY(m_db->metadata()->recycleBin() != Q_NULLPTR); + QVERIFY(m_db->metadata()->recycleBin() != nullptr); QCOMPARE(m_db->metadata()->recycleBin()->name(), QString("Recycle Bin")); QCOMPARE(m_db->metadata()->recycleBinChanged(), genDT(2010, 8, 25, 16, 12, 57)); - QVERIFY(m_db->metadata()->entryTemplatesGroup() == Q_NULLPTR); + QVERIFY(m_db->metadata()->entryTemplatesGroup() == nullptr); QCOMPARE(m_db->metadata()->entryTemplatesGroupChanged(), genDT(2010, 8, 8, 17, 24, 19)); - QVERIFY(m_db->metadata()->lastSelectedGroup() != Q_NULLPTR); + QVERIFY(m_db->metadata()->lastSelectedGroup() != nullptr); QCOMPARE(m_db->metadata()->lastSelectedGroup()->name(), QString("NewDatabase")); QVERIFY(m_db->metadata()->lastTopVisibleGroup() == m_db->metadata()->lastSelectedGroup()); QCOMPARE(m_db->metadata()->historyMaxItems(), -1); diff --git a/tests/TestRandom.cpp b/tests/TestRandom.cpp index 40ab702db..b37b5ced3 100644 --- a/tests/TestRandom.cpp +++ b/tests/TestRandom.cpp @@ -19,6 +19,7 @@ #include "tests.h" #include "core/Endian.h" +#include "core/Global.h" #include diff --git a/tests/TestRandom.h b/tests/TestRandom.h index a308f36e5..c879f9450 100644 --- a/tests/TestRandom.h +++ b/tests/TestRandom.h @@ -18,7 +18,6 @@ #ifndef KEEPASSX_TESTRANDOM_H #define KEEPASSX_TESTRANDOM_H -#include "core/Global.h" #include "crypto/Random.h" #include @@ -27,7 +26,7 @@ class RandomBackendTest : public RandomBackend { public: RandomBackendTest(); - void randomize(void* data, int len) Q_DECL_OVERRIDE; + void randomize(void* data, int len) override; void setNextBytes(const QByteArray& nextBytes); private: