]> Some of my projects - AniAddCLI.git/commitdiff
Only show the first error.
authorAPTX <marek321@gmail.com>
Sun, 15 Jan 2012 16:17:33 +0000 (17:17 +0100)
committerAPTX <marek321@gmail.com>
Sun, 15 Jan 2012 16:17:33 +0000 (17:17 +0100)
aniaddcli.cpp
aniaddcli.h

index 435709f95dc4f53f8e33ef9e8669cd2510d40004..c3e495337f341c3565c266f403f9205ed6e7b873 100644 (file)
@@ -5,7 +5,7 @@
 #include <QFileInfo>
 
 AniAddCli::AniAddCli(QObject *parent) :
-       QObject(parent), printHash(false), cout(stdout, QIODevice::WriteOnly), showNewVersionInfo(false), closing(false)
+       QObject(parent), printHash(false), cout(stdout, QIODevice::WriteOnly), showNewVersionInfo(false), closing(false), errorPrinted(false)
 {
        AniDBUdpClient::Client::instance()->setIdlePolicy(AniDBUdpClient::ImmediateLogoutIdlePolicy);;
        connect(AniDBUdpClient::Client::instance(), SIGNAL(connectionError()), this, SLOT(handleError()));
@@ -165,7 +165,9 @@ void AniAddCli::handleStatusUpdate(AniDBUdpClient::File::Action action, AniDBUdp
 
 void AniAddCli::handleError()
 {
-       cout << "[FAIL] Connection error: " << AniDBUdpClient::Client::instance()->errorString() << endl;
+       if (!errorPrinted)
+               cout << endl << "[FAIL] Connection error: " << AniDBUdpClient::Client::instance()->errorString() << endl << endl;
+       errorPrinted = true;
        emit finished(1);
 }
 
index e3e2291f2fecd12a9427a2b3f943a3ffe9320e0d..2d1ce841f5711773dd7e837914c6ce9b8193329c 100644 (file)
@@ -40,6 +40,7 @@ private:
        bool printHash;
        bool showNewVersionInfo;
        bool closing;
+       bool errorPrinted;
 
        QTextStream cout;
 };