Skip to content

Commit

Permalink
Use normal BAlerts instead of "DAlert"
Browse files Browse the repository at this point in the history
* Use CapitalBe icon for "Welcome" BAlert.
* Remove no longer needed vector icons for custom DAlerts.
  • Loading branch information
humdingerb committed Sep 29, 2024
1 parent 35c77f5 commit 5cdd78d
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 988 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ SRCS = \
src/CheckView.cpp \
src/CppSQLite3.cpp \
src/CurrencyBox.cpp \
src/DAlert.cpp \
src/Database.cpp \
src/DateBox.cpp \
src/DStringList.cpp \
Expand Down
23 changes: 18 additions & 5 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
* dospuntos (Johan Wagenheim)
*/
#include <AboutWindow.h>
#include <Alert.h>
#include <AppFileInfo.h>
#include <Application.h>
#include <Bitmap.h>
#include <Catalog.h>
#include <FilePanel.h>
#include <FindDirectory.h>
Expand All @@ -22,7 +25,6 @@

#include <Roster.h>
#include "App.h"
#include "DAlert.h"
#include "Preferences.h"


Expand Down Expand Up @@ -130,8 +132,8 @@ App::MessageReceived(BMessage* msg)
B_TRANSLATE("The file '%filename%' appears not to be a CapitalBe ledger.\n"
"Or it doesn't have the 'CapitalBe ledger' filetype.\n"));
text.ReplaceFirst("%filename%", path.Leaf());
DAlert* alert
= new DAlert(B_TRANSLATE_SYSTEM_NAME("CapitalBe"), text, B_TRANSLATE("OK"),
BAlert* alert
= new BAlert(B_TRANSLATE_SYSTEM_NAME("CapitalBe"), text, B_TRANSLATE("OK"),
NULL, NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_INFO_ALERT);
alert->Go();
return;
Expand Down Expand Up @@ -260,11 +262,21 @@ App::_IsFileLocked(BPath path)
void
App::_ShowAlert(BString text)
{
DAlert* alert = new DAlert(B_TRANSLATE_SYSTEM_NAME("CapitalBe"), text, B_TRANSLATE("Cancel"),
BAlert* alert = new BAlert(B_TRANSLATE_SYSTEM_NAME("CapitalBe"), text, B_TRANSLATE("Cancel"),
B_TRANSLATE("Open ledger"), B_TRANSLATE("Create new ledger"), B_WIDTH_AS_USUAL,
B_OFFSET_SPACING, B_INFO_ALERT);
alert->SetShortcut(0, B_ESCAPE);

entry_ref ref;
be_roster->FindApp(kApplicationSignature, &ref);

BFile file(&ref, B_READ_ONLY);
BAppFileInfo appMime(&file);

BBitmap* icon = new BBitmap(BRect(0.0, 0.0, 63.0, 63.0), B_RGBA32);
appMime.GetIcon(icon, (icon_size)64);
alert->SetIcon(icon);

switch (alert->Go()) {
case 0:
{
Expand All @@ -287,6 +299,7 @@ App::_ShowAlert(BString text)
newLedger->Show();
} break;
}
delete icon;
}


Expand All @@ -305,7 +318,7 @@ App::_ShowMainWindow(BPath path)
"The ledger '%filename%' appears to be already open.\n"
"Entering data into the same ledger in parallel will probably lead to data loss.\n"));
text.ReplaceFirst("%filename%", path.Leaf());
DAlert* alert = new DAlert(B_TRANSLATE_SYSTEM_NAME("CapitalBe"), text,
BAlert* alert = new BAlert(B_TRANSLATE_SYSTEM_NAME("CapitalBe"), text,
B_TRANSLATE("Cancel"), B_TRANSLATE("Open ledger"), NULL, B_WIDTH_AS_USUAL,
B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
Expand Down
2 changes: 1 addition & 1 deletion src/CBLocale.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#ifndef CBLOCALE_H
#define CBLOCALE_H

#include "DAlert.h"
#include "Fixed.h"

#include <Alert.h>
#include <File.h>
#include <String.h>
#include <TextControl.h>
Expand Down
4 changes: 2 additions & 2 deletions src/CategoryBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ CategoryBox::Validate()
BString category(Text());

if (category == "") {
DAlert* alert = new DAlert(B_TRANSLATE("Category is missing"),
BAlert* alert = new BAlert(B_TRANSLATE("Category is missing"),
B_TRANSLATE(
"Do you really want to add this transaction without a category?\n\n"
"Even then, you need to select a transaction type, 'income' or 'spending'.\n"),
Expand Down Expand Up @@ -167,7 +167,7 @@ CategoryBox::_AddNewCategory(BString category)
"Please select a transaction type for it, 'income' or 'spending'."));
text.ReplaceFirst("%categoryname%", category);

DAlert* alert = new DAlert(B_TRANSLATE("New category"), text, B_TRANSLATE("Income"),
BAlert* alert = new BAlert(B_TRANSLATE("New category"), text, B_TRANSLATE("Income"),
B_TRANSLATE("Spending"), B_TRANSLATE("Cancel"), B_WIDTH_AS_USUAL, B_WARNING_ALERT);
int32 value = alert->Go();
if (value == 0) {
Expand Down
1 change: 0 additions & 1 deletion src/CheckView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "CategoryButton.h"
#include "CheckView.h"
#include "CurrencyBox.h"
#include "DAlert.h"
#include "Database.h"
#include "DateBox.h"
#include "MsgDefs.h"
Expand Down
Loading

0 comments on commit 5cdd78d

Please sign in to comment.