]> vaikene.ee Git - evaf/blobdiff - src/apps/PswGen/Generator/module.cpp
Modified the PswGen application to follow the tutorial.
[evaf] / src / apps / PswGen / Generator / module.cpp
similarity index 77%
rename from src/apps/PswGen/Generator/generator.cpp
rename to src/apps/PswGen/Generator/module.cpp
index 01f1a93121864a65ef7fc78e4a1c80993527dc50..27354f52a630575fa5e9e1ff3f99d3f58b501923 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * @file PswGen/Generator/generator.cpp
+ * @file PswGen/Generator/module.cpp
  * @brief Implementation of the iGenerator interface
  * @author Enar Vaikene
  *
@@ -17,7 +17,7 @@
  * Agreement provided with the Software.
  */
 
-#include "generator.h"
+#include "module.h"
 #include "version.h"
 
 #include <Common/iLogger>
@@ -25,6 +25,9 @@
 
 #include <QtCore>
 
+VER_EXPORT_VERSION_INFO()
+Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::Generator::Module)
+
 using namespace eVaf;
 using namespace eVaf::PswGen;
 using namespace eVaf::PswGen::Generator;
@@ -33,7 +36,6 @@ using namespace eVaf::PswGen::Generator;
 
 Module::Module()
     : Plugins::iPlugin()
-    , mReady(false)
 {
     setObjectName(QString("%1.%2").arg(VER_MODULE_NAME_STR).arg(__FUNCTION__));
 
@@ -49,15 +51,10 @@ Module::~Module()
     EVAF_INFO("%s destroyed", qPrintable(objectName()));
 }
 
-bool Module::init(const QString & args)
+bool Module::init(QString const & args)
 {
     Q_UNUSED(args);
 
-    if (!mGenerator->init())
-        return false;
-
-    mReady = true;
-
     EVAF_INFO("%s initialized", qPrintable(objectName()));
 
     return true;
@@ -65,10 +62,6 @@ bool Module::init(const QString & args)
 
 void Module::done()
 {
-    mReady = false;
-
-    mGenerator->done();
-
     EVAF_INFO("%s finalized", qPrintable(objectName()));
 }
 
@@ -92,20 +85,10 @@ GeneratorImpl::~GeneratorImpl()
     EVAF_INFO("%s destroyed", qPrintable(objectName()));
 }
 
-bool GeneratorImpl::init()
-{
-    EVAF_INFO("%s initialized", qPrintable(objectName()));
-
-    return true;
-}
-
-void GeneratorImpl::done()
+QString GeneratorImpl::generatePassword(QString const & name, QString const & masterPassword, int length, uint flags) const
 {
-    EVAF_INFO("%s finalized", qPrintable(objectName()));
-}
+    Q_UNUSED(flags);
 
-QString GeneratorImpl::generatePassword(char const * const name, char const * const masterPassword, int length, uint flags)
-{
     QByteArray inputString = QString("%1%2").arg(name).arg(masterPassword).toLatin1();
     QCryptographicHash hash(QCryptographicHash::Md5);
     hash.addData(inputString);
@@ -115,9 +98,3 @@ QString GeneratorImpl::generatePassword(char const * const name, char const * co
     else
         return result;
 }
-
-
-//-------------------------------------------------------------------
-
-VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Module)