Skip to content

Commit

Permalink
Shell: Continuing work with the Shell UI
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 2, 2019
1 parent d80b837 commit 63c814c
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 159 deletions.
2 changes: 2 additions & 0 deletions doomsday/tools/shell/src/aboutdialog.cpp
Expand Up @@ -10,6 +10,8 @@ AboutDialog::AboutDialog()
{
title().setText("Doomsday Shell");

buttons() << new ButtonItem(Default | Accept, "OK");

// QVBoxLayout *box = new QVBoxLayout;
// setLayout(box);
// box->setSizeConstraint(QLayout::SetFixedSize);
Expand Down
5 changes: 4 additions & 1 deletion doomsday/tools/shell/src/guishellapp.cpp
Expand Up @@ -339,7 +339,10 @@ void GuiShellApp::updateLocalServerMenu()

void GuiShellApp::aboutShell()
{
// AboutDialog().exec();
auto *win = d->winSys->focusedWindow();
auto *about = new AboutDialog;
about->setDeleteAfterDismissed(true);
about->exec(win->root());
}

void GuiShellApp::showHelp()
Expand Down
78 changes: 41 additions & 37 deletions doomsday/tools/shell/src/linkwindow.cpp
Expand Up @@ -23,19 +23,20 @@
#include "preferences.h"
#include "errorlogdialog.h"

#include <de/LogBuffer>
#include <de/term/LogWidget>
#include <de/term/CommandLineWidget>
#include <de/Garbage>
#include <de/CommandWidget>
#include <de/EventLoop>
#include <de/Timer>
#include <de/Garbage>
#include <de/KeyActions>
#include <de/NativeFile>
#include <de/LogBuffer>
#include <de/LogWidget>
#include <de/CommandWidget>
#include <de/NativeFile>
#include <de/PopupMenuWidget>
#include <de/SequentialLayout>
#include <de/StyledLogSinkFormatter>
#include <de/TabWidget>
#include <de/Timer>
#include <de/term/CommandLineWidget>
#include <de/term/LogWidget>

//#ifndef MACOSX
//# define MENU_IN_LINK_WINDOW
Expand Down Expand Up @@ -68,46 +69,34 @@ DE_PIMPL(LinkWindow)
{
GuiRootWidget root;
LogBuffer logBuffer;
network::Link *link;
network::Link *link = nullptr;
duint16 waitingForLocalPort = 0;
Time startedWaitingAt;
Timer waitTimeout;
String linkName;
NativePath errorLog;
GuiWidget *tools;
// ButtonWidget *statusButton;
// ButtonWidget *optionsButton;
// ButtonWidget *consoleButton;
TabWidget *pageTabs;
GuiWidget *newLocalServerPage;
GuiWidget *consolePage;
GuiWidget *tools = nullptr;
TabWidget *pageTabs = nullptr;
GuiWidget *newLocalServerPage = nullptr;
GuiWidget *consolePage = nullptr;
List<GuiWidget *> pages;
StatusWidget *status;
OptionsPage *options;
StatusWidget *status = nullptr;
OptionsPage *options = nullptr;
StyledLogSinkFormatter logFormatter{LogEntry::Styled | LogEntry::OmitLevel};
LogWidget *logWidget;
ServerCommandWidget *commandWidget;
LabelWidget *statusMessage;
LabelWidget *gameStatus;
LabelWidget *timeCounter;
LabelWidget *currentHost;
// QAction *stopAction;
LogWidget *logWidget = nullptr;
ServerCommandWidget *commandWidget = nullptr;
LabelWidget *statusMessage = nullptr;
LabelWidget *gameStatus = nullptr;
LabelWidget *timeCounter = nullptr;
LabelWidget *currentHost = nullptr;
PopupMenuWidget *menu = nullptr;
#ifdef MENU_IN_LINK_WINDOW
// QAction *disconnectAction;
#endif

Impl(Public &i)
: Base(i)
, root(&i)
, link(0)
// tools(0),
// statusButton(0),
// consoleButton(0),
// stack(0),
, status(0)
// gameStatus(0),
// timeCounter(0),
// currentHost(0)
{
// Configure the log buffer.
logBuffer.setMaxEntryCount(50); // buffered here rather than appBuffer
Expand Down Expand Up @@ -214,6 +203,15 @@ DE_PIMPL(LinkWindow)

// Status bar.
{
menu = &root.addNew<PopupMenuWidget>();
menu->items()
<< new ui::ActionItem("About Doomsday Shell", [](){ GuiShellApp::app().aboutShell(); });
auto *menuButton = &root.addNew<PopupButtonWidget>();
menuButton->setSizePolicy(ui::Expand, ui::Expand);
menuButton->setText("Menu");
menuButton->setPopup(*menu, ui::Up);
// menuButton->setStyleImage("", menuButton->fontId());

root.add(statusBar);

statusMessage = new LabelWidget;
Expand Down Expand Up @@ -251,6 +249,10 @@ DE_PIMPL(LinkWindow)
.setInput(Rule::Right, root.viewRight())
.setInput(Rule::Bottom, root.viewBottom())
.setInput(Rule::Height, statusHeight);

menuButton->rule()
.setInput(Rule::Right, root.viewRight())
.setInput(Rule::Bottom, root.viewBottom());
}

for (auto *page : pages)
Expand Down Expand Up @@ -535,6 +537,8 @@ LinkWindow::LinkWindow(const String &id)
connect(&d->waitTimeout, SIGNAL(timeout()), this, SLOT(checkFoundServers()));
d->waitTimeout.start();
#endif

setTitle("Disconnected");
}

GuiRootWidget &LinkWindow::root()
Expand All @@ -559,10 +563,10 @@ void LinkWindow::drawWindowContent()
d->root.draw();
}

//void LinkWindow::setTitle(const QString &title)
//{
// setWindowTitle(title + " - " + tr("Doomsday Shell"));
//}
void LinkWindow::setTitle(const String &title)
{
BaseWindow::setTitle(title + " - Doomsday Shell");
}

bool LinkWindow::isConnected() const
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/tools/shell/src/linkwindow.h
Expand Up @@ -38,7 +38,7 @@ class LinkWindow : public de::BaseWindow
de::Vec2f windowContentSize() const override;
void drawWindowContent() override;

// void setTitle(QString const &title);
void setTitle(const de::String &title);

bool isConnected() const;

Expand Down

0 comments on commit 63c814c

Please sign in to comment.