From: APTX Date: Sun, 15 Jan 2012 16:17:33 +0000 (+0100) Subject: Only show the first error. X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=e9ed0757a37d03ce842bb724c84b7f0f1adc1943;p=AniAddCLI.git Only show the first error. --- diff --git a/aniaddcli.cpp b/aniaddcli.cpp index 435709f..c3e4953 100644 --- a/aniaddcli.cpp +++ b/aniaddcli.cpp @@ -5,7 +5,7 @@ #include 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); } diff --git a/aniaddcli.h b/aniaddcli.h index e3e2291..2d1ce84 100644 --- a/aniaddcli.h +++ b/aniaddcli.h @@ -40,6 +40,7 @@ private: bool printHash; bool showNewVersionInfo; bool closing; + bool errorPrinted; QTextStream cout; };