Navigation Menu

Skip to content

Commit

Permalink
Shell: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 513f679 commit 4012e2f
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 144 deletions.
6 changes: 3 additions & 3 deletions doomsday/tools/shell-text/src/aboutdialog.cpp
Expand Up @@ -17,14 +17,14 @@
*/

#include "aboutdialog.h"
#include <de/shell/LabelTedget>
#include <de/shell/LabelWidget>

using namespace de;
using namespace de::shell;

AboutDialog::AboutDialog()
{
LabelTedget *label = new LabelTedget;
LabelWidget *label = new LabelWidget;
label->setLabel(String::format("Doomsday Shell %s\nCopyright (c) %s\n\n"
"The Shell is a utility for controlling and monitoring "
"Doomsday servers using a text-based (curses) user interface.",
Expand All @@ -48,5 +48,5 @@ bool AboutDialog::handleEvent(Event const &event)
accept();
return true;
}
return DialogTedget::handleEvent(event);
return DialogWidget::handleEvent(event);
}
4 changes: 2 additions & 2 deletions doomsday/tools/shell-text/src/aboutdialog.h
Expand Up @@ -19,12 +19,12 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H

#include <de/shell/DialogTedget>
#include <de/shell/DialogWidget>

/**
* Dialog for information about the program.
*/
class AboutDialog : public de::shell::DialogTedget
class AboutDialog : public de::shell::DialogWidget
{
public:
AboutDialog();
Expand Down
4 changes: 2 additions & 2 deletions doomsday/tools/shell-text/src/cursesapp.cpp
Expand Up @@ -26,7 +26,7 @@
#include <de/Vector>
#include <de/LogBuffer>
#include <de/shell/TextRootWidget>
#include <de/shell/Tedget>
#include <de/shell/Widget>
#include <de/shell/KeyEvent>
#include <curses.h>
#include <stdio.h>
Expand Down Expand Up @@ -333,7 +333,7 @@ DE_PIMPL(CursesApp)
break;

default:
#ifdef _DEBUG
#if defined (DE_DEBUG)
if (key & KEY_CODE_YES)
debug("CURSES 0x%x", key);
else
Expand Down
23 changes: 11 additions & 12 deletions doomsday/tools/shell-text/src/localserverdialog.cpp
Expand Up @@ -17,12 +17,11 @@
*/

#include "localserverdialog.h"
#include "persistentdata.h"
#include <de/shell/TextRootWidget>
#include <de/shell/LabelTedget>
#include <de/shell/MenuTedget>
#include <de/shell/ChoiceTedget>
#include <de/shell/LineEditTedget>
#include <de/shell/LabelWidget>
#include <de/shell/MenuWidget>
#include <de/shell/ChoiceWidget>
#include <de/shell/LineEditWidget>
#include <de/shell/DoomsdayInfo>
#include <de/Config>

Expand All @@ -31,17 +30,17 @@ using namespace de::shell;

DE_PIMPL_NOREF(LocalServerDialog)
{
ChoiceTedget *choice;
LineEditTedget *port;
ChoiceWidget * choice;
LineEditWidget *port;
};

LocalServerDialog::LocalServerDialog() : d(new Impl)
{
add(d->choice = new ChoiceTedget ("gameMode"));
add(d->port = new LineEditTedget("serverPort"));
add(d->choice = new ChoiceWidget ("gameMode"));
add(d->port = new LineEditWidget("serverPort"));

// Define the contents for the choice list.
ChoiceTedget::Items modes;
ChoiceWidget::Items modes;
for (const DoomsdayInfo::Game &game : DoomsdayInfo::allGames())
{
modes << game.title;
Expand Down Expand Up @@ -100,14 +99,14 @@ String LocalServerDialog::gameMode() const

void LocalServerDialog::prepare()
{
InputDialogTedget::prepare();
InputDialogWidget::prepare();

root().setFocus(d->choice);
}

void LocalServerDialog::finish(int result)
{
InputDialogTedget::finish(result);
InputDialogWidget::finish(result);

if (result)
{
Expand Down
4 changes: 2 additions & 2 deletions doomsday/tools/shell-text/src/localserverdialog.h
Expand Up @@ -20,9 +20,9 @@
#define LOCALSERVERDIALOG_H

#include <de/libcore.h>
#include <de/shell/InputDialogTedget>
#include <de/shell/InputDialogWidget>

class LocalServerDialog : public de::shell::InputDialogTedget
class LocalServerDialog : public de::shell::InputDialogWidget
{
public:
LocalServerDialog();
Expand Down
9 changes: 4 additions & 5 deletions doomsday/tools/shell-text/src/openconnectiondialog.cpp
Expand Up @@ -17,13 +17,12 @@
*/

#include "openconnectiondialog.h"
#include "persistentdata.h"
#include <de/shell/LineEditTedget>
#include <de/shell/LineEditWidget>
#include <de/Config>

using namespace de;

OpenConnectionDialog::OpenConnectionDialog(String const &name) : shell::InputDialogTedget(name)
OpenConnectionDialog::OpenConnectionDialog(String const &name) : shell::InputDialogWidget(name)
{
setDescription("Enter the address of the server you want to connect to. "
"The address can be a domain name or an IP address. "
Expand All @@ -37,14 +36,14 @@ OpenConnectionDialog::OpenConnectionDialog(String const &name) : shell::InputDia
setAcceptLabel("Connect to server");
}

String OpenConnectionDialog::address()
String OpenConnectionDialog::address() const
{
return text();
}

void OpenConnectionDialog::finish(int result)
{
InputDialogTedget::finish(result);
InputDialogWidget::finish(result);

if (result)
{
Expand Down
6 changes: 3 additions & 3 deletions doomsday/tools/shell-text/src/openconnectiondialog.h
Expand Up @@ -19,12 +19,12 @@
#ifndef OPENCONNECTIONDIALOG_H
#define OPENCONNECTIONDIALOG_H

#include <de/shell/InputDialogTedget>
#include <de/shell/InputDialogWidget>

/**
* Dialog for specifying address for opening a connection.
*/
class OpenConnectionDialog : public de::shell::InputDialogTedget
class OpenConnectionDialog : public de::shell::InputDialogWidget
{
public:
OpenConnectionDialog(de::String const &name = de::String());
Expand All @@ -33,7 +33,7 @@ class OpenConnectionDialog : public de::shell::InputDialogTedget
* Returns the address that the user entered in the dialog. If the dialog
* was rejected, the returned string is empy.
*/
de::String address();
de::String address() const;

protected:
void finish(int result);
Expand Down
53 changes: 0 additions & 53 deletions doomsday/tools/shell-text/src/persistentdata.cpp

This file was deleted.

44 changes: 0 additions & 44 deletions doomsday/tools/shell-text/src/persistentdata.h

This file was deleted.

30 changes: 15 additions & 15 deletions doomsday/tools/shell-text/src/shellapp.cpp
Expand Up @@ -22,10 +22,10 @@
#include "localserverdialog.h"
#include "aboutdialog.h"

#include <de/shell/LabelTedget>
#include <de/shell/MenuTedget>
#include <de/shell/CommandLineTedget>
#include <de/shell/LogTedget>
#include <de/shell/LabelWidget>
#include <de/shell/MenuWidget>
#include <de/shell/CommandLineWidget>
#include <de/shell/LogWidget>
#include <de/shell/Action>
#include <de/shell/Link>
#include <de/shell/LocalServer>
Expand All @@ -41,12 +41,12 @@ using namespace de;
using namespace shell;

DE_PIMPL(ShellApp)
, DE_OBSERVES(CommandLineTedget, Command)
, DE_OBSERVES(CommandLineWidget, Command)
{
MenuTedget * menu;
LogTedget * log;
CommandLineTedget *cli;
LabelTedget * menuLabel;
MenuWidget * menu;
LogWidget * log;
CommandLineWidget *cli;
LabelWidget * menuLabel;
StatusWidget * status;
Link * link = nullptr;
ServerFinder finder;
Expand All @@ -64,7 +64,7 @@ DE_PIMPL(ShellApp)
.setInput(Rule::Left, root.viewLeft());

// Menu button at the left edge.
menuLabel = new LabelTedget;
menuLabel = new LabelWidget;
menuLabel->setAlignment(AlignTop);
menuLabel->setLabel(" F9:Menu ");
menuLabel->setAttribs(TextCanvas::AttribChar::Bold);
Expand All @@ -81,7 +81,7 @@ DE_PIMPL(ShellApp)
menuLabel->addAction(new shell::Action(KeyEvent(Key::Cancel), [this](){ self().quit(); }));

// Expanding command line widget.
cli = new CommandLineTedget;
cli = new CommandLineWidget;
cli->rule()
.setInput(Rule::Left, menuLabel->rule().right())
.setInput(Rule::Right, root.viewRight())
Expand All @@ -90,7 +90,7 @@ DE_PIMPL(ShellApp)
menuLabel->rule().setInput(Rule::Top, cli->rule().top());

// Log history covers the rest of the view.
log = new LogTedget;
log = new LogWidget;
log->rule()
.setInput(Rule::Left, root.viewLeft())
.setInput(Rule::Width, root.viewWidth())
Expand All @@ -100,7 +100,7 @@ DE_PIMPL(ShellApp)
log->addAction(new shell::Action(KeyEvent(Key::F5), [this]() { log->scrollToBottom(); }));

// Main menu.
menu = new MenuTedget(MenuTedget::Popup);
menu = new MenuWidget(MenuWidget::Popup);
menu->appendItem(new shell::Action("Connect to...",
[this]() { self().askToOpenConnection(); }));
menu->appendItem(new shell::Action("Disconnect", [this](){ self().closeConnection(); }));
Expand Down Expand Up @@ -209,10 +209,10 @@ void ShellApp::closeConnection()

void ShellApp::askForPassword()
{
InputDialogTedget dlg;
InputDialogWidget dlg;
dlg.setDescription("The server requires a password.");
dlg.setPrompt("Password: ");
dlg.lineEdit().setEchoMode(LineEditTedget::PasswordEchoMode);
dlg.lineEdit().setEchoMode(LineEditWidget::PasswordEchoMode);
dlg.lineEdit().setSignalOnEnter(false);

if (dlg.exec(rootWidget()))
Expand Down
2 changes: 1 addition & 1 deletion doomsday/tools/shell-text/src/statuswidget.cpp
Expand Up @@ -55,7 +55,7 @@ DE_PIMPL(StatusWidget)
};

StatusWidget::StatusWidget(String const &name)
: Tedget(name), d(new Impl(*this))
: Widget(name), d(new Impl(*this))
{
d->updateTimer.audienceForTrigger() += [this]() { d->refresh(); };
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/tools/shell-text/src/statuswidget.h
Expand Up @@ -19,10 +19,10 @@
#ifndef STATUSWIDGET_H
#define STATUSWIDGET_H

#include <de/shell/Tedget>
#include <de/shell/Widget>
#include <de/shell/Link>

class StatusWidget : public de::shell::Tedget
class StatusWidget : public de::shell::Widget
{
public:
StatusWidget(de::String const &name = de::String());
Expand Down

0 comments on commit 4012e2f

Please sign in to comment.