]> Some of my projects - AniAddCLI.git/commitdiff
Use QTextStream instead of iostream.
authorAPTX <marek321@gmail.com>
Thu, 12 Jan 2012 14:23:15 +0000 (15:23 +0100)
committerAPTX <marek321@gmail.com>
Thu, 12 Jan 2012 14:23:15 +0000 (15:23 +0100)
main.cpp

index ddbe1ed2cd1081c021c7c002037a0f3c3cfdbd8a..4ce6d9b3dd5ab849bbcfbc23ad77e97ddb2912a0 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -3,7 +3,6 @@
 #include <QTime>
 #include <QSettings>
 #include <QStringList>
-#include <iostream>
 #include <AniDBUdpClient/MyListState>
 #include <QxtCommandOptions>
 #include <QDebug>
@@ -118,9 +117,11 @@ int main(int argc, char *argv[])
 
        opts.parse(a.arguments());
 
+       QTextStream cout(stdout, QIODevice::WriteOnly);
+
        if (opts.count("help")) {
-               std::cout << QCoreApplication::applicationName().toUtf8().constData() << " v" << QCoreApplication::applicationVersion().toUtf8().constData()
-                                 << " by " << QCoreApplication::organizationName().toUtf8().constData() << std::endl << std::endl;
+               cout << QCoreApplication::applicationName() << " v" << QCoreApplication::applicationVersion()
+                        << " by " << QCoreApplication::organizationName() << endl << endl;
                opts.showUsage();
                return -1;
        }
@@ -231,7 +232,6 @@ int main(int argc, char *argv[])
        if (opts.count("print-settings"))
        {
                AniDBUdpClient::Client *c = AniDBUdpClient::Client::instance();
-               using namespace std;
                cout << "Actions:" << endl;
                cout << "  Add:          " << (add ? "Yes" : "No") << endl;
                cout << "  Rename:       " << (rename ? "Yes" : "No") << endl;
@@ -239,22 +239,22 @@ int main(int argc, char *argv[])
                cout << "  Print Hash:   " << (hash ? "Yes" : "No") << endl << endl;
 
                cout << "Account settings:" << endl;
-               cout << "  User:   " << c->user().toUtf8().constData() << endl;
+               cout << "  User:   " << c->user() << endl;
                cout << "  Pass:   " << (c->pass().isEmpty() ? "" : "****") << endl;
                cout << "  ApiKey: " << (c->apiKey().isEmpty() ? "" : "****") << endl << endl;
 
                cout << "Connection settings:" << endl;
-               cout << "  Host:       " << c->host().toUtf8().constData() << endl;
+               cout << "  Host:       " << c->host() << endl;
                cout << "  Host port:  " << c->hostPort() << endl;
                cout << "  Local port: " << c->localPort() << endl;
                cout << "  Encryption: " << (c->encryptionEnabled() ? "1 (Enabled)" : "0 (Disabled)") << endl << endl;
 
                cout << "MyList settings:" << endl;
-               cout << "  State:   " << State2String(state.state()).toUtf8().constData() << endl;
-               cout << "  Watched: " << ViewedState2String(state.viewed()).toUtf8().constData() << endl;
-               cout << "  Source:  " << state.source().toUtf8().constData() << endl;
-               cout << "  Storage: " << state.storage().toUtf8().constData() << endl;
-               cout << "  Other:   " << state.other().toUtf8().constData() << endl;
+               cout << "  State:   " << State2String(state.state()) << endl;
+               cout << "  Watched: " << ViewedState2String(state.viewed()) << endl;
+               cout << "  Source:  " << state.source() << endl;
+               cout << "  Storage: " << state.storage() << endl;
+               cout << "  Other:   " << state.other() << endl;
                cout << endl;
        }
 
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
 
        if (qApp->arguments().count() < 2)
        {
-               std::cout << "Try " << qApp->arguments()[0].toUtf8().constData() << " -help for usage." << std::endl;
+               cout << "Try " << qApp->arguments()[0] << " -help for usage." << endl;
        }
 
        AniAddCli t;