18#define HELP_MESSAGE "\
20 yarpmanager [option]\n\n\
22 --load_application Path to application to load in the main window\n\
23 --from Configuration file name\n\
24 --application Path to application to open\n\
33 --connection_failure \n\
36 --add_current_dir add the current dir to the search path\n\
37 --elapsed_time if present the time stamp for log messages will be relative to the GUI start time\n\
40#define DEF_CONFIG_FILE "ymanager.ini"
56int main(
int argc,
char *argv[])
66 HWND hwnd = GetConsoleWindow();
67 HWND hide = FindWindowA(
"ConsoleWindowClass",NULL);
70 QApplication a(argc, argv);
84 if(config.
check(
"help"))
93 bool add_curr_dir =
false;
94 if(config.
check(
"add_current_dir"))
98 const int cur_dir_max_size=512;
99 char current_dir[cur_dir_max_size]; current_dir[0]=0;
101 config.
put(
"current_dir", current_dir);
103 std::string inifile=rf.
findFile(
"from");
105 size_t lastSlash=inifile.rfind(
'/');
106 if (lastSlash!=std::string::npos){
107 inipath=inifile.substr(0, lastSlash+1);
109 lastSlash=inifile.rfind(
'\\');
110 if (lastSlash!=std::string::npos){
111 inipath=inifile.substr(0, lastSlash+1);
115 if(!config.
check(
"ymanagerini_dir")){
116 config.
put(
"ymanagerini_dir", inipath);
120 if(!config.
check(
"apppath")){
129 QString appPathsStr=
"";
130 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
131 appPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
133 for (
size_t ind=0; ind < appPaths2.
size(); ++ind){
134 appPathsStr += (appPaths2.
get(ind).
asString() +
";").c_str();
138 appPathsStr += (current_dir + std::string(
";")).c_str();
140 std::string sss= appPathsStr.toLatin1().data();
141 config.
put(
"apppath", appPathsStr.toLatin1().data());
144 if(!config.
check(
"modpath")){
147 QString modPathsStr=
"";
148 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
149 modPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
153 modPathsStr += (current_dir + std::string(
";")).c_str();
155 config.
put(
"modpath", modPathsStr.toLatin1().data());
158 if(!config.
check(
"respath")){
161 QString resPathsStr=
"";
162 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
163 resPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
167 resPathsStr += (current_dir + std::string(
";")).c_str();
169 config.
put(
"respath", resPathsStr.toLatin1().data());
172 if(!config.
check(
"templpath")){
173 appPaths=rf.
findPaths(
"templates/applications");
175 QString templPathsStr=
"";
176 for (
size_t ind=0; ind < appPaths.
size(); ++ind){
177 templPathsStr += (appPaths.
get(ind).
asString() +
";").c_str();
181 templPathsStr += (current_dir + std::string(
";")).c_str();
183 config.
put(
"templpath", templPathsStr.toLatin1().data());
187 if(!config.
check(
"load_subfolders")){
188 config.
put(
"load_subfolders",
"yes");
191 if(!config.
check(
"watchdog")){
192 config.
put(
"watchdog",
"no");
195 if(!config.
check(
"module_failure")){
196 config.
put(
"module_failure",
"prompt");
199 if(!config.
check(
"connection_failure")){
200 config.
put(
"connection_failure",
"prompt");
203 if(!config.
check(
"auto_connect")){
204 config.
put(
"auto_connect",
"no");
207 if(!config.
check(
"auto_dependency")){
208 config.
put(
"auto_dependency",
"no");
211 if(!config.
check(
"elapsed_time"))
void init(yarp::os::Property config)
Init the application with the current configuration.
Singleton class For storing execution start time.
void setStartTime(std::string startTimeStr)
Set the starting time from a string in HH:MM:SS format.
static ClockStart & getInstance()
A simple collection of objects that can be described and transmitted in a portable way.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Utilities for manipulating the YARP network, including initialization and shutdown.
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
These options are loosely based on http://wiki.icub.org/wiki/YARP_ResourceFinder.
SearchLocations searchLocations
Helper class for finding config files and other external resources.
bool setDefaultContext(const std::string &contextName)
Sets the context for the current ResourceFinder object.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
std::string toString() const override
Return a standard text representation of the content of the object.
static ResourceFinder & getResourceFinderSingleton()
Access a ResourceFinder singleton whose lifetime will match that of the YARP library.
yarp::os::Bottle findPaths(const std::string &name)
Expand a partial path to a list of paths.
std::string findFile(const std::string &name)
Find the full path to a file.
bool setDefaultConfigFile(const std::string &fname)
Provide a default value for the configuration file (can be overridden from command line with the –fro...
virtual std::string asString() const
Get string value.
int main(int argc, char *argv[])
void onSignal(int signum)
char * getcwd(char *buf, size_t size)
Portable wrapper for the getcwd() function.
The main, catch-all namespace for YARP.