Skip to content

Commit

Permalink
Add help buttons to more windows
Browse files Browse the repository at this point in the history
Now that we have documentation on this, we may as well link to those
chapters.

* "Account settings" window
* "Application settings" window
* "Categories" window
* "Schedule" window
* "Scheduled transactions" window
* "Transfer" window
  • Loading branch information
humdingerb committed Aug 1, 2024
1 parent 85679f3 commit af7f246
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/AccountSettingsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "AutoTextControl.h"
#include "CBLocale.h"
#include "Database.h"
#include "Help.h"
#include "PrefWindow.h"

#undef B_TRANSLATION_CONTEXT
Expand Down Expand Up @@ -44,6 +45,8 @@ AccountSettingsWindow::AccountSettingsWindow(Account* account)
templocale = fAccount->GetLocale();
fPrefView = new CurrencyPrefView("prefview", &templocale);

HelpButton* helpButton = new HelpButton("start.html", "#new-account");

fOK = new BButton("okbutton", B_TRANSLATE("OK"), new BMessage(M_EDIT_ACCOUNT_SETTINGS));

if (strlen(fAccountName->Text()) < 1)
Expand All @@ -66,7 +69,9 @@ AccountSettingsWindow::AccountSettingsWindow(Account* account)
.Add(fPrefView)
.End()
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.AddGlue()
.AddGlue(0)
.Add(helpButton)
.AddGlue(1)
.Add(cancel)
.Add(fOK)
.End()
Expand Down
7 changes: 6 additions & 1 deletion src/CategoryWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "AutoTextControl.h"
#include "Database.h"
#include "Help.h"


#undef B_TRANSLATION_CONTEXT
Expand Down Expand Up @@ -103,6 +104,8 @@ CategoryView::CategoryView(const char* name, const int32& flags)
: BView(name, flags)
{
// the buttons
HelpButton* helpButton = new HelpButton("menus.html", "#categories");

fEditButton = new BButton(
"editbutton", B_TRANSLATE("Edit" B_UTF8_ELLIPSIS), new BMessage(M_SHOW_EDIT_WINDOW));
fRemoveButton = new BButton(
Expand Down Expand Up @@ -130,7 +133,9 @@ CategoryView::CategoryView(const char* name, const int32& flags)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(scrollView)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.AddGlue(0)
.Add(helpButton)
.AddGlue(1)
.Add(fEditButton)
.Add(fRemoveButton)
.Add(fAddButton)
Expand Down
6 changes: 5 additions & 1 deletion src/PrefWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <MenuItem.h>

#include "Database.h"
#include "Help.h"


#undef B_TRANSLATION_CONTEXT
Expand All @@ -26,6 +27,7 @@ PrefWindow::PrefWindow(const BRect& frame, BMessenger target)

fNegNumberView = new NegativeNumberView("negcolor", gNegativeColor);

HelpButton* helpButton = new HelpButton("menus.html", "#app-settings");
BButton* cancel
= new BButton("cancelbutton", B_TRANSLATE("Cancel"), new BMessage(B_QUIT_REQUESTED));
BButton* ok = new BButton("okbutton", B_TRANSLATE("OK"), new BMessage(M_EDIT_OPTIONS));
Expand All @@ -37,7 +39,9 @@ PrefWindow::PrefWindow(const BRect& frame, BMessenger target)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(fNegNumberView)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.AddGlue()
.AddGlue(0)
.Add(helpButton)
.AddGlue(1)
.Add(cancel)
.Add(ok)
.End()
Expand Down
2 changes: 1 addition & 1 deletion src/ReportWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ReportWindow::ReportWindow(BRect frame)

BGroupLayout* listLayout = new BGroupLayout(B_VERTICAL, 1.0f);

HelpButton* help = new HelpButton("report.html", NULL);
HelpButton* help = new HelpButton("reports.html", NULL);

// clang-format off
BLayoutBuilder::Group<>(this, B_HORIZONTAL)
Expand Down
7 changes: 6 additions & 1 deletion src/ScheduleAddWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "CalendarButton.h"
#include "Database.h"
#include "DateBox.h"
#include "Help.h"
#include "NumBox.h"
#include "ScheduledExecutor.h"
#include "ScheduledTransData.h"
Expand Down Expand Up @@ -137,6 +138,8 @@ ScheduleAddWindow::ScheduleAddWindow(const BRect& frame, const TransactionData&
BButton* cancelButton
= new BButton("cancelbutton", B_TRANSLATE("Cancel"), new BMessage(B_QUIT_REQUESTED));

HelpButton* helpButton = new HelpButton("menus.html", "#schedule");

// clang-format off
BView* calendarStartWidget = new BView("calendarstartwidget", B_WILL_DRAW);
BLayoutBuilder::Group<>(calendarStartWidget, B_HORIZONTAL, -2)
Expand Down Expand Up @@ -181,7 +184,9 @@ ScheduleAddWindow::ScheduleAddWindow(const BRect& frame, const TransactionData&
.End()
.AddStrut(B_USE_BIG_SPACING)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.AddGlue()
.AddGlue(0)
.Add(helpButton)
.AddGlue(1)
.Add(cancelButton)
.Add(okButton)
.End()
Expand Down
2 changes: 1 addition & 1 deletion src/ScheduleListWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ScheduleListView::ScheduleListView(const char* name, const int32& flags)
fBestWidth = MAX(fBestWidth, 400);

HelpButton* helpButton
= new HelpButton("start.html", "#scheduled-transactions");
= new HelpButton("menus.html", "#scheduled-transactions");

// clang-format off
BLayoutBuilder::Group<>(this, B_VERTICAL)
Expand Down
7 changes: 6 additions & 1 deletion src/TransferWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Database.h"
#include "DateBox.h"
#include "Fixed.h"
#include "Help.h"
#include "MsgDefs.h"

#undef B_TRANSLATION_CONTEXT
Expand Down Expand Up @@ -60,6 +61,8 @@ TransferWindow::InitObject(Account* src, Account* dest, const Fixed& amount)
fToLabel = new BStringView("tolabel", B_TRANSLATE("To account:"));
fToLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

HelpButton* helpButton = new HelpButton("start.html", "#transfer");

fOK = new BButton("okbutton", B_TRANSLATE("OK"), new BMessage(M_CREATE_TRANSFER));
fOK->SetEnabled(false);
fOK->MakeDefault(true);
Expand Down Expand Up @@ -160,7 +163,9 @@ TransferWindow::InitObject(Account* src, Account* dest, const Fixed& amount)
.End()
.AddStrut(B_USE_DEFAULT_SPACING)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.AddGlue(0)
.Add(helpButton)
.AddGlue(1)
.Add(fCancel)
.Add(fOK)
.AddGlue()
Expand Down

0 comments on commit af7f246

Please sign in to comment.