From bcfba43b621cf3b33b936356c407eede76720c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Sun, 30 Aug 2015 22:07:00 +0200 Subject: [PATCH] Add about dialog --- src/config.cc | 2 +- src/files.h | 1 + src/menu.cc | 2 -- src/window.cc | 22 ++++++++++++++++++++-- src/window.h | 2 ++ 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/config.cc b/src/config.cc index 30cadac..cb434b7 100644 --- a/src/config.cc +++ b/src/config.cc @@ -14,7 +14,7 @@ MainConfig::MainConfig() { Singleton::Config::window()->theme_name=cfg.get("gtk_theme.name"); Singleton::Config::window()->theme_variant=cfg.get("gtk_theme.variant"); - + Singleton::Config::window()->version = cfg.get("version"); Singleton::Config::terminal()->make_command=cfg.get("project.make_command"); Singleton::Config::terminal()->cmake_command=cfg.get("project.cmake_command"); } diff --git a/src/files.h b/src/files.h index 44995f6..78d8abb 100644 --- a/src/files.h +++ b/src/files.h @@ -1,6 +1,7 @@ #include const std::string configjson = "{\n" +" \"version\": \"0.9.1\",\n" " \"gtk_theme\": {\n" " \"name\": \"Adwaita\", //Use \"\" for default theme, At least these two exist on all systems: Adwaita, Raleigh\n" " \"variant\": \"\" //Use \"\" for default variant, and \"dark\" for dark theme variant\n" diff --git a/src/menu.cc b/src/menu.cc index 4998bee..1cb122c 100644 --- a/src/menu.cc +++ b/src/menu.cc @@ -15,8 +15,6 @@ Menu::Menu() : box(Gtk::ORIENTATION_VERTICAL) { action_group->add(Gtk::Action::create("SourceMenu", "_Source")); action_group->add(Gtk::Action::create("PluginMenu", "_Plugins")); action_group->add(Gtk::Action::create("HelpMenu", "Help")); - action_group->add(Gtk::Action::create("HelpAbout", "About"), [this]() { - }); INFO("Menu created"); } diff --git a/src/window.cc b/src/window.cc index 23f6adc..9b91fac 100644 --- a/src/window.cc +++ b/src/window.cc @@ -103,6 +103,21 @@ Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(directories), compil entry_box.hide(); }); + about.signal_response().connect([this](int d){ + about.hide(); + }); + + about.set_version(Singleton::Config::window()->version); + about.set_authors({"Ted Johan Kristoffersen", + "Jørgen Lien Sellæg", + "Geir Morten Larsen", + "with special thanks to", + "Ole Christian Eidheim"}); + about.set_name("About juCi++"); + about.set_program_name("juCi++"); + about.set_comments("This is an open source IDE with high-end features to make your programming experience juicy"); + about.set_license_type(Gtk::License::LICENSE_MIT_X11); + about.set_transient_for(*this); INFO("Window created"); } // Window constructor @@ -294,11 +309,14 @@ void Window::create_menu() { menu.action_group->add(Gtk::Action::create("ProjectForceKillLastRunning", "Force Kill Last Process"), Gtk::AccelKey(menu.key_map["force_kill_last_running"]), [this]() { Singleton::terminal()->kill_last_async_execute(true); }); - menu.action_group->add(Gtk::Action::create("WindowCloseTab", "Close Tab"), Gtk::AccelKey(menu.key_map["close_tab"]), [this]() { notebook.close_current_page(); }); - add_accel_group(menu.ui_manager->get_accel_group()); + menu.action_group->add(Gtk::Action::create("HelpAbout", "About"), [this] () { + about.show(); + about.present(); + }); + add_accel_group(menu.ui_manager->get_accel_group()); menu.build(); INFO("Menu build") } diff --git a/src/window.h b/src/window.h index b18ae0f..693b526 100644 --- a/src/window.h +++ b/src/window.h @@ -18,6 +18,7 @@ public: public: std::string theme_name; std::string theme_variant; + std::string version; boost::property_tree::ptree keybindings; }; @@ -33,6 +34,7 @@ private: Gtk::VBox terminal_vbox; Gtk::ScrolledWindow terminal_scrolled_window; Gtk::HBox status_hbox; + Gtk::AboutDialog about; EntryBox entry_box; Menu menu; std::atomic compiling;