Replaced all std::cout with kDebug.
[tagua/yd.git] / tests / options / main.cpp
blob7b61910e8063eece59fdcfa7865a51ae286842e6
2 #include <iostream>
3 #include <kapplication.h>
4 #include <kcmdlineargs.h>
5 #include <QWidget>
6 #include "common.h"
7 #include "settings.h"
8 #include "option.h"
9 #include "luaapi/loader.h"
12 OptList opts = OptList()
13 << OptPtr(new BoolOpt("teto", "Is this C++?", true))
14 << OptPtr(new BoolOpt("fufi", "Fufi?", true, OptList()
15 << OptPtr(new BoolOpt("gni", "Gni gni?", true, OptList()
16 << OptPtr(new ColorOpt("pappa", "Pappa?", Qt::red))
17 << OptPtr(new FontOpt("ciccia", "Ciccia!", QFont("Monospace")))
19 << OptPtr(new BoolOpt("gnu", "Gnu gnu?", false))
21 << OptPtr(new IntOpt("ratta", "Ratta:", 5, 0, 10))
22 << OptPtr(new ComboOpt("schiatta", "Fai a Paolo:", QStringList()
23 << "Incula" << "Impala" << "Spezza" << "Uccidi" << "Tortura" ))
24 << OptPtr(new SelectOpt("affa", "Affanculo:", BoolOptList()
25 << BoolOptPtr(new BoolOpt("ght", "Case1", true, OptList()
26 << OptPtr(new BoolOpt("gni2", "Gni gni?", true))
28 << BoolOptPtr(new BoolOpt("cvb", "Case2", true, OptList()
29 << OptPtr(new StringOpt("sheshe", "She She:", "Sho shu?"))
30 << OptPtr(new UrlOpt("shesdsshe", "She She:", "Sho shu?"))
32 ));
34 int main(int argc, char *argv[]) {
35 KCmdLineArgs::init(argc, argv, argv[0], 0, KLocalizedString(), NULL);
36 KApplication app;
38 LuaApi::Loader ja(NULL);
39 //Settings sets("test.settings");
40 ja.runFile("test.lua");
41 OptList opts2 = ja.getOptList("options");
42 if(ja.error())
43 kDebug()()() << ja.errorString() << std::endl;
44 else {
45 /*sets.qSettings()->beginGroup("o2");
46 options_list_load_from_settings(opts2, sets);
47 sets.qSettings()->endGroup();*/
48 dump_options_list(opts2);
49 OptionWidget& w2 = *new OptionWidget(opts2);
50 w2.show();
52 /*sets.qSettings()->beginGroup("o1");
53 options_list_load_from_settings(opts, sets);
54 sets.qSettings()->endGroup();*/
55 OptionWidget w(opts);
56 w.show();
57 app.exec();
59 /*sets.qSettings()->beginGroup("o1");
60 options_list_save_to_settings(opts, sets);
61 sets.qSettings()->endGroup();
62 sets.qSettings()->beginGroup("o2");
63 options_list_save_to_settings(opts2, sets);
64 sets.qSettings()->endGroup();*/
66 return 0;