diff --git a/Assets/UserGuide/index.rst b/Assets/UserGuide/index.rst index 2c61d92..1a5204c 100644 --- a/Assets/UserGuide/index.rst +++ b/Assets/UserGuide/index.rst @@ -44,7 +44,7 @@ Tracker Context Menu :align: center -The context menu allows you to directly execute one of your saved commands as well as open the preferences or +The context menu allows you to directly execute one of your saved commands as well as open the settings or management window. .. @@ -122,11 +122,11 @@ Use the Terminal application to run the command so that the output can be viewed -Preferences +Settings ----------- .. image:: ../Screenshots/TrackRunnerPrefs.png - :alt: Preferences window + :alt: Settings window :align: center diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index dc94ba0..5329f27 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -7,8 +7,8 @@ set(${PROJECT_NAME}_sources CommandsWindow.cpp RunnerAddOn.cpp RunnerApp.cpp - Preferences.cpp - PreferencesWindow.cpp + Settings.cpp + SettingsWindow.cpp SortableListView.cpp TrackRunner.rdef ) diff --git a/Source/CommandSelectWindow.cpp b/Source/CommandSelectWindow.cpp index 7f2bd70..d796ee2 100644 --- a/Source/CommandSelectWindow.cpp +++ b/Source/CommandSelectWindow.cpp @@ -4,7 +4,7 @@ #include "CommandSelectWindow.h" #include "CommandListItem.h" #include "Constants.h" -#include "Preferences.h" +#include "Settings.h" #include "RunnerAddOn.h" #include @@ -241,7 +241,7 @@ status_t CommandSelectWindow::_LoadCommands() { BMessage message; - if (Preferences::ReadPreferences(message) != B_OK) + if (Settings::ReadSettings(message) != B_OK) return B_ERROR; BMessage itemMessage; diff --git a/Source/CommandsWindow.cpp b/Source/CommandsWindow.cpp index d07f466..f711340 100644 --- a/Source/CommandsWindow.cpp +++ b/Source/CommandsWindow.cpp @@ -4,7 +4,7 @@ #include "CommandsWindow.h" #include "CommandListItem.h" #include "Constants.h" -#include "Preferences.h" +#include "Settings.h" #include "RunnerAddOn.h" #include "SortableListView.h" @@ -354,7 +354,7 @@ status_t CommandsWindow::_LoadCommands() { BMessage message; - if (Preferences::ReadPreferences(message) != B_OK) + if (Settings::ReadSettings(message) != B_OK) return B_ERROR; BMessage itemMessage; @@ -378,7 +378,7 @@ status_t CommandsWindow::_SaveCommands() { BMessage message; - if (Preferences::ReadPreferences(message) != B_OK) + if (Settings::ReadSettings(message) != B_OK) return B_ERROR; // clear out old command entries @@ -397,7 +397,7 @@ CommandsWindow::_SaveCommands() message.AddMessage(kEntryKey, &itemMessage); } - return Preferences::WritePreferences(message); + return Settings::WriteSettings(message); } diff --git a/Source/Preferences.h b/Source/Preferences.h deleted file mode 100644 index d23caae..0000000 --- a/Source/Preferences.h +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT -// SPDX-FileCopyrightText: 2022 Chris Roberts - -#ifndef _PREFERENCES_H_ -#define _PREFERENCES_H_ - -#include - -class BMessage; - -class Preferences { -public: - static status_t ReadPreferences(BMessage& message); - static status_t WritePreferences(BMessage& message); -}; - -#endif // _PREFERENCES_H_ diff --git a/Source/RunnerAddOn.cpp b/Source/RunnerAddOn.cpp index 54eb0d3..aa186f1 100644 --- a/Source/RunnerAddOn.cpp +++ b/Source/RunnerAddOn.cpp @@ -3,7 +3,7 @@ #include "RunnerAddOn.h" #include "Constants.h" -#include "Preferences.h" +#include "Settings.h" #include #include @@ -169,7 +169,7 @@ populate_menu(BMessage* message, BMenu* menu, BHandler* handler) menu->RemoveItem(menuItem); BMessage prefsMessage; - Preferences::ReadPreferences(prefsMessage); + Settings::ReadSettings(prefsMessage); BMenu* trackMenu = new BMenu(prefsMessage.GetString(kMenuLabelKey, kAppTitle)); BLayoutBuilder::Menu<> builder = BLayoutBuilder::Menu<>(trackMenu); diff --git a/Source/RunnerApp.cpp b/Source/RunnerApp.cpp index 2aa5f88..62d90c5 100644 --- a/Source/RunnerApp.cpp +++ b/Source/RunnerApp.cpp @@ -5,7 +5,7 @@ #include "CommandSelectWindow.h" #include "CommandsWindow.h" #include "Constants.h" -#include "PreferencesWindow.h" +#include "SettingsWindow.h" #include #include @@ -35,9 +35,9 @@ RunnerApp::MessageReceived(BMessage* message) switch (message->what) { case kLaunchPrefsWhat: { - // search for existing preferences window + // search for existing settings window for (int32 index = 0; index < CountWindows(); index++) { - PreferencesWindow* window = dynamic_cast(WindowAt(index)); + SettingsWindow* window = dynamic_cast(WindowAt(index)); if (window != NULL) { window->Activate(); return; @@ -45,7 +45,7 @@ RunnerApp::MessageReceived(BMessage* message) } fInitialWindowShown = true; - _ShowPreferencesWindow(); + _ShowSettingsWindow(); } break; case kLaunchManageWhat: @@ -103,11 +103,11 @@ RunnerApp::AboutRequested() void -RunnerApp::_ShowPreferencesWindow() +RunnerApp::_ShowSettingsWindow() { BString title(B_TRANSLATE("%trackrunner% settings")); title.ReplaceFirst("%trackrunner%", kAppTitle); - PreferencesWindow* window = new PreferencesWindow(title); + SettingsWindow* window = new SettingsWindow(title); window->Lock(); window->CenterOnScreen(); window->Show(); diff --git a/Source/RunnerApp.h b/Source/RunnerApp.h index 47121c6..60e96a5 100644 --- a/Source/RunnerApp.h +++ b/Source/RunnerApp.h @@ -18,7 +18,7 @@ class RunnerApp : public BApplication { private: void _ShowManageWindow(); - void _ShowPreferencesWindow(); + void _ShowSettingsWindow(); bool fInitialWindowShown; }; diff --git a/Source/Preferences.cpp b/Source/Settings.cpp similarity index 87% rename from Source/Preferences.cpp rename to Source/Settings.cpp index d750ad4..ebe4bb5 100644 --- a/Source/Preferences.cpp +++ b/Source/Settings.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2022 Chris Roberts -#include "Preferences.h" +#include "Settings.h" #include "Constants.h" #include @@ -10,7 +10,7 @@ status_t -Preferences::ReadPreferences(BMessage& message) +Settings::ReadSettings(BMessage& message) { BPath prefsPath; if (find_directory(B_USER_SETTINGS_DIRECTORY, &prefsPath) != B_OK) @@ -30,7 +30,7 @@ Preferences::ReadPreferences(BMessage& message) status_t -Preferences::WritePreferences(BMessage& message) +Settings::WriteSettings(BMessage& message) { BPath prefsPath; if (find_directory(B_USER_SETTINGS_DIRECTORY, &prefsPath) != B_OK) diff --git a/Source/Settings.h b/Source/Settings.h new file mode 100644 index 0000000..bce99c4 --- /dev/null +++ b/Source/Settings.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT +// SPDX-FileCopyrightText: 2022 Chris Roberts + +#ifndef _SETTINGS_H_ +#define _SETTINGS_H_ + +#include + +class BMessage; + +class Settings { +public: + static status_t ReadSettings(BMessage& message); + static status_t WriteSettings(BMessage& message); +}; + +#endif // _SETTINGS_H_ diff --git a/Source/PreferencesWindow.cpp b/Source/SettingsWindow.cpp similarity index 85% rename from Source/PreferencesWindow.cpp rename to Source/SettingsWindow.cpp index d4bdb34..56712ba 100644 --- a/Source/PreferencesWindow.cpp +++ b/Source/SettingsWindow.cpp @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2022 Chris Roberts -#include "PreferencesWindow.h" +#include "SettingsWindow.h" #include "Constants.h" -#include "Preferences.h" +#include "Settings.h" #include #include @@ -15,7 +15,7 @@ #include #undef B_TRANSLATION_CONTEXT -#define B_TRANSLATION_CONTEXT "PreferencesWindow" +#define B_TRANSLATION_CONTEXT "SettingsWindow" #else #define B_TRANSLATE(x) x #endif @@ -30,13 +30,13 @@ enum { }; -PreferencesWindow::PreferencesWindow(BString& title) +SettingsWindow::SettingsWindow(BString& title) : BWindow(BRect(100, 100, 400, 300), title, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE) { BMessage message; - Preferences::ReadPreferences(message); + Settings::ReadSettings(message); fMenuLabelControl = new BTextControl(B_TRANSLATE("Menu label:"), message.GetString(kMenuLabelKey, kAppTitle), NULL); @@ -69,7 +69,7 @@ PreferencesWindow::PreferencesWindow(BString& title) bool -PreferencesWindow::QuitRequested() +SettingsWindow::QuitRequested() { if (be_app->CountWindows() == 1) be_app->PostMessage(B_QUIT_REQUESTED); @@ -79,7 +79,7 @@ PreferencesWindow::QuitRequested() void -PreferencesWindow::MessageReceived(BMessage* message) +SettingsWindow::MessageReceived(BMessage* message) { switch (message->what) { case kDefaultsButtonWhat: @@ -87,15 +87,15 @@ PreferencesWindow::MessageReceived(BMessage* message) #ifdef USE_MENUITEM_ICONS fIconMenuCheckBox->SetValue(kIconMenusDefault); #endif - _WritePreferences(); + _WriteSettings(); break; #ifdef USE_MENUITEM_ICONS case kIconCheckBoxWhat: - _WritePreferences(); + _WriteSettings(); break; #endif case kMenuLabelWhat: - _WritePreferences(); + _WriteSettings(); break; default: BWindow::MessageReceived(message); @@ -104,11 +104,11 @@ PreferencesWindow::MessageReceived(BMessage* message) status_t -PreferencesWindow::_WritePreferences() +SettingsWindow::_WriteSettings() { BMessage message; - Preferences::ReadPreferences(message); + Settings::ReadSettings(message); #ifdef USE_MENUITEM_ICONS message.SetBool(kIconMenusKey, fIconMenuCheckBox->Value()); @@ -130,5 +130,5 @@ PreferencesWindow::_WritePreferences() fMenuLabelControl->TextView()->SetFontAndColor(&font, B_FONT_ALL, &textColor); fMenuLabelControl->SetViewColor(viewColor); - return Preferences::WritePreferences(message); + return Settings::WriteSettings(message); } diff --git a/Source/PreferencesWindow.h b/Source/SettingsWindow.h similarity index 62% rename from Source/PreferencesWindow.h rename to Source/SettingsWindow.h index 3a48267..b698180 100644 --- a/Source/PreferencesWindow.h +++ b/Source/SettingsWindow.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2022 Chris Roberts -#ifndef _PREFERENCESWINDOW_H_ -#define _PREFERENCESWINDOW_H_ +#ifndef _SETTINGSWINDOW_H_ +#define _SETTINGSWINDOW_H_ #include @@ -10,16 +10,16 @@ class BCheckBox; class BTextControl; -class PreferencesWindow : public BWindow { +class SettingsWindow : public BWindow { public: - PreferencesWindow(BString& title); + SettingsWindow(BString& title); virtual void MessageReceived(BMessage* message); virtual bool QuitRequested(); private: - status_t _WritePreferences(); + status_t _WriteSettings(); #ifdef USE_MENUITEM_ICONS BCheckBox* fIconMenuCheckBox; @@ -27,4 +27,4 @@ class PreferencesWindow : public BWindow { BTextControl* fMenuLabelControl; }; -#endif // _PREFERENCESWINDOW_H_ +#endif // _SETTINGSWINDOW_H_ diff --git a/Source/locales/en.catkeys b/Source/locales/en.catkeys index 6c4f7dd..426dc0e 100644 --- a/Source/locales/en.catkeys +++ b/Source/locales/en.catkeys @@ -13,7 +13,7 @@ Manage commands… RunnerAddOn Manage commands… Use Terminal CommandSelectWindow Use Terminal Settings & Help RunnerAddOn Settings & Help Settings… RunnerAddOn Settings… -Defaults PreferencesWindow Defaults +Defaults SettingsWindow Defaults Failed to launch URL RunnerAddOn Failed to launch URL Command: CommandsWindow Command: TrackRunner\nWritten by Chris Roberts RunnerApp TrackRunner\nWritten by Chris Roberts @@ -23,9 +23,9 @@ Cancel CommandSelectWindow Cancel New CommandsWindow New Do you wish to delete '%s'? CommandsWindow Do you wish to delete '%s'? Unable to launch TrackRunner application RunnerAddOn Unable to launch TrackRunner application -Menu label: PreferencesWindow Menu label: +Menu label: SettingsWindow Menu label: Show in Tracker CommandsWindow Show in Tracker -Close PreferencesWindow Close +Close SettingsWindow Close Cancel CommandsWindow Cancel Browse… CommandSelectWindow Browse… Open the user guide CommandsWindow Open the user guide