13 #include "rcdiscover-gui/resources/logo_128.xpm"
16 #include <FL/Fl_Pixmap.H>
17 #include <FL/Fl_RGB_Image.H>
18 #include <FL/fl_ask.H>
36 WSAStartup(MAKEWORD(2, 2), &wsaData);
48 int main(
int argc,
char *argv[])
67 const char *dir=getenv(
"USERPROFILE");
69 if (dir && dir[0] !=
'\0')
72 if (name[name.size()-1] !=
'\\')
77 name.append(
"\\AppData");
79 name.append(
"\\Local");
81 name.append(
"\\rcdiscover");
83 name.append(
"\\rcdiscover.txt");
86 const char *dir=getenv(
"HOME");
88 if (dir && dir[0] !=
'\0')
91 if (name[name.size()-1] !=
'/')
96 name.append(
".config");
97 mkdir(name.c_str(), 0777);
98 name.append(
"/rcdiscover");
104 std::ifstream in(name);
108 while (in >> key >> value)
110 if (value.size() > 0)
112 if (key ==
"width") width=std::stoi(value);
113 if (key ==
"height") height=std::stoi(value);
114 if (key ==
"only_rc") only_rc=std::stoi(value);
115 if (key ==
"filter") filter=value;
116 if (key ==
"sort_col") sort_col=std::stoi(value);
117 if (key ==
"sort_down") sort_down=
static_cast<bool>(std::stoi(value));
133 Fl::background(248, 248, 248);
143 Fl_Pixmap icon_xpm(logo_128_xpm);
144 Fl_RGB_Image icon_rgb(&icon_xpm, FL_GRAY);
145 window->icon(&icon_rgb);
146 window->xclass(
"rcdiscover");
151 window->show(argc, argv);
161 std::ofstream out(name);
165 out <<
"width " << window->w() << std::endl;
166 out <<
"height " << window->h() << std::endl;
170 if (filter.size() > 0)
172 out <<
"filter " << filter << std::endl;
175 out <<
"sort_col " << sort_col << std::endl;
176 out <<
"sort_down " << sort_down << std::endl;
189 catch (
const std::exception &ex)
191 fl_alert(
"%s", ex.what());