Update JSConsole to QWidget

This commit is contained in:
Ryan Huffman 2014-05-27 08:03:46 -07:00
parent 422c2eac67
commit b9248e0bbf
5 changed files with 33 additions and 15 deletions

View file

@ -72,6 +72,11 @@ const int ONE_SECOND_OF_FRAMES = 60;
const int FIVE_SECONDS_OF_FRAMES = 5 * ONE_SECOND_OF_FRAMES;
const float MUTE_RADIUS = 50;
const QString CONSOLE_TITLE = "Scripting Console";
const float CONSOLE_WINDOW_OPACITY = 0.95;
const int CONSOLE_WIDTH = 800;
const int CONSOLE_HEIGHT = 200;
Menu::Menu() :
_actionHash(),
_audioJitterBufferSamples(0),
@ -1233,7 +1238,18 @@ void Menu::toggleChat() {
void Menu::toggleConsole() {
QMainWindow* mainWindow = Application::getInstance()->getWindow();
if (!_jsConsole) {
_jsConsole = new JSConsole(mainWindow);
QDialog* dialog = new QDialog(mainWindow, Qt::WindowStaysOnTopHint);
QVBoxLayout* layout = new QVBoxLayout(dialog);
dialog->setLayout(new QVBoxLayout(dialog));
dialog->resize(QSize(CONSOLE_WIDTH, CONSOLE_HEIGHT));
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(new JSConsole(dialog));
dialog->setWindowOpacity(CONSOLE_WINDOW_OPACITY);
dialog->setWindowTitle(CONSOLE_TITLE);
_jsConsole = dialog;
}
_jsConsole->setVisible(!_jsConsole->isVisible());
}

View file

@ -245,7 +245,7 @@ private:
QPointer<MetavoxelEditor> _MetavoxelEditor;
QPointer<ScriptEditorWindow> _ScriptEditor;
QPointer<ChatWindow> _chatWindow;
JSConsole* _jsConsole;
QDialog* _jsConsole;
OctreeStatsDialog* _octreeStatsDialog;
LodToolsDialog* _lodToolsDialog;
int _maxVoxels;

View file

@ -32,7 +32,7 @@ const QString GUTTER_ERROR = "<pre style=\"color: red;\">X</pre>";
const QString GUTTER_PREVIOUS_COMMAND = "<pre style=\"color: lightblue;\">&lt;</pre>";
JSConsole::JSConsole(QWidget* parent, ScriptEngine* scriptEngine) :
QDialog(parent, Qt::WindowStaysOnTopHint),
QWidget(parent),
_ui(new Ui::Console),
_currentCommandInHistory(NO_CURRENT_HISTORY_COMMAND),
_commandHistory(),

View file

@ -20,7 +20,7 @@
#include "ui_console.h"
#include "ScriptEngine.h"
class JSConsole : public QDialog {
class JSConsole : public QWidget {
Q_OBJECT
public:
JSConsole(QWidget* parent, ScriptEngine* scriptEngine = NULL);

View file

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Console</class>
<widget class="QDialog" name="Console">
<widget class="QWidget" name="Console">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1018</width>
<height>263</height>
<width>1055</width>
<height>205</height>
</rect>
</property>
<property name="windowTitle">
@ -75,8 +75,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1003</width>
<height>263</height>
<width>1040</width>
<height>205</height>
</rect>
</property>
<property name="styleSheet">
@ -203,14 +203,14 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: white; font-weight: bold; color: blue;</string>
<string notr="true">background-color: white; font-weight: bold; color: rgb(169, 187, 195);</string>
</property>
<property name="text">
<string>&gt;</string>
</property>
</widget>
</item>
<item alignment="Qt::AlignTop">
<item>
<widget class="QTextEdit" name="promptTextEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -220,9 +220,14 @@
</property>
<property name="font">
<font>
<family>Courier New</family>
<family>Inconsolata,Lucida Console,Andale Mono,Monaco</family>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"> font-family: Inconsolata, Lucida Console, Andale Mono, Monaco;
font-size:14px</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@ -232,9 +237,6 @@
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::TextEditorInteraction</set>
</property>
</widget>
</item>
</layout>