diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..b6dd382 --- /dev/null +++ b/.clang-format @@ -0,0 +1,72 @@ +--- +AccessModifierOffset: 0 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine : false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: TopLevelDefinitions +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: true +BreakAfterJavaFieldAnnotations: true +BreakBeforeBraces: Allman +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +BreakStringLiterals: true +ColumnLimit: 120 +CommentPragmas: "
.*?
" +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +PointerAlignment: Right +ForEachMacros: [ 'BOOST_FOREACH' ] +IncludeCategories: + - Regex: '^<(gtest|gmock)' + Priority: 8 + - Regex: '^( $ - $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/backend ${Intl_INCLUDE_DIRS}) target_link_libraries(sgpemv2-backend @@ -609,6 +609,16 @@ target_sources(sgpemv2 # ------------------------------------------- +install(TARGETS sgpemv2 sgpemv2-backend + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/sgpemv2 + ${CMAKE_CURRENT_BINARY_DIR}/src/backend/sgpemv2 + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PATTERN "*.in" EXCLUDE) + install(FILES data/logo.png ui/add-process-dialog.ui ui/add-request-dialog.ui diff --git a/src/backend/sgpemv2/config.h.in b/src/backend/sgpemv2/config.h.in index 853552f..d21614b 100644 --- a/src/backend/sgpemv2/config.h.in +++ b/src/backend/sgpemv2/config.h.in @@ -4,4 +4,5 @@ #define UIDIR "@uidir@" #define POLDIR "@policiesdir@" #define PLUGDIR "@plugindir@" +#define EXAMPLESDIR "@examplesdir@" diff --git a/src/cairo_widget.cc b/src/cairo_widget.cc index 7a5ccff..60cbd47 100644 --- a/src/cairo_widget.cc +++ b/src/cairo_widget.cc @@ -35,8 +35,8 @@ using namespace sgpem; CairoWidget::CairoWidget() : Glib::ObjectBase("sgpem_CairoWidget"), Gtk::Widget(), - _draw_w(1), _draw_h(1), - _client_w(0), _client_h(0), + _draw_w(1), _draw_h(1), + _client_w(0), _client_h(0), _pixbuf_w(0), _pixbuf_h(0), _need_redraw(true), _scaling_mode(scaling_none), _buf(NULL) @@ -93,9 +93,9 @@ CairoWidget::on_realize() attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = get_events() | GDK_EXPOSURE_MASK; attributes.window_type = GDK_WINDOW_CHILD; - + _client_w = alloc.get_width(); - _client_h = alloc.get_height(); + _client_h = alloc.get_height(); static const gint attributes_mask = Gdk::WA_X | Gdk::WA_Y; @@ -124,7 +124,7 @@ CairoWidget::on_size_allocate(const Gtk::Allocation& allocation) set_allocation(allocation); if (!_ref_gdk_window) return; - + _ref_gdk_window->move_resize(allocation.get_x(), allocation.get_y(), allocation.get_width(), allocation.get_height()); @@ -163,8 +163,8 @@ CairoWidget::on_draw (const Cairo::RefPtr& ctx) if (!_ref_gdk_window) return true; // save actual size - size_t actual_w = get_width(); - size_t actual_h = get_height(); + auto actual_w = get_width(); + auto actual_h = get_height(); // the widget must be redrawn if // - there's an explicit request(_need_redraw) @@ -183,17 +183,17 @@ CairoWidget::on_draw (const Cairo::RefPtr& ctx) // allocate only if growing, keep if shrinking. // Taking a bigger pixmap saves operations when // many window resizing occours (i.e. mouse resizing). - if(_client_w>_pixbuf_w || _client_h>_pixbuf_h) + if(_client_w > _pixbuf_w || _client_h > _pixbuf_h) { // previdence in the code: // allocate more than actually needed - _pixbuf_w = (size_t) (_client_w*1.2); - _pixbuf_h = (size_t) (_client_h*1.2); + _pixbuf_w = static_cast(_client_w * 1.2); + _pixbuf_h = static_cast(_client_h * 1.2); // allocate the pixmap _buf = Gdk::Pixbuf::create (_ref_gdk_window, 0, 0, _pixbuf_w, _pixbuf_h); } - + // Draw the widget background as the first thing. // I've seen this is how it's done in the very Gtk+ toolkit // for the GtkProgressBar widget. @@ -252,22 +252,22 @@ CairoWidget::calc_scale_factors() switch(_scaling_mode) { case scaling_none: // not necessary! - // doesn't scale + // doesn't scale _scale_x = _scale_y = 1.0; break; - + case scaling_to_w: // scale to fit in width // x and y take the same x value _scale_y = _scale_x; break; - + case scaling_to_h: // scale to fit in height // x and y take the same y value _scale_x = _scale_y; break; - + case scaling_min: // scale to fit always in window // x and y take the same minimum value @@ -276,7 +276,7 @@ CairoWidget::calc_scale_factors() else _scale_x = _scale_y; break; - + case scaling_max: // scale to fit never in window // x and y take the same mxiimum value @@ -285,7 +285,7 @@ CairoWidget::calc_scale_factors() else _scale_x = _scale_y; break; - + case scaling_all: // scale to fit stretching in window // x and y mantain the differnt calculated values diff --git a/src/cairo_widget.hh b/src/cairo_widget.hh index 6ad2a6d..e68be8b 100644 --- a/src/cairo_widget.hh +++ b/src/cairo_widget.hh @@ -40,12 +40,12 @@ namespace sgpem * - implement draw_widget() to draw in the widget client area \see draw_widget() * - should * - define calc_drawing_size() to provide correct size calculation - * - call resize_redraw() to calc size and redraw + * - call resize_redraw() to calc size and redraw * - can * - define calc_widget_size() to get predefined widget dimensions * - set the desired scaling mode \see set_scaling_mode() * - call redraw() to only redraw the widget - * + * */ class CairoWidget : public Gtk::Widget { @@ -82,7 +82,7 @@ namespace sgpem * NOTE: This scaling mode stretch the drawing and not respect the * ratio between width and height. * - */ + */ enum scaling_mode { scaling_none = 0, // without any scaling @@ -97,7 +97,7 @@ namespace sgpem * \brief Unique constructor, initialize data members. */ CairoWidget(); - + /** * \brief Widget's destructor. */ @@ -114,7 +114,7 @@ namespace sgpem * \return Previous scaling mode. */ scaling_mode set_scaling_mode(scaling_mode scaling_mode); - + /** * \brief Retrieve current scaling mode. * @@ -151,8 +151,8 @@ namespace sgpem * See gtkmm documentation for more informations. */ virtual void on_realize(); - virtual void on_unrealize(); // doesn't need to be documented. - + virtual void on_unrealize(); // doesn't need to be documented. + /** * \brief Implements standard widget's on_size_allocate() mehtod. * @@ -161,7 +161,7 @@ namespace sgpem * See gtkmm documentation for more informations. */ virtual void on_size_allocate(const Gtk::Allocation& allocation); - + /** * \brief Implements standard widget's on_size_request() mehtod. * @@ -170,7 +170,7 @@ namespace sgpem * See gtkmm documentation for more informations. */ virtual void on_size_request(Gtk::Requisition* request); - + /** * \brief Implements standard widget's on_expose_event() mehtod. * @@ -206,7 +206,7 @@ namespace sgpem * The user can implement this method to give default dimensions. * It isn't necessary because scaling (and resizing) take care of calc_drawing_size() results. */ - virtual void calc_widget_size(size_t& width, size_t& height); + virtual void calc_widget_size(int& width, int& height); /** * \brief Calculate scaling factors to apply during widget's redrawing. @@ -230,22 +230,22 @@ namespace sgpem /** * \brief Client area width of widget. */ - size_t _client_w; + int _client_w; /** * \brief Client area height of widget. */ - size_t _client_h; + int _client_h; /** * \brief Client area width of pixmap. */ - size_t _pixbuf_w; + int _pixbuf_w; /** * \brief Client area width of pixmap. */ - size_t _pixbuf_h; + int _pixbuf_h; /** * \brief Cairo x scale factor. diff --git a/src/graphical_preferences_editor.hh b/src/graphical_preferences_editor.hh index 9d317b7..d773814 100644 --- a/src/graphical_preferences_editor.hh +++ b/src/graphical_preferences_editor.hh @@ -21,6 +21,7 @@ #ifndef GRAPHICAL_PREFERENCES_EDITOR_HH #define GRAPHICAL_PREFERENCES_EDITOR_HH 1 +#include "sgpemv2/config.h" #include "sgpemv2/global_preferences.hh" #include @@ -34,61 +35,61 @@ namespace sgpem { - class PreferencesEditor - { + class PreferencesEditor + { - public: + public: - explicit PreferencesEditor(const std::string& uifile = UIDIR "/configure-dialog.ui"); + explicit PreferencesEditor(const std::string& uifile = UIDIR "/configure-dialog.ui"); - void - on_close(); + void + on_close(); - void - on_add_plugins_dir(); + void + on_add_plugins_dir(); - void - on_remove_plugins_dir(); + void + on_remove_plugins_dir(); - void - on_add_policies_dir(); + void + on_add_policies_dir(); - void - on_remove_policies_dir(); + void + on_remove_policies_dir(); - void - on_set_speed(); + void + on_set_speed(); - ~PreferencesEditor(); + ~PreferencesEditor(); - private: + private: - void - update_policies(); + void + update_policies(); - void - update_plugins(); + void + update_plugins(); - Glib::RefPtr _refXml; - Gtk::Dialog* preferences_dialog; + Glib::RefPtr _refXml; + Gtk::Dialog* preferences_dialog; - Gtk::TreeView* plugins_dirs_treeview; - Glib::RefPtr plugins_dirs_model; + Gtk::TreeView* plugins_dirs_treeview; + Glib::RefPtr plugins_dirs_model; - Gtk::TreeView* plugins_treeview; - Glib::RefPtr plugins_model; + Gtk::TreeView* plugins_treeview; + Glib::RefPtr plugins_model; - Gtk::TreeView* policies_dirs_treeview; - Glib::RefPtr policies_dirs_model; + Gtk::TreeView* policies_dirs_treeview; + Glib::RefPtr policies_dirs_model; - Gtk::TreeView* policies_treeview; - Glib::RefPtr policies_model; + Gtk::TreeView* policies_treeview; + Glib::RefPtr policies_model; - Gtk::SpinButton* speed_spin; + Gtk::SpinButton* speed_spin; - }; + }; } // ~ namespace diff --git a/src/gui_builder.cc b/src/gui_builder.cc index 9d90ce2..170c6ed 100644 --- a/src/gui_builder.cc +++ b/src/gui_builder.cc @@ -76,7 +76,7 @@ using namespace sgpem; void GuiBuilder::on_edit_preferences_activate() { - PreferencesEditor(); // Will run the dialog inside the constructor. + PreferencesEditor(); // Will run the dialog inside the constructor. } void @@ -140,11 +140,11 @@ void GuiBuilder::on_file_new_activate() { Simulation& sim = Simulation::get_instance(); - History& history = sim.get_history(); + History& history = sim.get_history(); ask_save(); - sim.stop(); + sim.stop(); history.clear(); set_filename(); } @@ -156,7 +156,7 @@ GuiBuilder::on_file_open_activate() if (!_filename.empty()) // Please test the following line extensively: open_file (Glib::path_get_dirname(_filename)); else - open_file (); + open_file (); } @@ -189,7 +189,7 @@ GuiBuilder::open_file(const std::string& basedir) Gtk::FileChooserDialog dialog(_("Please choose a file"), Gtk::FILE_CHOOSER_ACTION_OPEN); dialog.set_transient_for(get_initial_window()); dialog.set_current_folder (basedir); - + //Add response buttons the the dialog: dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); @@ -221,7 +221,7 @@ GuiBuilder::open_file(const std::string& basedir) } // end - if(result==Gtk::RESPONSE_OK) } - catch (std::out_of_range e) + catch (std::out_of_range& e) { Gtk::MessageDialog error(get_initial_window(), _("No serializer available.\nThere's no " @@ -230,10 +230,10 @@ GuiBuilder::open_file(const std::string& basedir) error.run(); msg = _("ERROR: No registered serializer available"); } - catch (SerializerError e) + catch (SerializerError& e) { Gtk::MessageDialog error(get_initial_window(), e.what(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); - error.run(); + error.run(); msg = _("ERROR: ") + Glib::ustring(e.what()); set_filename(); } @@ -243,7 +243,7 @@ GuiBuilder::open_file(const std::string& basedir) _refXml->get_widget("MainStatusBar", sbar); sbar->push(msg); } -} +} void @@ -262,17 +262,17 @@ GuiBuilder::on_file_save_activate() { std::vector serializers = SerializersGatekeeper::get_instance().get_registered(); - + // FIXME using the first serializer available, this // will need to be changed when multiple serializers will // be made available Serializer& serializer = *serializers.at(0); History& history = Simulation::get_instance().get_history(); - + serializer.save_snapshot(_filename, history); msg = _("File: ") + _filename + _(" saved."); } - catch (std::out_of_range e) + catch (std::out_of_range& e) { Gtk::MessageDialog error(get_initial_window(), _("No serializer available.\nThere's no registered serializer. Please check the loaded plugins."), @@ -280,13 +280,13 @@ GuiBuilder::on_file_save_activate() error.run(); msg = _("ERROR: No registered serializer available"); } - catch (SerializerError e) + catch (SerializerError& e) { Gtk::MessageDialog error(get_initial_window(), e.what(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); error.run(); msg = _("ERROR: ") + Glib::ustring(e.what()); } - + if(!msg.empty()) { Gtk::Statusbar* sbar; @@ -324,12 +324,12 @@ GuiBuilder::on_file_saveas_activate() filter_sgpem.set_name(serializer.get_filename_description()); filter_sgpem.add_pattern(Glib::ustring("*.") + serializer.get_filename_extension()); dialog.add_filter(filter_sgpem); - + Gtk::FileFilter filter_any; filter_any.set_name(_("Any files")); filter_any.add_pattern("*"); dialog.add_filter(filter_any); - + //Show the dialog and wait for a user response: int result = dialog.run(); if(result==Gtk::RESPONSE_OK) @@ -349,7 +349,7 @@ GuiBuilder::on_file_saveas_activate() } // end - if(result==Gtk::RESPONSE_OK) } - catch (std::out_of_range e) + catch (std::out_of_range& e) { Gtk::MessageDialog error(get_initial_window(), _("No serializer available.\nThere's no registered serializer. Please check the loaded plugins."), @@ -357,14 +357,14 @@ GuiBuilder::on_file_saveas_activate() error.run(); msg = _("ERROR: No registered serializer available"); } - catch (SerializerError e) + catch (SerializerError& e) { Gtk::MessageDialog error(get_initial_window(), e.what(), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); error.run(); msg = _("ERROR: ") + Glib::ustring(e.what()); set_filename(); } - + if(!msg.empty()) { Gtk::Statusbar* sbar; @@ -389,9 +389,9 @@ GuiBuilder::on_configure_cpu_policy() true, MESSAGE_WARNING, BUTTONS_OK, true); warn.run(); } - + PolicyParameters& params = policy->get_parameters(); - ConfigurePolicyDialog config_dialog(_("Configuring CPU Policy ") + policy->get_name(), + ConfigurePolicyDialog config_dialog(_("Configuring CPU Policy ") + policy->get_name(), get_initial_window(), policy->get_description(), params); if(config_dialog.run() == RESPONSE_OK) @@ -420,14 +420,14 @@ GuiBuilder::on_configure_resource_policy() } PolicyParameters& params = policy->get_parameters(); - ConfigurePolicyDialog config_dialog(_("Configuring CPU Policy ") + policy->get_name(), + ConfigurePolicyDialog config_dialog(_("Configuring CPU Policy ") + policy->get_name(), get_initial_window(), policy->get_description(), params); if(config_dialog.run() == RESPONSE_OK) { sim.stop(); sim.get_history().reset(); - } + } } @@ -437,7 +437,7 @@ GuiBuilder::populate_with_cpu_policies(Gtk::Menu& menu) using namespace Gtk; // NOTE: Please note that this code relies on the fact that a given - // policy never "disappears" at runtime. A *GatekeeperObserver should + // policy never "disappears" at runtime. A *GatekeeperObserver should // be needed to avoid dangling pointers if this behaviour changes. typedef std::vector Managers; @@ -490,8 +490,8 @@ GuiBuilder::on_selected_cpu_policy(CPUPolicy* pol) Glib::ustring(_("Impossible to select this CPU Policy.\n")) + e.what(), true, MESSAGE_ERROR, BUTTONS_OK, true); error.run(); - } - + } + // If we got here, no policy is selected. sbar->push(_("No CPU policy selected. Please select one.")); } @@ -503,7 +503,7 @@ GuiBuilder::populate_with_resource_policies(Gtk::Menu& menu) using namespace Gtk; // NOTE: Please note that this code relies on the fact that a given - // policy never "disappears" at runtime. A *GatekeeperObserver should + // policy never "disappears" at runtime. A *GatekeeperObserver should // be needed to avoid dangling pointers if this behaviour changes. typedef std::vector Managers; @@ -552,14 +552,14 @@ GuiBuilder::on_toggle_simulation_mode() { using namespace Gtk; using Glib::RefPtr; - + RefPtr uimanager = RefPtr::cast_dynamic (_refXml->get_object("UIManager")); CheckMenuItem* continuous_mode = nullptr; - - continuous_mode = dynamic_cast(uimanager->get_widget + + continuous_mode = dynamic_cast(uimanager->get_widget ("/MenuBar/Action.Simulation/Action.Simulation.ContinuousMode")); g_assert (continuous_mode != nullptr); - + if(continuous_mode->get_active() == true) Simulation::get_instance().set_mode(Simulation::mode_continuous); else @@ -567,12 +567,12 @@ GuiBuilder::on_toggle_simulation_mode() } -void +void GuiBuilder::ask_save() { History& history = Simulation::get_instance().get_history(); const Environment& env = history.get_environment_at(0); - + if(!(_filename.empty() && env.get_processes().empty() && env.get_resources().empty())) { Gtk::MessageDialog want_to_save(get_initial_window(), @@ -637,7 +637,7 @@ GuiBuilder::GuiBuilder(const std::string& uifile) file_quit->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::ask_save)); file_quit->signal_activate().connect(sigc::ptr_fun(&Main::quit)); - // preferences dialog + // preferences dialog RefPtr::cast_dynamic (_refXml->get_object("Action.Edit.Preferences")) ->signal_activate().connect(sigc::mem_fun(*this, &GuiBuilder::on_edit_preferences_activate)); @@ -678,7 +678,7 @@ GuiBuilder::GuiBuilder(const std::string& uifile) cpu_policies_tb_menu->signal_clicked().connect(sigc::mem_fun(*this, &GuiBuilder::on_configure_cpu_policy)); cpu_policies_tb_menu->set_menu(*manage(new Menu())); populate_with_cpu_policies(*cpu_policies_tb_menu->get_menu()); - + // Configure Resource Policy MenuToolButton* res_policies_tb_menu; _refXml->get_widget("ToolBar.ResourceScheduling", res_policies_tb_menu); @@ -711,7 +711,7 @@ GuiBuilder::GuiBuilder(const std::string& uifile) resources_widget->show(); - // Main simulation widget + // Main simulation widget ScrolledWindow* simulation_window = nullptr; _refXml->get_widget("SimulationScrolledWindow", simulation_window); //SimulationWidget& simulation_widget = *manage(new SimulationWidget(Simulation::get_instance())); @@ -719,11 +719,11 @@ GuiBuilder::GuiBuilder(const std::string& uifile) simulation_window->add(*_simulation_widget); _simulation_widget->set_show_threads(_show_threads); _simulation_widget->show(); - + // ReadyQueue custom label widget ReadyQueueWidget& rq_widget = *manage(new ReadyQueueWidget(Simulation::get_instance().get_history())); - HBox* bottomhbox; + HBox* bottomhbox; _refXml->get_widget("BottomHBox", bottomhbox); bottomhbox->pack_start(rq_widget); rq_widget.show(); @@ -733,12 +733,12 @@ GuiBuilder::GuiBuilder(const std::string& uifile) Button* simulation_jump_to = nullptr; _refXml->get_widget("BottomHBox.JumpToButton", simulation_jump_to); simulation_jump_to->signal_clicked().connect(sigc::mem_fun(*this, &GuiBuilder::on_simulation_jump_to_clicked)); - - // HoltGraph container window + + // HoltGraph container window _holt_container.set_transient_for(main_window); _holt_container.get_holt_widget().set_show_threads(_show_threads); - + _statistics_container.get_main_window()->set_transient_for(main_window); } @@ -747,7 +747,7 @@ GuiBuilder::~GuiBuilder() {} -// TODO: return a RefPtr instead of a reference, because +// TODO: return a RefPtr instead of a reference, because // GtkBuilder (unalike Glade) requires explicit deallocation of // the toplevel window widgets upon release. Gtk::Window& diff --git a/src/gui_builder.hh b/src/gui_builder.hh index 4508667..fc23d49 100644 --- a/src/gui_builder.hh +++ b/src/gui_builder.hh @@ -26,6 +26,7 @@ #include "statistics_container_window.hh" #include "simulation_widget.hh" +#include "sgpemv2/config.h" #include "sgpemv2/cpu_policy.hh" #include "sgpemv2/resource_policy.hh" @@ -50,21 +51,21 @@ namespace sgpem ~GuiBuilder(); Gtk::Window& get_initial_window() const; - + void on_file_new_activate(); void on_file_open_activate(); void on_file_open_example_activate(); void on_file_save_activate(); void on_file_saveas_activate(); - + void on_edit_preferences_activate(); - + void on_simulation_jump_to_clicked(); - + void on_view_show_threads_activate(); void on_view_show_holt_graph_activate(); - void on_view_show_statistics_activate(); - + void on_view_show_statistics_activate(); + void on_configure_cpu_policy(); void on_configure_resource_policy(); void on_selected_cpu_policy(CPUPolicy* pol); diff --git a/src/parse_opts.cc b/src/parse_opts.cc index 83160d8..028d22d 100644 --- a/src/parse_opts.cc +++ b/src/parse_opts.cc @@ -101,15 +101,15 @@ parse_options(int argc, char** argv) // Parse options, initialising the Gtk at the same time gboolean gui_initializable = gtk_init_check(&argc, &argv); context.parse(argc, argv); - + GlobalPreferences& prefs = GlobalPreferences::get_instance(); try { prefs.load_configrc(); } - catch (std::exception e) + catch (std::exception& e) { - std::cout << std::endl + std::cout << std::endl << _("Error while loading preferences") << std::endl; } @@ -139,9 +139,9 @@ parse_options(int argc, char** argv) TextSimulation sim; std::string str; - std::cout << std::endl + std::cout << std::endl << _(" [II] To see a list of commands available,\n" - " [II] please type \"help\" and hit the ENTER key.") + " [II] please type \"help\" and hit the ENTER key.") << std::endl; std::cout << std::endl << "% "; @@ -163,10 +163,10 @@ parse_options(int argc, char** argv) } } // ~ try - catch (Glib::OptionError e) + catch (Glib::OptionError& e) { std::cout << Glib::ustring::compose (_("Bad invocation: %1\nUse the `-?' " - "or `--help' option to see the help."), + "or `--help' option to see the help."), e.what()) << std::endl; } } diff --git a/src/resources_widget.cc b/src/resources_widget.cc index b7f4e23..d2435f8 100644 --- a/src/resources_widget.cc +++ b/src/resources_widget.cc @@ -20,6 +20,8 @@ #include "resources_widget.hh" +#include "sgpemv2/config.h" + #include #include @@ -52,14 +54,14 @@ ResourcesWidget::CellRendererTextMarkup::_property_renderable() } ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr&) : - TreeView(cobject), + TreeView(cobject), _add_resource_dialog_ui(Builder::create_from_file(UIDIR "/add-resource-dialog.ui")) { _columns.add(_key_column); _columns.add(_main_column); _columns.add(_handles_column); _model = ListStore::create(_columns); - + set_model(_model); int idx = append_column(_("resources"), _cell_renderer) - 1; @@ -68,7 +70,7 @@ ResourcesWidget::ResourcesWidget(BaseObjectType* cobject, const RefPtr& /** DIALOGS **/ _add_resource_dialog_ui->get_widget("AddResourceDialog", _add_resource_dialog); - + set_headers_visible(false); Simulation::get_instance().get_history().attach(*this); @@ -107,42 +109,42 @@ ResourcesWidget::get_selected_resource() return nullptr; } -bool +bool ResourcesWidget::on_button_press_event(GdkEventButton* event) { TreeView::on_button_press_event(event); - + if((Simulation::get_instance().get_state() == Simulation::state_stopped) && (event->type == GDK_BUTTON_PRESS) && (event->button == 3) ) { RefPtr action_group = Gtk::ActionGroup::create(); action_group->add( Gtk::Action::create("AddResource", "Add Resource"), - sigc::mem_fun(*this, &ResourcesWidget::_on_add_resource) ); - + sigc::mem_fun(*this, &ResourcesWidget::_on_add_resource) ); + action_group->add( Gtk::Action::create("EditResource", "Edit Resource"), - sigc::mem_fun(*this, &ResourcesWidget::_on_edit_resource) ); - + sigc::mem_fun(*this, &ResourcesWidget::_on_edit_resource) ); + action_group->add( Gtk::Action::create("RemoveResource", "Remove Resource"), - sigc::mem_fun(*this, &ResourcesWidget::_on_remove_resource) ); - + sigc::mem_fun(*this, &ResourcesWidget::_on_remove_resource) ); + RefPtr UIManager = Gtk::UIManager::create(); UIManager->insert_action_group(action_group); - Glib::ustring ui_info = - "" - " " - " "; + Glib::ustring ui_info = + "" + " " + " "; if(get_selected_resource() != nullptr) ui_info += - " " - " " - " " - " "; - - ui_info += - " " - ""; + " " + " " + " " + " "; + + ui_info += + " " + ""; UIManager->add_ui_from_string(ui_info); Gtk::Menu* menu = dynamic_cast(UIManager->get_widget("/PopupMenu")); @@ -161,7 +163,7 @@ ResourcesWidget::update(const History& history) const Environment::Resources& resources = history.get_last_environment().get_resources(); _model->clear(); - + for(Iseq it = iseq(resources); it; ++it) { Resource& r = *(it->second); @@ -193,7 +195,7 @@ ResourcesWidget::add_edit_resource(bool adding) SpinButton* places_spin; Resource* resource = nullptr; - + _add_resource_dialog_ui->get_widget("Name.Entry", name_entry); _add_resource_dialog_ui->get_widget("Places.Spin", places_spin); @@ -205,19 +207,19 @@ ResourcesWidget::add_edit_resource(bool adding) else { resource = get_selected_resource(); - + name_entry->set_text(resource->get_name()); places_spin->set_value(static_cast(resource->get_places())); } - + if(_add_resource_dialog->run() == RESPONSE_OK) { if(adding) { - Simulation::get_instance().get_history().add_resource(name_entry->get_text(), - false, - places_spin->get_value_as_int()); + Simulation::get_instance().get_history().add_resource(name_entry->get_text(), + false, + places_spin->get_value_as_int()); } else { @@ -227,19 +229,19 @@ ResourcesWidget::add_edit_resource(bool adding) places_spin->get_value_as_int()); } } - + _add_resource_dialog->hide(); } void ResourcesWidget::_on_remove_resource() { - unsigned int selection; + unsigned int selection; if(get_selected_key(selection)) Simulation::get_instance().get_history().remove(selection); /** Delete empty requests, they are useless with the current GUI **/ - + typedef Environment::Processes::const_iterator ProcessIt; using std::vector; @@ -247,7 +249,7 @@ ResourcesWidget::_on_remove_resource() const Environment::Processes& processes = env.get_processes(); std::stack to_delete; - + for(ProcessIt pit = processes.begin(); pit != processes.end(); ++pit) { vector threads = (*pit)->get_threads(); @@ -258,8 +260,8 @@ ResourcesWidget::_on_remove_resource() for(vector::iterator rit = requests.begin(); rit != requests.end(); ++rit) { - if((*rit)->get_subrequests().empty()) - to_delete.push(*rit); + if((*rit)->get_subrequests().empty()) + to_delete.push(*rit); } } } @@ -271,8 +273,8 @@ ResourcesWidget::_on_remove_resource() } } -void -ResourcesWidget::_on_cell_name_data(Gtk::CellRenderer* cr, +void +ResourcesWidget::_on_cell_name_data(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& it) { CellRendererTextMarkup& crtm = static_cast(*cr); @@ -283,28 +285,28 @@ ResourcesWidget::_on_cell_name_data(Gtk::CellRenderer* cr, const void* r_handle = (*it)[_handles_column]; Resource& resource = *reinterpret_cast(const_cast(r_handle)); - + std::ostringstream oss; const Environment::SubRequestQueue& queue = env.get_request_queue(key); - - oss << "" << Markup::escape_text(resource.get_name()) + + oss << "" << Markup::escape_text(resource.get_name()) << ""; oss << " (" << queue.size() << "/" << resource.get_places() << ")\n"; for(Iseq it = iseq(queue); it; ++it) { SubRequest& sr = *(*it); - - oss << " " << sr.get_request().get_thread().get_name() - << "" << " (" - << (sr.get_length() - sr.get_remaining_time()) - << "/" << sr.get_length() << ")"; + + oss << " " << sr.get_request().get_thread().get_name() + << "" << " (" + << (sr.get_length() - sr.get_remaining_time()) + << "/" << sr.get_length() << ")"; } - + oss << ""; crtm.property_markup() = oss.str(); diff --git a/src/schedulables_tree_widget.cc b/src/schedulables_tree_widget.cc index 6c3b844..bcf99b9 100644 --- a/src/schedulables_tree_widget.cc +++ b/src/schedulables_tree_widget.cc @@ -20,6 +20,7 @@ #include "gettext.h" +#include "sgpemv2/config.h" #include "schedulables_tree_widget.hh" #include #include @@ -52,15 +53,15 @@ SchedulablesTreeWidget::CellRendererTextMarkup::_property_renderable() return Glib::PropertyProxy_Base(this, "markup"); } -SchedulablesTreeWidget::SchedulablesTreeWidget() +SchedulablesTreeWidget::SchedulablesTreeWidget() { _columns.add(_main_column); _columns.add(_types_column); _columns.add(_handles_column); _model = TreeStore::create(_columns); - + set_model(_model); - + int idx = append_column(_("Arrival"), _cell_renderer) - 1; Gtk::TreeViewColumn* tvc = get_column(idx); tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_arrival_column_data)); @@ -68,11 +69,11 @@ SchedulablesTreeWidget::SchedulablesTreeWidget() idx = append_column(_("Entity"), _cell_renderer) - 1; tvc = get_column(idx); tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_entity_column_data)); - + idx = append_column(_("State"), _cell_renderer) - 1; tvc = get_column(idx); tvc->set_cell_data_func(_cell_renderer, sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_state_column_data)); - + set_headers_visible(true); Simulation::get_instance().get_history().attach(*this); @@ -84,7 +85,7 @@ SchedulablesTreeWidget::~SchedulablesTreeWidget() } template -bool +bool SchedulablesTreeWidget::check_type(SchedulablesTreeWidget::HandleType type) { return false; @@ -93,28 +94,28 @@ SchedulablesTreeWidget::check_type(SchedulablesTreeWidget::HandleType type) namespace sgpem { template <> - bool + bool SchedulablesTreeWidget::check_type(HandleType type) { return type == htype_process; } template <> - bool + bool SchedulablesTreeWidget::check_type(HandleType type) { return type == htype_thread; } template <> - bool + bool SchedulablesTreeWidget::check_type(HandleType type) { return type == htype_request; } // template <> -// bool +// bool // SchedulablesTreeWidget::check_type(HandleType type) // { // return type == htype_subrequest; @@ -126,7 +127,7 @@ T* SchedulablesTreeWidget::get_selected() { TreeModel::iterator sel = get_selection()->get_selected(); - + return get_row_handle_as(sel); } @@ -136,7 +137,7 @@ SchedulablesTreeWidget::get_row_handle_as(const Gtk::TreeModel::iterator& row) { if(!row) return nullptr; - + const void* p_handle = (*row)[_handles_column]; HandleType type = (*row)[_types_column]; @@ -164,42 +165,42 @@ SchedulablesTreeWidget::get_row_type(const TreeModel::iterator& row) } -bool +bool SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event) { TreeView::on_button_press_event(event); - + if((Simulation::get_instance().get_state() == Simulation::state_stopped) && (event->type == GDK_BUTTON_PRESS) && (event->button == 3) ) { RefPtr action_group = Gtk::ActionGroup::create(); action_group->add( Gtk::Action::create("AddProcess", _("Add Process")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_process) ); - + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_process) ); + action_group->add( Gtk::Action::create("AddThread", _("Add Thread")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_thread) ); - + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_thread) ); + action_group->add( Gtk::Action::create("AddRequest", _("Add Request")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_request) ); + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_add_request) ); action_group->add( Gtk::Action::create("EditProcess", _("Edit Process")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_edit_process) ); - + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_edit_process) ); + action_group->add( Gtk::Action::create("EditThread", _("Edit Thread")), sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_edit_thread) ); - + action_group->add( Gtk::Action::create("EditRequest", _("Edit Request")), sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_edit_request) ); - + action_group->add( Gtk::Action::create("RemoveProcess", _("Remove Process")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_process) ); - + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_process) ); + action_group->add( Gtk::Action::create("RemoveThread", _("Remove Thread")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_thread) ); - + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_thread) ); + action_group->add( Gtk::Action::create("RemoveRequest", _("Remove Request")), - sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_request) ); + sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_request) ); // action_group->add( Gtk::Action::create("RemoveSubrequest", _("Remove Subrequest")), // sigc::mem_fun(*this, &SchedulablesTreeWidget::_on_remove_subrequest) ); @@ -208,15 +209,15 @@ SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event) UIManager->insert_action_group(action_group); const HandleType selection_type = get_selection_type(); - + Glib::ustring adds; Glib::ustring edits; Glib::ustring removes; Glib::ustring separator; - + if(selection_type != htype_undefined) separator = ""; - + switch(selection_type) { case htype_process: @@ -240,16 +241,16 @@ SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event) } adds += ""; - - Glib::ustring ui_info = - "" - " "; + + Glib::ustring ui_info = + "" + " "; ui_info += adds + separator + edits + ((edits.size() == 0) ? ustring() : separator) + removes; ui_info += " " - ""; + ""; UIManager->add_ui_from_string(ui_info); Gtk::Menu* menu = dynamic_cast(UIManager->get_widget("/PopupMenu")); @@ -272,10 +273,10 @@ void SchedulablesTreeWidget::update(const History&) { using std::vector; - + typedef Environment::Processes::const_iterator ProcessIt; - - const Environment::Processes& processes = + + const Environment::Processes& processes = Simulation::get_instance().get_history().get_last_environment().get_processes(); @@ -283,20 +284,20 @@ SchedulablesTreeWidget::update(const History&) map_expanded_rows(sigc::mem_fun(*this, &SchedulablesTreeWidget::_update_expanded_vector)); _model->clear(); - + for(Iseq pit = iseq(processes); pit; ++pit) { Process& p = *(*pit); TreeModel::Row prow = *(_model->append()); - + // prow[_main_column] = p.get_name(); prow[_types_column] = htype_process; prow[_handles_column] = &p; vector threads = p.get_threads(); - + for(Iseq::iterator> tit = iseq(threads); tit; ++tit) { Thread& t = *(*tit); @@ -312,16 +313,16 @@ SchedulablesTreeWidget::update(const History&) for(unsigned int ri = 0; ri < requests.size(); ++ri) { Request& r = *requests[ri]; - + TreeModel::Row rrow = *(_model->append(trow.children())); - + // std::ostringstream oss; // oss << _("request ") << ri + 1; - + // rrow[_main_column] = oss.str(); rrow[_types_column] = htype_request; rrow[_handles_column] = &r; - + } } } @@ -333,7 +334,7 @@ SchedulablesTreeWidget::update(const History&) // We can clear it now, since until next update we won't need it. _expanded_rows.clear(); - + } void @@ -351,14 +352,14 @@ SchedulablesTreeWidget::_on_edit_process() void SchedulablesTreeWidget::add_edit_process(bool adding) { - /** This is ugly, I know, we should be using derived widgets, but I also believe we + /** This is ugly, I know, we should be using derived widgets, but I also believe we * have little time, and I'm not going to waste too much of it on the frontend */ RefPtr ui(Builder::create_from_file(UIDIR "/add-process-dialog.ui")); Dialog* add_process_dialog; ui->get_widget("AddProcessDialog", add_process_dialog); - + Entry* name_entry; SpinButton* arrival_time_spin; SpinButton* duration_spin; @@ -368,9 +369,9 @@ SchedulablesTreeWidget::add_edit_process(bool adding) ui->get_widget("ArrivalTime.Spin", arrival_time_spin); ui->get_widget("Duration.Spin", duration_spin); ui->get_widget("BasePriority.Spin", base_priority_spin); - + Process* selection = nullptr; - + if(!adding) { selection = get_selected(); @@ -381,16 +382,16 @@ SchedulablesTreeWidget::add_edit_process(bool adding) duration_spin->set_sensitive(false); base_priority_spin->set_value(static_cast(selection->get_base_priority())); } - + if(add_process_dialog->run() == RESPONSE_OK) { if(adding) { History& h = Simulation::get_instance().get_history(); History::LockNotify lock(h); - - Process& np = h.add_process(name_entry->get_text(), - arrival_time_spin->get_value_as_int(), + + Process& np = h.add_process(name_entry->get_text(), + arrival_time_spin->get_value_as_int(), base_priority_spin->get_value_as_int()); h.add_thread(_("Main"), np, duration_spin->get_value_as_int(), @@ -400,20 +401,20 @@ SchedulablesTreeWidget::add_edit_process(bool adding) { History& h = Simulation::get_instance().get_history(); History::LockNotify lock(h); - + h.edit_process(*selection, - name_entry->get_text(), - arrival_time_spin->get_value_as_int(), - base_priority_spin->get_value_as_int()); + name_entry->get_text(), + arrival_time_spin->get_value_as_int(), + base_priority_spin->get_value_as_int()); } } - + add_process_dialog->hide(); } void SchedulablesTreeWidget::_on_add_thread() -{ +{ add_edit_thread(true); } @@ -426,14 +427,14 @@ SchedulablesTreeWidget::_on_edit_thread() void SchedulablesTreeWidget::add_edit_thread(bool adding) { - /** This is ugly, I know, we should be using derived widgets, but I also believe we + /** This is ugly, I know, we should be using derived widgets, but I also believe we * have little time, and I'm not going to waste too much of it on the frontend */ RefPtr ui(Builder::create_from_file(UIDIR "/add-thread-dialog.ui")); Dialog* add_thread_dialog; ui->get_widget("AddThreadDialog", add_thread_dialog); - + Entry* name_entry; SpinButton* cpu_time_spin; SpinButton* arrival_time_spin; @@ -445,18 +446,18 @@ SchedulablesTreeWidget::add_edit_thread(bool adding) ui->get_widget("BasePriority.Spin", base_priority_spin); Thread* t = nullptr; - + if(!adding) { t = get_selected(); - + name_entry->set_text(t->get_name()); cpu_time_spin->set_value(static_cast(t->get_total_cpu_time())); arrival_time_spin->set_value(static_cast(t->get_arrival_time())); base_priority_spin->set_value(static_cast(t->get_base_priority())); } - + if(add_thread_dialog->run() == RESPONSE_OK) { @@ -464,63 +465,63 @@ SchedulablesTreeWidget::add_edit_thread(bool adding) { Process* p = get_selected(); assert(p != nullptr); - + Simulation::get_instance().get_history().add_thread(name_entry->get_text(), - *p, - cpu_time_spin->get_value_as_int(), - arrival_time_spin->get_value_as_int(), - base_priority_spin->get_value_as_int()); + *p, + cpu_time_spin->get_value_as_int(), + arrival_time_spin->get_value_as_int(), + base_priority_spin->get_value_as_int()); } else { Simulation::get_instance().get_history().edit_thread(*t, name_entry->get_text(), - cpu_time_spin->get_value_as_int(), - arrival_time_spin->get_value_as_int(), - base_priority_spin->get_value_as_int()); + cpu_time_spin->get_value_as_int(), + arrival_time_spin->get_value_as_int(), + base_priority_spin->get_value_as_int()); } - + } - + add_thread_dialog->hide(); } void SchedulablesTreeWidget::_on_add_request() -{ +{ RefPtr ui(Builder::create_from_file(UIDIR "/add-request-dialog.ui")); AddRequestDialog* add_request_dialog; // NOTE This is *not* reflective programming! AddRequestDialog is the name of // the base widget in the xml ui file. ui->get_widget_derived("AddRequestDialog", add_request_dialog); - + Thread* t = get_selected(); assert(t != nullptr); - + add_request_dialog->run_add(*t); } void SchedulablesTreeWidget::_on_edit_request() -{ +{ using std::vector; - + RefPtr ui(Builder::create_from_file(UIDIR "/add-request-dialog.ui")); AddRequestDialog* add_request_dialog; // NOTE This is *not* reflective programming! AddRequestDialog is the name of // the base widget in the xml ui file. ui->get_widget_derived("AddRequestDialog", add_request_dialog); - + Request* r = get_selected(); assert(r != nullptr); // FIXME: write more polite code for doing this, and probably using the same logic // for all other editing operations may be useful for making the app more robust - - const Environment::Processes& processes = + + const Environment::Processes& processes = Simulation::get_instance().get_history().get_environment_at(0).get_processes(); for(Iseq pit = iseq(processes); pit; ++pit) @@ -532,12 +533,12 @@ SchedulablesTreeWidget::_on_edit_request() vector requests = (*tit)->get_requests(); for(Iseq::iterator> rit = iseq(requests); rit; ++rit) { - if(*(*rit) == *r) - r = *rit; + if(*(*rit) == *r) + r = *rit; } } } - + add_request_dialog->run_edit(*r); } @@ -568,8 +569,8 @@ SchedulablesTreeWidget::_on_remove_request() Simulation::get_instance().get_history().remove(*r); } -void -SchedulablesTreeWidget::_on_arrival_column_data(Gtk::CellRenderer* cr, +void +SchedulablesTreeWidget::_on_arrival_column_data(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& it) { CellRendererTextMarkup& crtm = static_cast(*cr); @@ -583,11 +584,11 @@ SchedulablesTreeWidget::_on_arrival_column_data(Gtk::CellRenderer* cr, case htype_process: oss << get_row_handle_as(it)->get_arrival_time(); break; - + case htype_thread: oss << get_row_handle_as(it)->get_arrival_time(); break; - + case htype_request: oss << get_row_handle_as(it)->get_instant(); break; @@ -601,8 +602,8 @@ SchedulablesTreeWidget::_on_arrival_column_data(Gtk::CellRenderer* cr, crtm.property_markup() = oss.str(); } -void -SchedulablesTreeWidget::_on_entity_column_data(Gtk::CellRenderer* cr, +void +SchedulablesTreeWidget::_on_entity_column_data(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& it) { CellRendererTextMarkup& crtm = static_cast(*cr); @@ -614,11 +615,11 @@ SchedulablesTreeWidget::_on_entity_column_data(Gtk::CellRenderer* cr, case htype_process: marked_up = markup_schedulable(*get_row_handle_as(it)); break; - + case htype_thread: marked_up = markup_schedulable(*get_row_handle_as(it)); break; - + case htype_request: marked_up = markup_request(*get_row_handle_as(it)); break; @@ -626,7 +627,7 @@ SchedulablesTreeWidget::_on_entity_column_data(Gtk::CellRenderer* cr, default: marked_up = _("ERROR"); } - + crtm.property_markup() = marked_up; } @@ -634,15 +635,15 @@ ustring SchedulablesTreeWidget::markup_schedulable(const Schedulable& s) { using std::endl; - + std::ostringstream oss; // TODO : add note for the translator to use HTML-escaped text // See the gettext manual. - oss << "" << Markup::escape_text(s.get_name()) << "" - << Glib::ustring::compose(_(" (%1/%2), current_priority: %3"), + << Glib::ustring::compose(_(" (%1/%2), current_priority: %3"), s.get_elapsed_time(), s.get_total_cpu_time(), s.get_current_priority()) << ""; @@ -656,8 +657,8 @@ SchedulablesTreeWidget::markup_request(Request& r) std::ostringstream oss; - oss << "" << _("request:") << ""; const Environment& env = Simulation::get_instance().get_history().get_last_environment(); @@ -668,44 +669,44 @@ SchedulablesTreeWidget::markup_request(Request& r) { SubRequest& sr = *(*it); Resource& res = *(resources.find(sr.get_resource_key())->second); - - oss << " -> " << res.get_name() << " (" - << (sr.get_length() - sr.get_remaining_time()) - << "/" << sr.get_length() << ")"; + + oss << " -> " << res.get_name() << " (" + << (sr.get_length() - sr.get_remaining_time()) + << "/" << sr.get_length() << ")"; } - + oss << ""; return oss.str(); } -void -SchedulablesTreeWidget::_on_state_column_data(Gtk::CellRenderer* cr, +void +SchedulablesTreeWidget::_on_state_column_data(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& it) { CellRendererTextMarkup& crtm = static_cast(*cr); ustring marked_up = ""; - + switch(get_row_type(it)) { case htype_process: marked_up += state_text(get_row_handle_as(it)->get_state()); break; - + case htype_thread: marked_up += state_text(get_row_handle_as(it)->get_state()); break; - + case htype_request: marked_up += state_text(get_row_handle_as(it)->get_state()); break; default: marked_up += "NO STATE"; } - + crtm.property_markup() = marked_up + ""; } @@ -713,7 +714,7 @@ ustring SchedulablesTreeWidget::state_text(Schedulable::state state) { ustring text; - + switch (state) { case Schedulable::state_running: @@ -742,7 +743,7 @@ ustring SchedulablesTreeWidget::state_text(Request::state state) { ustring text; - + switch (state) { case Request::state_allocated: diff --git a/src/statistics_container_window.hh b/src/statistics_container_window.hh index 680186c..1c52d09 100644 --- a/src/statistics_container_window.hh +++ b/src/statistics_container_window.hh @@ -26,6 +26,7 @@ #include "gettext.h" +#include "sgpemv2/config.h" #include "sgpemv2/simulation.hh" #include @@ -36,7 +37,7 @@ #include #include -namespace sgpem +namespace sgpem { /** * \brief Window which displays schedulable-specific and simulation statistics