Skip to content

Commit

Permalink
libshell: Relocated LogWidget and CommandLineWidget to libshell
Browse files Browse the repository at this point in the history
These two widgets are generic enough to work in a GUI Shell as well.
  • Loading branch information
skyjake committed Feb 6, 2013
1 parent 7ec3ead commit 744480f
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 33 deletions.
1 change: 1 addition & 0 deletions doomsday/libshell/include/de/shell/CommandLineWidget
@@ -0,0 +1 @@
#include "commandlinewidget.h"
1 change: 1 addition & 0 deletions doomsday/libshell/include/de/shell/LogWidget
@@ -0,0 +1 @@
#include "logwidget.h"
Expand Up @@ -16,23 +16,26 @@
* http://www.gnu.org/licenses</small>
*/

#ifndef COMMANDLINEWIDGET_H
#define COMMANDLINEWIDGET_H
#ifndef LIBSHELL_COMMANDLINEWIDGET_H
#define LIBSHELL_COMMANDLINEWIDGET_H

#include <de/shell/LineEditWidget>
#include "LineEditWidget"

namespace de {
namespace shell {

/**
* Text editor with a history.
*/
class CommandLineWidget : public de::shell::LineEditWidget
class CommandLineWidget : public LineEditWidget
{
Q_OBJECT

public:
CommandLineWidget(de::String const &name = "");
CommandLineWidget(String const &name = "");
virtual ~CommandLineWidget();

bool handleEvent(de::Event const *event);
bool handleEvent(Event const *event);

signals:
void commandEntered(de::String command);
Expand All @@ -42,4 +45,7 @@ class CommandLineWidget : public de::shell::LineEditWidget
Instance *d;
};

#endif // COMMANDLINEWIDGET_H
} // namespace shell
} // namespace de

#endif // LIBSHELL_COMMANDLINEWIDGET_H
Expand Up @@ -22,22 +22,25 @@
#include <de/shell/TextWidget>
#include <de/LogSink>

class LogWidget : public de::shell::TextWidget
namespace de {
namespace shell {

class LogWidget : public TextWidget
{
Q_OBJECT

public:
LogWidget(de::String const &name = "");
LogWidget(String const &name = "");
virtual ~LogWidget();

/**
* Returns the log sink that can be connected to a log buffer for receiving
* log entries into the widget's buffer.
*/
de::LogSink &logSink();
LogSink &logSink();

void draw();
bool handleEvent(de::Event const *event);
bool handleEvent(Event const *event);

public slots:
/**
Expand All @@ -50,4 +53,7 @@ public slots:
Instance *d;
};

} // namespace shell
} // namespace de

#endif // LOGWIDGET_H
18 changes: 12 additions & 6 deletions doomsday/libshell/libshell.pro
Expand Up @@ -26,6 +26,7 @@ INCLUDEPATH += include
HEADERS += \
include/de/shell/Action \
include/de/shell/ChoiceWidget \
include/de/shell/CommandLineWidget \
include/de/shell/DialogWidget \
include/de/shell/InputDialog \
include/de/shell/KeyEvent \
Expand All @@ -34,6 +35,7 @@ HEADERS += \
include/de/shell/LineEditWidget \
include/de/shell/Link \
include/de/shell/LocalServer \
include/de/shell/LogWidget \
include/de/shell/MenuWidget \
include/de/shell/Protocol \
include/de/shell/ServerFinder \
Expand All @@ -43,6 +45,7 @@ HEADERS += \
\
include/de/shell/action.h \
include/de/shell/choicewidget.h \
include/de/shell/commandlinewidget.h \
include/de/shell/dialogwidget.h \
include/de/shell/inputdialog.h \
include/de/shell/keyevent.h \
Expand All @@ -52,31 +55,34 @@ HEADERS += \
include/de/shell/lineeditwidget.h \
include/de/shell/link.h \
include/de/shell/localserver.h \
include/de/shell/logwidget.h \
include/de/shell/menuwidget.h \
include/de/shell/protocol.h \
include/de/shell/serverfinder.h \
include/de/shell/textcanvas.h \
include/de/shell/textrootwidget.h \
include/de/shell/textwidget.h
include/de/shell/textwidget.h

# Sources and private headers.
SOURCES += \
src/action.cpp \
src/choicewidget.cpp \
src/commandlinewidget.cpp \
src/dialogwidget.cpp \
src/inputdialog.cpp \
src/labelwidget.cpp \
src/lexicon.cpp \
src/libshell.cpp \
src/lineeditwidget.cpp \
src/link.cpp \
src/localserver.cpp \
src/logwidget.cpp \
src/menuwidget.cpp \
src/protocol.cpp \
src/serverfinder.cpp \
src/textcanvas.cpp \
src/textrootwidget.cpp \
src/textwidget.cpp \
src/choicewidget.cpp \
src/localserver.cpp \
src/serverfinder.cpp \
src/lexicon.cpp
src/textwidget.cpp

# Installation ---------------------------------------------------------------

Expand Down
Expand Up @@ -16,13 +16,13 @@
* http://www.gnu.org/licenses</small>
*/

#include "commandlinewidget.h"
#include "de/shell/CommandLineWidget"
#include "de/shell/TextRootWidget"
#include "de/shell/KeyEvent"
#include <de/String>
#include <de/shell/TextRootWidget>
#include <de/shell/KeyEvent>

using namespace de;
using namespace de::shell;
namespace de {
namespace shell {

struct CommandLineWidget::Instance
{
Expand Down Expand Up @@ -185,3 +185,6 @@ bool CommandLineWidget::handleEvent(Event const *event)
return LineEditWidget::handleEvent(event);
}
}

} // namespace shell
} // namespace de
Expand Up @@ -16,16 +16,16 @@
* http://www.gnu.org/licenses</small>
*/

#include "logwidget.h"
#include "de/shell/LogWidget"
#include "de/shell/KeyEvent"
#include "de/shell/TextRootWidget"
#include <de/MonospaceLogSinkFormatter>
#include <de/Lockable>
#include <de/LogBuffer>
#include <de/shell/KeyEvent>
#include <de/shell/TextRootWidget>
#include <QList>

using namespace de;
using namespace de::shell;
namespace de {
namespace shell {

/**
* Log sink for incoming entries (local and remote). Rather than formatting the
Expand Down Expand Up @@ -269,3 +269,6 @@ void LogWidget::scrollToBottom()
d->visibleOffset = 0;
redraw();
}

} // namespace shell
} // namespace de
4 changes: 0 additions & 4 deletions doomsday/tools/shell/shell-text/shell-text.pro
Expand Up @@ -25,11 +25,9 @@ include(../../../dep_curses.pri)

HEADERS += \
src/aboutdialog.h \
src/commandlinewidget.h \
src/cursesapp.h \
src/cursestextcanvas.h \
src/localserverdialog.h \
src/logwidget.h \
src/main.h \
src/openconnectiondialog.h \
src/persistentdata.h \
Expand All @@ -38,11 +36,9 @@ HEADERS += \

SOURCES += \
src/aboutdialog.cpp \
src/commandlinewidget.cpp \
src/cursesapp.cpp \
src/cursestextcanvas.cpp \
src/localserverdialog.cpp \
src/logwidget.cpp \
src/main.cpp \
src/openconnectiondialog.cpp \
src/persistentdata.cpp \
Expand Down
4 changes: 2 additions & 2 deletions doomsday/tools/shell/shell-text/src/shellapp.cpp
Expand Up @@ -17,15 +17,15 @@
*/

#include "shellapp.h"
#include "logwidget.h"
#include "commandlinewidget.h"
#include "statuswidget.h"
#include "openconnectiondialog.h"
#include "localserverdialog.h"
#include "aboutdialog.h"
#include "persistentdata.h"
#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 Down

0 comments on commit 744480f

Please sign in to comment.