Skip to content

Commit

Permalink
GUI: Switch to BSplitView and remove the Expander class
Browse files Browse the repository at this point in the history
Closes #22 and may help with #28
  • Loading branch information
CodeforEvolution authored and humdinger committed Aug 30, 2020
1 parent 0a5af03 commit c654e0c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 184 deletions.
111 changes: 0 additions & 111 deletions Expander.cpp

This file was deleted.

46 changes: 0 additions & 46 deletions Expander.h

This file was deleted.

47 changes: 25 additions & 22 deletions MainWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Copyright (C) 2008-2010 Lukas Sommer < SommerLuk at gmail dot com >
Copyright (C) 2017 Kai Niessen <kai.niessen@online.de>
Copyright (C) 2020 Jacob Secunda
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
Expand Down Expand Up @@ -58,38 +60,43 @@ MainWindow::MainWindow()
fMainMenu = new BMenuBar(Bounds(), "MainMenu");
BLayoutBuilder::Menu<>(fMainMenu)
.AddMenu(B_TRANSLATE("App"))
.AddItem(fMenuParallelPlayback)
.AddItem(B_TRANSLATE("Help" B_UTF8_ELLIPSIS), MSG_HELP)
.AddItem(B_TRANSLATE("About"), B_ABOUT_REQUESTED)
.AddSeparator()
.AddItem(B_TRANSLATE("Quit"), B_QUIT_REQUESTED, 'Q')
.AddItem(fMenuParallelPlayback)
.AddItem(B_TRANSLATE("Help" B_UTF8_ELLIPSIS), MSG_HELP)
.AddItem(B_TRANSLATE("About"), B_ABOUT_REQUESTED)
.AddSeparator()
.AddItem(B_TRANSLATE("Quit"), B_QUIT_REQUESTED, 'Q')
.End()
.AddMenu(B_TRANSLATE("Station"))
.AddItem(B_TRANSLATE("Paste Shoutcast URL"), MSG_PASTE_URL, 'V')
.AddItem(B_TRANSLATE("Check station"), MSG_CHECK)
.AddItem(B_TRANSLATE("Remove station"), MSG_REMOVE, 'R')
.AddItem(B_TRANSLATE("Paste Shoutcast URL"), MSG_PASTE_URL, 'V')
.AddItem(B_TRANSLATE("Check station"), MSG_CHECK)
.AddItem(B_TRANSLATE("Remove station"), MSG_REMOVE, 'R')
.End()
.AddMenu(B_TRANSLATE("Search"))
.AddItem(B_TRANSLATE("Find stations" B_UTF8_ELLIPSIS), MSG_SEARCH, 'S')
.AddItem(B_TRANSLATE("Find stations" B_UTF8_ELLIPSIS), MSG_SEARCH,
'S')
.End()
.End();
AddChild(fMainMenu);

fStationList = new StationListView(true);
BScrollView* stationScroll = new BScrollView(
"scrollStation", fStationList, B_FOLLOW_ALL_SIDES, 0, false, true);

fStationPanel = new StationPanel(this);
fExpander = new Expander("expStationPanel", fStationPanel);

fStatusBar = new BStringView("status", B_EMPTY_STRING);

BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetExplicitAlignment(
BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT))
.Add(stationScroll, 1.0f)
.Add(fExpander, 0.0f)
.Add(fStationPanel, 0.0f)
.Add(fStatusBar, 0.0f)
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fMainMenu)
.AddGroup(B_VERTICAL)
.SetInsets(B_USE_WINDOW_INSETS, 0, B_USE_WINDOW_INSETS,
B_USE_WINDOW_INSETS)
.AddSplit(B_VERTICAL, 2)
.Add(stationScroll)
.Add(fStationPanel)
.SetCollapsible(1, true)
.End()
.Add(fStatusBar)
.End()
.End();

fStationList->Sync(fSettings->Stations);
Expand All @@ -101,12 +108,8 @@ MainWindow::MainWindow()
BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_UNSET));
fStatusBar->SetExplicitMinSize(BSize(10, B_SIZE_UNSET));

Layout(true);

ResizeToPreferred();
CenterOnScreen();

fExpander->SetExpanded(false);
}


Expand Down
2 changes: 0 additions & 2 deletions MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <StringView.h>
#include <Window.h>

#include "Expander.h"
#include "RadioSettings.h"
#include "StationFinder.h"
#include "StationListView.h"
Expand Down Expand Up @@ -66,7 +65,6 @@ class MainWindow : public BWindow {
StationFinderWindow* fStationFinder;
StationPanel* fStationPanel;
BStringView* fStatusBar;
Expander* fExpander;
BObjectList<StationListViewItem> fActiveStations;
bool fAllowParallelPlayback;
BMenuItem* fMenuParallelPlayback;
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ APP_MIME_SIG = application/x-vnd.Fishpond-StreamRadio
# same name (source.c or source.cpp) are included from different directories.
# Also note that spaces in folder names do not work well with this Makefile.
SRCS := About.cpp \
Expander.cpp \
HttpUtils.cpp \
MainWindow.cpp \
RadioApp.cpp \
Expand Down
5 changes: 3 additions & 2 deletions StationPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ StationPanel::StationPanel(MainWindow* mainWindow, bool expanded)
"volume", NULL, new BMessage(MSG_CHG_VOLUME), 0, 100, B_VERTICAL);
fVolume->SetModificationMessage(new BMessage(MSG_CHG_VOLUME));

BLayoutBuilder::Grid<>(this, 7, 3)
BLayoutBuilder::Grid<>(this, B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
.SetInsets(B_USE_SMALL_INSETS)
.SetSpacing(B_USE_ITEM_SPACING, B_USE_SMALL_SPACING)
.Add(fLogo, 0, 0, 1, 3)
.Add(fLogo, 0, 0, 1, 4)
.AddTextControl(fName, 1, 0, B_ALIGN_LEFT)
.AddTextControl(fGenre, 3, 0, B_ALIGN_RIGHT, 1, 2)
.AddTextControl(fUrl, 1, 1, B_ALIGN_LEFT, 1, 4)
.AddTextControl(fStationUrl, 1, 2, B_ALIGN_LEFT, 1, 3)
.Add(fVisitStation, 5, 2)
.Add(fVolume, 6, 0, 1, 3)
.AddGlue(1, 3, 5, 1)
.End();
}

Expand Down

0 comments on commit c654e0c

Please sign in to comment.