YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
7#include <QApplication>
8
9#include <yarp/dataplayer/YarpDataplayer.h>
10
11#if defined(_WIN32)
12 #pragma warning (disable : 4099)
13 #pragma warning (disable : 4250)
14 #pragma warning (disable : 4520)
15#endif
16
17#include <iostream>
19#include <yarp/os/Network.h>
20#include <QtGlobal>
21
22#include <yarp/os/Os.h>
23
24#if defined(_WIN32)
25 #include <windows.h>
26#else
27 #include <cerrno>
28 #include <sys/types.h>
29 #include <csignal>
30#endif
31
32using namespace yarp::os;
33
34int main(int argc, char *argv[])
35{
36#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
37 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
38#else
39 qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("auto"));
40#endif
42 QApplication a(argc, argv);
43
45 if (!yarp.checkNetwork()){
46 fprintf(stderr, "Sorry YARP network does not seem to be available, is the yarp server available?\n");
47 return 1;
48 }
49
51 rf.setDefaultConfigFile( "config.ini" ); //overridden by --from parameter
52 rf.setDefaultContext( "yarpdataplayer" ); //overridden by --context parameter
53 rf.configure( argc, argv );
54
55 MainWindow w(rf);
56
57 if (rf.check("hidden")){
58 w.hide();
59 }else{
60 w.show();
61 }
62
63 int returnFlag = (a.exec()!=0?1:0);
65 return returnFlag;
66}
MainWindow class.
Definition display.h:22
A mini-server for performing network communication in the background.
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:706
Helper class for finding config files and other external resources.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
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.
bool setDefaultConfigFile(const std::string &fname)
Provide a default value for the configuration file (can be overridden from command line with the –fro...
int main(int argc, char *argv[])
Definition main.cpp:34
An interface to the operating system, including Port based communication.
void setEnergySavingModeState(bool enabled)
Toggle the OS energy saving feature.
Definition Os.cpp:110
The main, catch-all namespace for YARP.
Definition dirs.h:16