X-Git-Url: https://vaikene.ee/gitweb/pswgen09.html?a=blobdiff_plain;f=src%2Fapps%2FPswGen%2FCLI%2Fcli.cpp;h=b27fa8a712b905d92f7d7c3383b21493991c5c36;hb=4c0329c5c2690bde28212c89029015a5da4c7e34;hp=51ea2b6690351cafa0dc2f654156a856fd2a03b8;hpb=2abf509a06bab00baa0746d4911ca8b60f58e08a;p=evaf diff --git a/src/apps/PswGen/CLI/cli.cpp b/src/apps/PswGen/CLI/cli.cpp index 51ea2b6..b27fa8a 100644 --- a/src/apps/PswGen/CLI/cli.cpp +++ b/src/apps/PswGen/CLI/cli.cpp @@ -3,7 +3,7 @@ * @brief Command line interface for the PswGen application * @author Enar Vaikene * - * Copyright (c) 2011-2012 Enar Vaikene + * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * @@ -18,7 +18,6 @@ */ #include "cli.h" -#include "version.h" #include #include @@ -33,7 +32,7 @@ #include -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) # include # include #endif @@ -42,7 +41,6 @@ #endif VER_EXPORT_VERSION_INFO() -Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::CLI::Module) //------------------------------------------------------------------- @@ -55,8 +53,8 @@ int const Module::DefaultPasswordLength = 16; Module::Module() : Plugins::iPlugin() , mReady(false) - , mGenerator(0) - , mStorage(0) + , mGenerator(nullptr) + , mStorage(nullptr) , mEvReady(0) { setObjectName(QString("%1-Module").arg(VER_MODULE_NAME_STR)); @@ -70,10 +68,10 @@ Module::~Module() bool Module::init(QString const & args) { - Q_UNUSED(args); + Q_UNUSED(args) // Get the iGenerator interface - EVAF_TEST_X((mGenerator = evafQueryInterface("iGenerator")), "No iGenerator interface"); + EVAF_TEST_X((mGenerator = evafQueryInterface("iGenerator")), "No iGenerator interface") // Get the optional iStorage interface mStorage = evafQueryInterface("iStorage"); @@ -82,10 +80,10 @@ bool Module::init(QString const & args) // Get the iEventQueue interface and subscribe to the 'ready' event Common::iEventQueue * eventQueue = evafQueryInterface("iEventQueue"); - EVAF_TEST_X(eventQueue, "No iEventQueue interface"); + EVAF_TEST_X(eventQueue, "No iEventQueue interface") // Subscribe to the 'ready' event - EVAF_TEST_X((mEvReady = eventQueue->subscribeEvent(eventQueue->queryEvent(Common::iApp::EV_READY), this)), "No 'ready' event"); + EVAF_TEST_X((mEvReady = eventQueue->subscribeEvent(eventQueue->queryEvent(Common::iApp::EV_READY), this)), "No 'ready' event") mReady = true; @@ -124,7 +122,7 @@ bool Module::event(QEvent * e) QString Module::readPassword() { bool noEcho = false; -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) termios oldt; tcgetattr(STDIN_FILENO, &oldt); termios newt = oldt; @@ -147,7 +145,7 @@ QString Module::readPassword() cout << endl; } -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) tcsetattr(STDIN_FILENO, TCSANOW, &oldt); #elif defined Q_OS_WIN32 SetConsoleMode(hStdin, mode);