summaryrefslogtreecommitdiffstats
path: root/test.cpp
diff options
context:
space:
mode:
authorOrochimarufan <orochimarufan.x3@gmail.com>2013-02-25 22:47:03 +0100
committerOrochimarufan <orochimarufan.x3@gmail.com>2013-03-22 13:56:57 +0100
commitf4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb (patch)
tree595a93410af4ff4e238d27d78b030c595915d4cc /test.cpp
parentf01bf10dc511268ead551a191a6a3211c006ba44 (diff)
downloadMultiMC-f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb.tar
MultiMC-f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb.tar.gz
MultiMC-f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb.tar.lz
MultiMC-f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb.tar.xz
MultiMC-f4c9cb8c1d395422b7e4f1c27ac92b6df08a39bb.zip
refactor indendation, fix a bug in MinecraftProcess & fix a bug in
InstanceLauncher
Diffstat (limited to 'test.cpp')
-rw-r--r--test.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/test.cpp b/test.cpp
index 26600220..2b015454 100644
--- a/test.cpp
+++ b/test.cpp
@@ -10,51 +10,51 @@ using namespace Util::Commandline;
int main(int argc, char **argv)
{
- QCoreApplication app(argc, argv);
- app.setApplicationName("MMC Keyring test");
- app.setOrganizationName("Orochimarufan");
-
- Parser p;
- p.addArgument("user", false);
- p.addArgument("password", false);
- p.addSwitch("set");
- p.addSwitch("get");
- p.addSwitch("list");
- p.addOption("service", "Test");
- p.addShortOpt("service", 's');
-
- QHash<QString, QVariant> args;
- try {
- args = p.parse(app.arguments());
- } catch (ParsingError) {
- std::cout << "Syntax error." << std::endl;
- return 1;
- }
-
- if (args["set"].toBool()) {
- if (args["user"].isNull() || args["password"].isNull()) {
- std::cout << "set operation needs bot user and password set" << std::endl;
- return 1;
- }
-
- return Keyring::instance()->storePassword(args["service"].toString(),
- args["user"].toString(), args["password"].toString());
- } else if (args["get"].toBool()) {
- if (args["user"].isNull()) {
- std::cout << "get operation needs user set" << std::endl;
- return 1;
- }
-
- std::cout << "Password: " << qPrintable(Keyring::instance()->getPassword(args["service"].toString(),
- args["user"].toString())) << std::endl;
- return 0;
- } else if (args["list"].toBool()) {
- QStringList accounts = Keyring::instance()->getStoredAccounts(args["service"].toString());
- std::cout << "stored accounts:" << std::endl << '\t' << qPrintable(accounts.join("\n\t")) << std::endl;
- return 0;
- } else {
- std::cout << "No operation given!" << std::endl;
- std::cout << qPrintable(p.compileHelp(argv[0])) << std::endl;
- return 1;
- }
+ QCoreApplication app(argc, argv);
+ app.setApplicationName("MMC Keyring test");
+ app.setOrganizationName("Orochimarufan");
+
+ Parser p;
+ p.addArgument("user", false);
+ p.addArgument("password", false);
+ p.addSwitch("set");
+ p.addSwitch("get");
+ p.addSwitch("list");
+ p.addOption("service", "Test");
+ p.addShortOpt("service", 's');
+
+ QHash<QString, QVariant> args;
+ try {
+ args = p.parse(app.arguments());
+ } catch (ParsingError) {
+ std::cout << "Syntax error." << std::endl;
+ return 1;
+ }
+
+ if (args["set"].toBool()) {
+ if (args["user"].isNull() || args["password"].isNull()) {
+ std::cout << "set operation needs bot user and password set" << std::endl;
+ return 1;
+ }
+
+ return Keyring::instance()->storePassword(args["service"].toString(),
+ args["user"].toString(), args["password"].toString());
+ } else if (args["get"].toBool()) {
+ if (args["user"].isNull()) {
+ std::cout << "get operation needs user set" << std::endl;
+ return 1;
+ }
+
+ std::cout << "Password: " << qPrintable(Keyring::instance()->getPassword(args["service"].toString(),
+ args["user"].toString())) << std::endl;
+ return 0;
+ } else if (args["list"].toBool()) {
+ QStringList accounts = Keyring::instance()->getStoredAccounts(args["service"].toString());
+ std::cout << "stored accounts:" << std::endl << '\t' << qPrintable(accounts.join("\n\t")) << std::endl;
+ return 0;
+ } else {
+ std::cout << "No operation given!" << std::endl;
+ std::cout << qPrintable(p.compileHelp(argv[0])) << std::endl;
+ return 1;
+ }
}