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();
MoveOnScreen();
fDeleteButton->SetEnabled(false);
fFeed = Feed();
}
@ -48,8 +46,6 @@ FeedEditWindow::FeedEditWindow(BEntry feedEntry)
fFeedNameText->SetText(fFeed.Title().String());
fFeedUrlText->SetText(fFeed.XmlUrl().UrlString().String());
fDeleteButton->SetEnabled(true);
}
@ -71,14 +67,14 @@ FeedEditWindow::MessageReceived(BMessage* msg)
{
switch (msg->what)
{
case kSaveButton:
case kOkButton:
{
_SaveFeed();
break;
}
case kDeleteButton:
case kCancelButton:
{
_DeleteFeed();
Quit();
break;
}
}
@ -94,11 +90,11 @@ FeedEditWindow::_InitInterface()
fFeedUrlLabel = new BStringView("feedUrlLabel", B_TRANSLATE("Feed URL:"));
fFeedUrlText = new BTextControl("feedUrl", "", "", NULL);
// Save/Delete
fSaveButton = new BButton("save", B_TRANSLATE("Save"),
new BMessage(kSaveButton));
fDeleteButton = new BButton("delete", B_TRANSLATE("Delete"),
new BMessage(kDeleteButton));
// OK/Cancel
fOkButton = new BButton("ok", B_TRANSLATE("OK"),
new BMessage(kOkButton));
fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(kCancelButton));
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0, B_USE_DEFAULT_SPACING, 0, 0)
@ -119,9 +115,9 @@ FeedEditWindow::_InitInterface()
.Add(new BSeparatorView(B_HORIZONTAL))
.AddGroup(B_HORIZONTAL)
.Add(fCancelButton)
.AddGlue()
.Add(fDeleteButton)
.Add(fSaveButton)
.Add(fOkButton)
.SetInsets(B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_WINDOW_SPACING)
.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
{
kSaveButton = 'esav',
kDeleteButton = 'edel'
kOkButton = 'edok',
kCancelButton = 'ecan'
};
@ -36,7 +36,6 @@ private:
void _InitInterface();
void _SaveFeed();
void _DeleteFeed();
BString fFeedPath;
Feed fFeed;
@ -46,8 +45,8 @@ private:
BStringView* fFeedUrlLabel;
BTextControl* fFeedUrlText;
BButton* fSaveButton;
BButton* fDeleteButton;
BButton* fOkButton;
BButton* fCancelButton;
};

View File

@ -126,6 +126,8 @@ FeedsView::_InitInterface()
// Add, Remove, Edit
fAddButton = new BButton("addFeed", "+", new BMessage(kFeedsAddButton));
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…"),
new BMessage(kFeedsEditButton));