Skip to content

Commit

Permalink
Shell|GUI: Added StatusWidget, renamed MainWindow to LinkWindow
Browse files Browse the repository at this point in the history
Also added a status bar indicating the currently connected address
and duration of the connection.
  • Loading branch information
skyjake committed Feb 9, 2013
1 parent 782bb42 commit 31f3f7c
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 87 deletions.
11 changes: 6 additions & 5 deletions doomsday/tools/shell/shell-gui/shell-gui.pro
Expand Up @@ -32,22 +32,24 @@ HEADERS += \
src/aboutdialog.h \
src/guishellapp.h \
src/localserverdialog.h \
src/mainwindow.h \
src/linkwindow.h \
src/opendialog.h \
src/qtguiapp.h \
src/qtrootwidget.h \
src/qttextcanvas.h
src/qttextcanvas.h \
src/statuswidget.h

SOURCES += \
src/aboutdialog.cpp \
src/guishellapp.cpp \
src/localserverdialog.cpp \
src/main.cpp \
src/mainwindow.cpp \
src/linkwindow.cpp \
src/opendialog.cpp \
src/qtguiapp.cpp \
src/qtrootwidget.cpp \
src/qttextcanvas.cpp
src/qttextcanvas.cpp \
src/statuswidget.cpp

RESOURCES += \
res/shell.qrc
Expand All @@ -63,4 +65,3 @@ macx {

doPostLink("macdeployqt \"Doomsday Shell.app\"")
}

24 changes: 12 additions & 12 deletions doomsday/tools/shell/shell-gui/src/guishellapp.cpp
Expand Up @@ -17,7 +17,7 @@
*/

#include "guishellapp.h"
#include "mainwindow.h"
#include "linkwindow.h"
#include "opendialog.h"
#include "aboutdialog.h"
#include "localserverdialog.h"
Expand All @@ -35,11 +35,11 @@ struct GuiShellApp::Instance

QMenuBar *menuBar;
QMenu *localMenu;
QList<MainWindow *> windows;
QList<LinkWindow *> windows;

~Instance()
{
foreach(MainWindow *win, windows)
foreach(LinkWindow *win, windows)
{
delete win;
}
Expand Down Expand Up @@ -86,13 +86,13 @@ GuiShellApp::~GuiShellApp()
delete d;
}

MainWindow *GuiShellApp::newOrReusedConnectionWindow()
LinkWindow *GuiShellApp::newOrReusedConnectionWindow()
{
MainWindow *found = 0;
LinkWindow *found = 0;
QWidget *other = activeWindow(); // for positioning a new window

// Look for a window with a closed connection.
foreach(MainWindow *win, d->windows)
foreach(LinkWindow *win, d->windows)
{
if(!win->isConnected())
{
Expand All @@ -107,8 +107,8 @@ MainWindow *GuiShellApp::newOrReusedConnectionWindow()

if(!found)
{
found = new MainWindow;
connect(found, SIGNAL(closed(MainWindow *)), this, SLOT(windowClosed(MainWindow *)));
found = new LinkWindow;
connect(found, SIGNAL(closed(LinkWindow *)), this, SLOT(windowClosed(LinkWindow *)));

// Initial position and size.
if(other)
Expand All @@ -134,7 +134,7 @@ ServerFinder &GuiShellApp::serverFinder()

void GuiShellApp::connectToServer()
{
MainWindow *win = newOrReusedConnectionWindow();
LinkWindow *win = newOrReusedConnectionWindow();

QScopedPointer<OpenDialog> dlg(new OpenDialog(win));
dlg->setWindowModality(Qt::WindowModal);
Expand All @@ -150,13 +150,13 @@ void GuiShellApp::connectToLocalServer()
QAction *act = dynamic_cast<QAction *>(sender());
Address host = act->data().value<Address>();

MainWindow *win = newOrReusedConnectionWindow();
LinkWindow *win = newOrReusedConnectionWindow();
win->openConnection(host.asText());
}

void GuiShellApp::disconnectFromServer()
{
MainWindow *win = dynamic_cast<MainWindow *>(activeWindow());
LinkWindow *win = dynamic_cast<LinkWindow *>(activeWindow());
if(win)
{
win->closeConnection();
Expand Down Expand Up @@ -214,7 +214,7 @@ void GuiShellApp::aboutShell()
AboutDialog().exec();
}

void GuiShellApp::windowClosed(MainWindow *window)
void GuiShellApp::windowClosed(LinkWindow *window)
{
d->windows.removeAll(window);
window->deleteLater();
Expand Down
6 changes: 3 additions & 3 deletions doomsday/tools/shell/shell-gui/src/guishellapp.h
Expand Up @@ -22,7 +22,7 @@
#include "qtguiapp.h"
#include <de/shell/ServerFinder>

class MainWindow;
class LinkWindow;

class GuiShellApp : public QtGuiApp
{
Expand All @@ -32,7 +32,7 @@ class GuiShellApp : public QtGuiApp
GuiShellApp(int &argc, char **argv);
~GuiShellApp();

MainWindow *newOrReusedConnectionWindow();
LinkWindow *newOrReusedConnectionWindow();
de::shell::ServerFinder &serverFinder();

static GuiShellApp &app();
Expand All @@ -47,7 +47,7 @@ public slots:
void aboutShell();

protected slots:
void windowClosed(MainWindow *window);
void windowClosed(LinkWindow *window);

private:
struct Instance;
Expand Down

0 comments on commit 31f3f7c

Please sign in to comment.