00001 #ifndef _RQT_MRTA_MRTA_WIDGET_H_ 00002 #define _RQT_MRTA_MRTA_WIDGET_H_ 00003 00004 #include <QMessageBox> 00005 #include <QVector> 00006 #include <QWidget> 00007 #include <pluginlib/class_loader.h> 00008 #include <rqt_gui_cpp/plugin.h> 00009 00010 namespace mrta 00011 { 00012 class System; 00013 } 00014 00015 namespace utilities 00016 { 00017 class MessageSubscriberRegistry; 00018 } 00019 00020 namespace Ui 00021 { 00022 class RqtMrtaWidget; 00023 } 00024 00025 namespace rqt_mrta 00026 { 00027 namespace config 00028 { 00029 namespace application 00030 { 00031 class RqtMrtaApplication; 00032 } 00033 00034 namespace architecture 00035 { 00036 class RqtMrtaArchitecture; 00037 } 00038 } 00039 00040 typedef config::application::RqtMrtaApplication RqtMrtaApplicationConfig; 00041 typedef config::architecture::RqtMrtaArchitecture RqtMrtaArchitectureConfig; 00042 00043 class RqtMrtaWidget : public QWidget 00044 { 00045 Q_OBJECT 00046 public: 00047 RqtMrtaWidget(QWidget* parent, const qt_gui_cpp::PluginContext& context); 00048 virtual ~RqtMrtaWidget(); 00049 00050 private: 00051 typedef boost::shared_ptr<rqt_gui_cpp::Plugin> PluginPtr; 00052 typedef QVector<PluginPtr> VectorPluginPtr; 00053 Ui::RqtMrtaWidget* ui_; 00054 RqtMrtaApplicationConfig* application_config_; 00055 RqtMrtaArchitectureConfig* architecture_config_; 00056 utilities::MessageSubscriberRegistry* registry_; 00057 qt_gui_cpp::PluginContext context_; 00058 VectorPluginPtr external_plugins_; 00059 pluginlib::ClassLoader<rqt_gui_cpp::Plugin> loader_; 00060 mrta::System* system_; 00061 00062 private: 00063 void clear(); 00064 void loadSystem(RqtMrtaApplicationConfig* application_config = NULL); 00065 void loadApplication(const QString& url = ""); 00066 void loadArchitecture(const QString& url = ""); 00067 void loadRobots(); 00068 QMap<QString, QString> findPlugins(const QString& attribute) const; 00069 QString askItem(const char* title, const char* label, 00070 const QStringList& items); 00071 void showMessage(const QString& title, const QString& message = "", 00072 QMessageBox::Icon icon = QMessageBox::Critical) const; 00073 00074 private slots: 00075 void newApplicationPushButtonClicked(); 00076 void openApplicationPushButtonClicked(); 00077 void newArchitecturePushButtonClicked(); 00078 void openArchitecturePushButtonClicked(); 00079 }; 00080 } 00081 00082 #endif // _RQT_MRTA_MRTA_WIDGET_H_