Redesign FeedEditWindow buttons, add tooltips

This commit is contained in:
Jaidyn Ann 2021-03-23 14:24:47 -05:00
parent c31969fef1
commit 59c9cc5c3f
3 changed files with 16 additions and 29 deletions

View File

@ -33,8 +33,6 @@ FeedEditWindow::FeedEditWindow()
{ {
_InitInterface(); _InitInterface();
MoveOnScreen(); MoveOnScreen();
fDeleteButton->SetEnabled(false);
fFeed = Feed(); fFeed = Feed();
} }
@ -48,8 +46,6 @@ FeedEditWindow::FeedEditWindow(BEntry feedEntry)
fFeedNameText->SetText(fFeed.Title().String()); fFeedNameText->SetText(fFeed.Title().String());
fFeedUrlText->SetText(fFeed.XmlUrl().UrlString().String()); fFeedUrlText->SetText(fFeed.XmlUrl().UrlString().String());
fDeleteButton->SetEnabled(true);
} }
@ -71,14 +67,14 @@ FeedEditWindow::MessageReceived(BMessage* msg)
{ {
switch (msg->what) switch (msg->what)
{ {
case kSaveButton: case kOkButton:
{ {
_SaveFeed(); _SaveFeed();
break; break;
} }
case kDeleteButton: case kCancelButton:
{ {
_DeleteFeed(); Quit();
break; break;
} }
} }
@ -94,11 +90,11 @@ FeedEditWindow::_InitInterface()
fFeedUrlLabel = new BStringView("feedUrlLabel", B_TRANSLATE("Feed URL:")); fFeedUrlLabel = new BStringView("feedUrlLabel", B_TRANSLATE("Feed URL:"));
fFeedUrlText = new BTextControl("feedUrl", "", "", NULL); fFeedUrlText = new BTextControl("feedUrl", "", "", NULL);
// Save/Delete // OK/Cancel
fSaveButton = new BButton("save", B_TRANSLATE("Save"), fOkButton = new BButton("ok", B_TRANSLATE("OK"),
new BMessage(kSaveButton)); new BMessage(kOkButton));
fDeleteButton = new BButton("delete", B_TRANSLATE("Delete"), fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(kDeleteButton)); new BMessage(kCancelButton));
BLayoutBuilder::Group<>(this, B_VERTICAL, 0) BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0) .SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0)
@ -119,9 +115,9 @@ FeedEditWindow::_InitInterface()
.Add(new BSeparatorView(B_HORIZONTAL)) .Add(new BSeparatorView(B_HORIZONTAL))
.AddGroup(B_HORIZONTAL) .AddGroup(B_HORIZONTAL)
.Add(fCancelButton)
.AddGlue() .AddGlue()
.Add(fDeleteButton) .Add(fOkButton)
.Add(fSaveButton)
.SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING, .SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING) B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING)
.End() .End()
@ -194,13 +190,3 @@ FeedEditWindow::_SaveFeed()
} }
void
FeedEditWindow::_DeleteFeed()
{
fFeed.Unfiletize();
BMessage edited(kFeedsEdited);
((App*)be_app)->PostMessage(&edited);
Quit();
}

View File

@ -18,8 +18,8 @@ class FeedListItem;
enum enum
{ {
kSaveButton = 'esav', kOkButton = 'edok',
kDeleteButton = 'edel' kCancelButton = 'ecan'
}; };
@ -36,7 +36,6 @@ private:
void _InitInterface(); void _InitInterface();
void _SaveFeed(); void _SaveFeed();
void _DeleteFeed();
BString fFeedPath; BString fFeedPath;
Feed fFeed; Feed fFeed;
@ -46,8 +45,8 @@ private:
BStringView* fFeedUrlLabel; BStringView* fFeedUrlLabel;
BTextControl* fFeedUrlText; BTextControl* fFeedUrlText;
BButton* fSaveButton; BButton* fOkButton;
BButton* fDeleteButton; BButton* fCancelButton;
}; };

View File

@ -126,6 +126,8 @@ FeedsView::_InitInterface()
// Add, Remove, Edit // Add, Remove, Edit
fAddButton = new BButton("addFeed", "+", new BMessage(kFeedsAddButton)); fAddButton = new BButton("addFeed", "+", new BMessage(kFeedsAddButton));
fRemoveButton = new BButton("removeFeed", "-", new BMessage(kFeedsRemoveButton)); fRemoveButton = new BButton("removeFeed", "-", new BMessage(kFeedsRemoveButton));
fAddButton->SetToolTip(B_TRANSLATE("Add new feed"));
fRemoveButton->SetToolTip(B_TRANSLATE("Remove selected feed"));
fEditButton = new BButton("editFeed", B_TRANSLATE("Edit…"), fEditButton = new BButton("editFeed", B_TRANSLATE("Edit…"),
new BMessage(kFeedsEditButton)); new BMessage(kFeedsEditButton));