Commit 966cfb49 authored by Melroy van den Berg's avatar Melroy van den Berg

Add feedback link. Refactor menu code

parent 13f70479
Pipeline #1766 passed with stages
in 3 minutes and 21 seconds
......@@ -76,6 +76,7 @@ public:
virtual void on_new_bottle_created();
virtual void on_run_button_clicked();
virtual void on_hide_window();
virtual void on_give_feedback();
virtual void on_exec_failure();
protected:
......
......@@ -29,16 +29,17 @@
class Menu: public Gtk::MenuBar
{
public:
sigc::signal<void> menu_preferences; /*!< preferences button clicked signal */
sigc::signal<void> menu_quit; /*!< quite button clicked signal */
sigc::signal<void> menu_refresh; /*!< refresh button clicked signal */
sigc::signal<void> menu_new_machine; /*!< new machine button clicked signal */
sigc::signal<void> menu_run; /*!< run button clicked signal */
sigc::signal<void> menu_open_drive_c; /*!< open C: drive clicked signal */
sigc::signal<void> menu_edit_machine; /*!< edit button clicked signal */
sigc::signal<void> menu_settings_machine; /*!< settings button clicked signal */
sigc::signal<void> menu_remove_machine; /*!< remove button clicked signal */
sigc::signal<void> menu_show_about; /*!< about button clicked signal */
sigc::signal<void> preferences; /*!< preferences button clicked signal */
sigc::signal<void> quit; /*!< quite button clicked signal */
sigc::signal<void> refresh_view; /*!< refresh button clicked signal */
sigc::signal<void> new_machine; /*!< new machine button clicked signal */
sigc::signal<void> run; /*!< run button clicked signal */
sigc::signal<void> open_drive_c; /*!< open C: drive clicked signal */
sigc::signal<void> edit_machine; /*!< edit button clicked signal */
sigc::signal<void> settings_machine; /*!< settings button clicked signal */
sigc::signal<void> remove_machine; /*!< remove button clicked signal */
sigc::signal<void> give_feedback; /*!< feedback button clicked signal */
sigc::signal<void> show_about; /*!< about button clicked signal */
Menu();
virtual ~Menu();
......
......@@ -312,6 +312,18 @@ void MainWindow::on_hide_window()
{
hide();
}
/**
* \brief When the feedback button is pressed
*/
void MainWindow::on_give_feedback()
{
GError *error = NULL;
if (!g_app_info_launch_default_for_uri("mailto://melroy@melroy.org", NULL, &error)) {
g_warning("Failed to open email link: %s", error->message);
this->ShowErrorMessage("Could not open e-mail program.");
}
}
/**
* \brief Not implemented feature
......
......@@ -37,55 +37,56 @@ Menu::Menu()
// File submenu
// Using text + image
auto preferences = CreateImageMenuItem("Preferences", "system-run");
preferences->signal_activate().connect(menu_preferences);
auto exit = CreateImageMenuItem("Exit", "application-exit");
exit->signal_activate().connect(menu_quit);
auto preferences_menuitem = CreateImageMenuItem("Preferences", "system-run");
preferences_menuitem->signal_activate().connect(preferences);
auto exit_menuitem = CreateImageMenuItem("Exit", "application-exit");
exit_menuitem->signal_activate().connect(quit);
// View submenu
auto refresh = CreateImageMenuItem("Refresh List", "view-refresh");
refresh->signal_activate().connect(menu_refresh);
auto refresh_menuitem = CreateImageMenuItem("Refresh List", "view-refresh");
refresh_menuitem->signal_activate().connect(refresh_view);
// Machine submenu
auto newitem = CreateImageMenuItem("New", "list-add");
newitem->signal_activate().connect(menu_new_machine);
auto run = CreateImageMenuItem("Run...", "media-playback-start");
run->signal_activate().connect(menu_run);
auto open_drive_c = CreateImageMenuItem("Open C: Drive", "drive-harddisk");
open_drive_c->signal_activate().connect(menu_open_drive_c);
auto edit = CreateImageMenuItem("Edit", "document-edit");
edit->signal_activate().connect(menu_edit_machine);
auto settings = CreateImageMenuItem("Settings", "preferences-other");
settings->signal_activate().connect(menu_settings_machine);
auto remove = CreateImageMenuItem("Remove", "edit-delete");
remove->signal_activate().connect(menu_remove_machine);
auto newitem_menuitem = CreateImageMenuItem("New", "list-add");
newitem_menuitem->signal_activate().connect(new_machine);
auto run_menuitem = CreateImageMenuItem("Run...", "media-playback-start");
run_menuitem->signal_activate().connect(run);
auto open_drive_c_menuitem = CreateImageMenuItem("Open C: Drive", "drive-harddisk");
open_drive_c_menuitem->signal_activate().connect(open_drive_c);
auto edit_menuitem = CreateImageMenuItem("Edit", "document-edit");
edit_menuitem->signal_activate().connect(edit_machine);
auto settings_menuitem = CreateImageMenuItem("Settings", "preferences-other");
settings_menuitem->signal_activate().connect(settings_machine);
auto remove_menuitem = CreateImageMenuItem("Remove", "edit-delete");
remove_menuitem->signal_activate().connect(remove_machine);
// Help submenu
auto about = CreateImageMenuItem("About WineGUI...", "help-about");
about->signal_activate().connect(menu_show_about);
// Template for creating a seperate method if addition actions are required:
// about->signal_activate().connect(sigc::mem_fun(*this, &Menu::on_help_about));
auto feedback_menuitem = CreateImageMenuItem("Give feedback", "help-faq");
feedback_menuitem->signal_activate().connect(give_feedback);
auto about_menuitem = CreateImageMenuItem("About WineGUI...", "help-about");
about_menuitem->signal_activate().connect(show_about);
// Add items to sub-menu
// File menu
file_submenu.append(*preferences);
file_submenu.append(*preferences_menuitem);
file_submenu.append(separator1);
file_submenu.append(*exit);
file_submenu.append(*exit_menuitem);
// View menu
view_submenu.append(*refresh);
view_submenu.append(*refresh_menuitem);
// Machine menu
machine_submenu.append(*newitem);
machine_submenu.append(*newitem_menuitem);
machine_submenu.append(separator2);
machine_submenu.append(*run);
machine_submenu.append(*open_drive_c);
machine_submenu.append(*edit);
machine_submenu.append(*settings);
machine_submenu.append(*remove);
machine_submenu.append(*run_menuitem);
machine_submenu.append(*open_drive_c_menuitem);
machine_submenu.append(*edit_menuitem);
machine_submenu.append(*settings_menuitem);
machine_submenu.append(*remove_menuitem);
// Help menu
help_submenu.append(*about);
help_submenu.append(*feedback_menuitem);
help_submenu.append(*about_menuitem);
// Add menu items to menu bar
append(file);
......
......@@ -82,16 +82,17 @@ void SignalDispatcher::SetMainWindow(MainWindow* mainWindow)
void SignalDispatcher::DispatchSignals()
{
// Menu buttons
menu.menu_preferences.connect(sigc::mem_fun(preferencesWindow, &PreferencesWindow::show));
menu.menu_quit.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_hide_window)); /*!< When quit button is pressed, hide main window and therefor closes the app */
menu.menu_show_about.connect(sigc::mem_fun(about, &AboutDialog::show));
menu.menu_refresh.connect(sigc::mem_fun(manager, &BottleManager::UpdateBottles));
menu.menu_new_machine.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_new_bottle_button_clicked));
menu.menu_run.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_run_button_clicked));
menu.menu_open_drive_c.connect(sigc::mem_fun(manager, &BottleManager::OpenDriveC));
menu.menu_edit_machine.connect(sigc::mem_fun(editWindow, &EditWindow::show));
menu.menu_settings_machine.connect(sigc::mem_fun(settingsWindow, &SettingsWindow::Show));
menu.menu_remove_machine.connect(sigc::mem_fun(manager, &BottleManager::DeleteBottle));
menu.preferences.connect(sigc::mem_fun(preferencesWindow, &PreferencesWindow::show));
menu.quit.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_hide_window)); /*!< When quit button is pressed, hide main window and therefor closes the app */
menu.refresh_view.connect(sigc::mem_fun(manager, &BottleManager::UpdateBottles));
menu.new_machine.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_new_bottle_button_clicked));
menu.run.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_run_button_clicked));
menu.open_drive_c.connect(sigc::mem_fun(manager, &BottleManager::OpenDriveC));
menu.edit_machine.connect(sigc::mem_fun(editWindow, &EditWindow::show));
menu.settings_machine.connect(sigc::mem_fun(settingsWindow, &SettingsWindow::Show));
menu.remove_machine.connect(sigc::mem_fun(manager, &BottleManager::DeleteBottle));
menu.give_feedback.connect(sigc::mem_fun(*mainWindow, &MainWindow::on_give_feedback));
menu.show_about.connect(sigc::mem_fun(about, &AboutDialog::show));
// Distribute the active bottle signal
mainWindow->activeBottle.connect(sigc::mem_fun(manager, &BottleManager::SetActiveBottle));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment