Commit 5eb487ee authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Made the statusbar change size when a text edit is opened/closed.

parent 03389a5d
...@@ -80,6 +80,7 @@ void WAttQt::change_value(int set_focus) ...@@ -80,6 +80,7 @@ void WAttQt::change_value(int set_focus)
int input_size; int input_size;
if (input_open) { if (input_open) {
statusbar->setMaximumHeight(25);
cmd_entry->setVisible(false); cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
...@@ -99,6 +100,7 @@ void WAttQt::change_value(int set_focus) ...@@ -99,6 +100,7 @@ void WAttQt::change_value(int set_focus)
} }
if (multiline) { if (multiline) {
statusbar->setMaximumHeight(QWIDGETSIZE_MAX);
cmd_scrolledinput->setVisible(true); cmd_scrolledinput->setVisible(true);
set_pane_position(pane, -170); set_pane_position(pane, -170);
...@@ -116,7 +118,7 @@ void WAttQt::change_value(int set_focus) ...@@ -116,7 +118,7 @@ void WAttQt::change_value(int set_focus)
if (value) { if (value) {
if (multiline) { if (multiline) {
cmd_scrolled_buffer->setText(QString::fromLatin1(value)); cmd_scrolled_buffer->setPlainText(QString::fromLatin1(value));
} else { } else {
cmd_entry->setText(QString::fromLatin1(value)); cmd_entry->setText(QString::fromLatin1(value));
...@@ -138,7 +140,7 @@ void WAttQtWidget::action_text_inserted() ...@@ -138,7 +140,7 @@ void WAttQtWidget::action_text_inserted()
// Remove inserted chars // Remove inserted chars
QString txt = watt->cmd_scrolled_buffer->toPlainText(); QString txt = watt->cmd_scrolled_buffer->toPlainText();
txt.truncate(watt->input_max_length); txt.truncate(watt->input_max_length);
watt->cmd_scrolled_buffer->setText(txt); watt->cmd_scrolled_buffer->setPlainText(txt);
CoWowQt wow(this); CoWowQt wow(this);
wow.DisplayError("Error message", "Attribute size exceeded"); wow.DisplayError("Error message", "Attribute size exceeded");
...@@ -220,6 +222,7 @@ void WAttQt::change_value_close() ...@@ -220,6 +222,7 @@ void WAttQt::change_value_close()
wattnav->set_attr_value(input_node, input_name, text); wattnav->set_attr_value(input_node, input_name, text);
} }
statusbar->setMaximumHeight(25);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
input_open = 0; input_open = 0;
...@@ -303,6 +306,7 @@ void WAttQtWidget::activate_cmd_scrolled_ok() ...@@ -303,6 +306,7 @@ void WAttQtWidget::activate_cmd_scrolled_ok()
watt->wattnav->set_attr_value(watt->input_node, watt->input_name, text); watt->wattnav->set_attr_value(watt->input_node, watt->input_name, text);
} }
watt->statusbar->setMaximumHeight(25);
watt->cmd_scrolledinput->setVisible(false); watt->cmd_scrolledinput->setVisible(false);
watt->set_prompt(""); watt->set_prompt("");
watt->input_open = 0; watt->input_open = 0;
...@@ -325,6 +329,7 @@ void WAttQtWidget::activate_cmd_scrolled_ok() ...@@ -325,6 +329,7 @@ void WAttQtWidget::activate_cmd_scrolled_ok()
void WAttQtWidget::activate_cmd_scrolled_ca() void WAttQtWidget::activate_cmd_scrolled_ca()
{ {
if (watt->input_open) { if (watt->input_open) {
watt->statusbar->setMaximumHeight(25);
watt->cmd_scrolledinput->setVisible(false); watt->cmd_scrolledinput->setVisible(false);
set_pane_position(watt->pane, -50); set_pane_position(watt->pane, -50);
...@@ -426,7 +431,7 @@ WAttQt::WAttQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses, ...@@ -426,7 +431,7 @@ WAttQt::WAttQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses,
wattnav->message_cb = &WAtt::message_cb; wattnav->message_cb = &WAtt::message_cb;
wattnav->change_value_cb = &WAtt::change_value_cb; wattnav->change_value_cb = &WAtt::change_value_cb;
QStatusBar* statusbar = new QStatusBar(); statusbar = new QStatusBar();
msg_label = new QLabel(""); msg_label = new QLabel("");
cmd_prompt = new QLabel("value > "); cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall); cmd_entry = new CoWowEntryQt(&value_recall);
...@@ -451,7 +456,7 @@ WAttQt::WAttQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses, ...@@ -451,7 +456,7 @@ WAttQt::WAttQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses,
toplevel->setLayout(vbox); toplevel->setLayout(vbox);
cmd_scrolled_buffer = new QTextEdit(); cmd_scrolled_buffer = new QPlainTextEdit();
QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel, QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel,
SLOT(action_text_inserted())); SLOT(action_text_inserted()));
......
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
#include "wb_watt.h" #include "wb_watt.h"
#include <QLabel> #include <QLabel>
#include <QPlainTextEdit>
#include <QSplitter> #include <QSplitter>
#include <QTextEdit> #include <QStatusBar>
class WAttQtWidget; class WAttQtWidget;
...@@ -59,12 +60,13 @@ public: ...@@ -59,12 +60,13 @@ public:
QLabel* msg_label; QLabel* msg_label;
QLabel* cmd_prompt; QLabel* cmd_prompt;
QWidget* cmd_scrolledinput; QWidget* cmd_scrolledinput;
QTextEdit* cmd_scrolled_buffer; QPlainTextEdit* cmd_scrolled_buffer;
QSplitter* pane; QSplitter* pane;
static CoWowRecall value_recall; static CoWowRecall value_recall;
CoWowEntryQt* cmd_entry; CoWowEntryQt* cmd_entry;
CoWowFocusTimerQt focustimer; CoWowFocusTimerQt focustimer;
int input_max_length; int input_max_length;
QStatusBar* statusbar;
void message(char severity, const char* message); void message(char severity, const char* message);
void set_prompt(const char* prompt); void set_prompt(const char* prompt);
......
...@@ -66,7 +66,7 @@ void WAttTextQtWidget::action_text_inserted() ...@@ -66,7 +66,7 @@ void WAttTextQtWidget::action_text_inserted()
// Remove inserted chars // Remove inserted chars
QString txt = atxt->textbuffer->toPlainText(); QString txt = atxt->textbuffer->toPlainText();
txt.truncate(atxt->input_max_length); txt.truncate(atxt->input_max_length);
atxt->textbuffer->setText(txt); atxt->textbuffer->setPlainText(txt);
CoWowQt wow(this); CoWowQt wow(this);
wow.DisplayError("Error message", "Attribute size exceeded"); wow.DisplayError("Error message", "Attribute size exceeded");
...@@ -87,12 +87,12 @@ void WAttTextQtWidget::activate_copy() ...@@ -87,12 +87,12 @@ void WAttTextQtWidget::activate_copy()
void WAttTextQtWidget::activate_cut() void WAttTextQtWidget::activate_cut()
{ {
QApplication::clipboard()->setText(atxt->textbuffer->toPlainText()); QApplication::clipboard()->setText(atxt->textbuffer->toPlainText());
atxt->textbuffer->setText(""); atxt->textbuffer->setPlainText("");
} }
void WAttTextQtWidget::activate_paste() void WAttTextQtWidget::activate_paste()
{ {
atxt->textbuffer->setText(QApplication::clipboard()->text()); atxt->textbuffer->setPlainText(QApplication::clipboard()->text());
} }
void WAttTextQtWidget::activate_ok() void WAttTextQtWidget::activate_ok()
...@@ -234,7 +234,7 @@ WAttTextQt::WAttTextQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses, ...@@ -234,7 +234,7 @@ WAttTextQt::WAttTextQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses,
} }
utility = ((WUtility*)parent_ctx)->utype; utility = ((WUtility*)parent_ctx)->utype;
textbuffer = new QTextEdit(); textbuffer = new QPlainTextEdit();
QObject::connect(textbuffer, SIGNAL(textChanged()), toplevel, QObject::connect(textbuffer, SIGNAL(textChanged()), toplevel,
SLOT(action_text_inserted())); SLOT(action_text_inserted()));
...@@ -290,7 +290,7 @@ WAttTextQt::WAttTextQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses, ...@@ -290,7 +290,7 @@ WAttTextQt::WAttTextQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses,
input_max_length = ainfo.size - 1; input_max_length = ainfo.size - 1;
textbuffer->setText(QString::fromLatin1(value)); textbuffer->setPlainText(QString::fromLatin1(value));
textbuffer->setReadOnly(!editmode); textbuffer->setReadOnly(!editmode);
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "wb_watttext.h" #include "wb_watttext.h"
#include <QLabel> #include <QLabel>
#include <QTextEdit> #include <QPlainTextEdit>
class WAttTextQtWidget; class WAttTextQtWidget;
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
pwr_sAttrRef wa_aref, int wa_editmode, pwr_tStatus* status); pwr_sAttrRef wa_aref, int wa_editmode, pwr_tStatus* status);
~WAttTextQt(); ~WAttTextQt();
QLabel* msg_label; QLabel* msg_label;
QTextEdit* textbuffer; QPlainTextEdit* textbuffer;
int input_max_length; int input_max_length;
int init; int init;
......
...@@ -86,6 +86,7 @@ void WdaQt::change_value(int set_focus) ...@@ -86,6 +86,7 @@ void WdaQt::change_value(int set_focus)
int input_size; int input_size;
if (input_open) { if (input_open) {
statusbar->setMaximumHeight(25);
cmd_entry->setVisible(false); cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
...@@ -105,6 +106,7 @@ void WdaQt::change_value(int set_focus) ...@@ -105,6 +106,7 @@ void WdaQt::change_value(int set_focus)
} }
if (multiline) { if (multiline) {
statusbar->setMaximumHeight(QWIDGETSIZE_MAX);
cmd_scrolledinput->setVisible(true); cmd_scrolledinput->setVisible(true);
set_pane_position(pane, -170); set_pane_position(pane, -170);
...@@ -121,7 +123,7 @@ void WdaQt::change_value(int set_focus) ...@@ -121,7 +123,7 @@ void WdaQt::change_value(int set_focus)
if (value) { if (value) {
if (multiline) { if (multiline) {
cmd_scrolled_buffer->setText(QString::fromLatin1(value)); cmd_scrolled_buffer->setPlainText(QString::fromLatin1(value));
} else { } else {
cmd_entry->setText(QString::fromLatin1(value)); cmd_entry->setText(QString::fromLatin1(value));
...@@ -267,6 +269,7 @@ void WdaQt::change_value_close() ...@@ -267,6 +269,7 @@ void WdaQt::change_value_close()
} }
wdanav->set_attr_value(input_node, input_name, text); wdanav->set_attr_value(input_node, input_name, text);
statusbar->setMaximumHeight(25);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
input_open = 0; input_open = 0;
...@@ -342,6 +345,7 @@ void WdaQtWidget::activate_cmd_scrolled_ok() ...@@ -342,6 +345,7 @@ void WdaQtWidget::activate_cmd_scrolled_ok()
wda->wdanav->set_attr_value(wda->input_node, wda->input_name, text); wda->wdanav->set_attr_value(wda->input_node, wda->input_name, text);
} }
wda->statusbar->setMaximumHeight(25);
wda->cmd_scrolledinput->setVisible(false); wda->cmd_scrolledinput->setVisible(false);
wda->set_prompt(""); wda->set_prompt("");
wda->input_open = 0; wda->input_open = 0;
...@@ -359,6 +363,7 @@ void WdaQtWidget::activate_cmd_scrolled_ok() ...@@ -359,6 +363,7 @@ void WdaQtWidget::activate_cmd_scrolled_ok()
void WdaQtWidget::activate_cmd_scrolled_ca() void WdaQtWidget::activate_cmd_scrolled_ca()
{ {
if (wda->input_open) { if (wda->input_open) {
wda->statusbar->setMaximumHeight(25);
wda->cmd_scrolledinput->setVisible(false); wda->cmd_scrolledinput->setVisible(false);
set_pane_position(wda->pane, -50); set_pane_position(wda->pane, -50);
...@@ -525,7 +530,7 @@ WdaQt::WdaQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses, ...@@ -525,7 +530,7 @@ WdaQt::WdaQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses,
wdanav->message_cb = &Wda::message_cb; wdanav->message_cb = &Wda::message_cb;
wdanav->change_value_cb = &Wda::change_value_cb; wdanav->change_value_cb = &Wda::change_value_cb;
QStatusBar* statusbar = new QStatusBar(); statusbar = new QStatusBar();
msg_label = new QLabel(""); msg_label = new QLabel("");
cmd_prompt = new QLabel("value > "); cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall); cmd_entry = new CoWowEntryQt(&value_recall);
...@@ -547,7 +552,7 @@ WdaQt::WdaQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses, ...@@ -547,7 +552,7 @@ WdaQt::WdaQt(void* wa_parent_ctx, ldh_tSesContext wa_ldhses,
toplevel->setLayout(vbox); toplevel->setLayout(vbox);
cmd_scrolled_buffer = new QTextEdit(); cmd_scrolled_buffer = new QPlainTextEdit();
QDialogButtonBox* buttons = new QDialogButtonBox(); QDialogButtonBox* buttons = new QDialogButtonBox();
buttons->addButton(QDialogButtonBox::Ok); buttons->addButton(QDialogButtonBox::Ok);
......
...@@ -45,8 +45,9 @@ ...@@ -45,8 +45,9 @@
#include <QCheckBox> #include <QCheckBox>
#include <QLabel> #include <QLabel>
#include <QPlainTextEdit>
#include <QSplitter> #include <QSplitter>
#include <QTextEdit> #include <QStatusBar>
class WdaQtWidget; class WdaQtWidget;
...@@ -61,11 +62,12 @@ public: ...@@ -61,11 +62,12 @@ public:
QLabel* msg_label; QLabel* msg_label;
QLabel* cmd_prompt; QLabel* cmd_prompt;
QWidget* cmd_scrolledinput; QWidget* cmd_scrolledinput;
QTextEdit* cmd_scrolled_buffer; QPlainTextEdit* cmd_scrolled_buffer;
QSplitter* pane; QSplitter* pane;
static CoWowRecall value_recall; static CoWowRecall value_recall;
CoWowEntryQt* cmd_entry; CoWowEntryQt* cmd_entry;
CoWowFocusTimerQt focustimer; CoWowFocusTimerQt focustimer;
QStatusBar* statusbar;
void message(char severity, const char* message); void message(char severity, const char* message);
void set_prompt(const char* prompt); void set_prompt(const char* prompt);
......
...@@ -117,6 +117,7 @@ void AttrQt::change_value() ...@@ -117,6 +117,7 @@ void AttrQt::change_value()
} }
if (input_open) { if (input_open) {
statusbar->setMaximumHeight(25);
cmd_entry->setVisible(false); cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
...@@ -125,6 +126,7 @@ void AttrQt::change_value() ...@@ -125,6 +126,7 @@ void AttrQt::change_value()
} }
if (multiline) { if (multiline) {
statusbar->setMaximumHeight(QWIDGETSIZE_MAX);
cmd_scrolledinput->setVisible(true); cmd_scrolledinput->setVisible(true);
set_pane_position(pane, -170); set_pane_position(pane, -170);
...@@ -139,7 +141,7 @@ void AttrQt::change_value() ...@@ -139,7 +141,7 @@ void AttrQt::change_value()
if (value) { if (value) {
if (multiline) { if (multiline) {
cmd_scrolled_buffer->setText(fl(value)); cmd_scrolled_buffer->setPlainText(fl(value));
} else { } else {
cmd_entry->setText(fl(value)); cmd_entry->setText(fl(value));
...@@ -238,6 +240,7 @@ void AttrQtWidget::attr_activate_cmd_scrolled_ok() ...@@ -238,6 +240,7 @@ void AttrQtWidget::attr_activate_cmd_scrolled_ok()
if (attr->input_open) { if (attr->input_open) {
attr->attrnav->set_attr_value( attr->attrnav->set_attr_value(
qPrintableLatin1(attr->cmd_scrolled_buffer->toPlainText()), 0, 0); qPrintableLatin1(attr->cmd_scrolled_buffer->toPlainText()), 0, 0);
attr->statusbar->setMaximumHeight(25);
attr->cmd_scrolledinput->setVisible(false); attr->cmd_scrolledinput->setVisible(false);
attr->set_prompt(""); attr->set_prompt("");
attr->input_open = 0; attr->input_open = 0;
...@@ -256,6 +259,7 @@ void AttrQtWidget::attr_activate_cmd_scrolled_ok() ...@@ -256,6 +259,7 @@ void AttrQtWidget::attr_activate_cmd_scrolled_ok()
void AttrQtWidget::attr_activate_cmd_scrolled_ca() void AttrQtWidget::attr_activate_cmd_scrolled_ca()
{ {
if (attr->input_open) { if (attr->input_open) {
attr->statusbar->setMaximumHeight(25);
attr->cmd_scrolledinput->setVisible(false); attr->cmd_scrolledinput->setVisible(false);
set_pane_position(attr->pane, -50); set_pane_position(attr->pane, -50);
...@@ -299,7 +303,7 @@ void AttrQtWidget::action_text_inserted() ...@@ -299,7 +303,7 @@ void AttrQtWidget::action_text_inserted()
// inserted text) // inserted text)
QString txt = attr->cmd_scrolled_buffer->toPlainText(); QString txt = attr->cmd_scrolled_buffer->toPlainText();
txt.truncate(attr->input_max_length); txt.truncate(attr->input_max_length);
attr->cmd_scrolled_buffer->setText(txt); attr->cmd_scrolled_buffer->setPlainText(txt);
CoWowQt wow(this); CoWowQt wow(this);
wow.DisplayError("Error message", "Attribute size exceeded"); wow.DisplayError("Error message", "Attribute size exceeded");
...@@ -359,7 +363,7 @@ AttrQt::AttrQt(QWidget* a_parent_wid, void* a_parent_ctx, attr_eType a_type, ...@@ -359,7 +363,7 @@ AttrQt::AttrQt(QWidget* a_parent_wid, void* a_parent_ctx, attr_eType a_type,
attrnav->get_current_color_tone_cb = &Attr::get_current_color_tone_c; attrnav->get_current_color_tone_cb = &Attr::get_current_color_tone_c;
attrnav->get_object_list_cb = &Attr::get_object_list_c; attrnav->get_object_list_cb = &Attr::get_object_list_c;
QStatusBar* statusbar = new QStatusBar(); statusbar = new QStatusBar();
msg_label = new QLabel(""); msg_label = new QLabel("");
cmd_prompt = new QLabel("value > "); cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall); cmd_entry = new CoWowEntryQt(&value_recall);
...@@ -376,7 +380,7 @@ AttrQt::AttrQt(QWidget* a_parent_wid, void* a_parent_ctx, attr_eType a_type, ...@@ -376,7 +380,7 @@ AttrQt::AttrQt(QWidget* a_parent_wid, void* a_parent_ctx, attr_eType a_type,
add_expanding(pane, brow_widget); add_expanding(pane, brow_widget);
cmd_scrolled_buffer = new QTextEdit(); cmd_scrolled_buffer = new QPlainTextEdit();
QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel, QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel,
SLOT(action_text_inserted())); SLOT(action_text_inserted()));
......
...@@ -42,8 +42,9 @@ ...@@ -42,8 +42,9 @@
#include "ge_attr.h" #include "ge_attr.h"
#include <QLabel> #include <QLabel>
#include <QPlainTextEdit>
#include <QSplitter> #include <QSplitter>
#include <QTextEdit> #include <QStatusBar>
/* ge_attr.h -- Ge attribute editor */ /* ge_attr.h -- Ge attribute editor */
...@@ -65,11 +66,12 @@ public: ...@@ -65,11 +66,12 @@ public:
QLabel* msg_label; QLabel* msg_label;
QLabel* cmd_prompt; QLabel* cmd_prompt;
QWidget* cmd_scrolledinput; QWidget* cmd_scrolledinput;
QTextEdit* cmd_scrolled_buffer; QPlainTextEdit* cmd_scrolled_buffer;
QSplitter* pane; QSplitter* pane;
static CoWowRecall value_recall; static CoWowRecall value_recall;
CoWowEntryQt* cmd_entry; CoWowEntryQt* cmd_entry;
int input_max_length; int input_max_length;
QStatusBar* statusbar;
void message(char severity, const char* message); void message(char severity, const char* message);
void message_popup(char severity, const char* message); void message_popup(char severity, const char* message);
......
...@@ -84,6 +84,7 @@ void XAttQt::change_value(int set_focus) ...@@ -84,6 +84,7 @@ void XAttQt::change_value(int set_focus)
int input_size; int input_size;
if (input_open) { if (input_open) {
statusbar->setMaximumHeight(25);
cmd_entry->setVisible(false); cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
...@@ -103,6 +104,7 @@ void XAttQt::change_value(int set_focus) ...@@ -103,6 +104,7 @@ void XAttQt::change_value(int set_focus)
} }
if (multiline) { if (multiline) {
statusbar->setMaximumHeight(QWIDGETSIZE_MAX);
cmd_scrolledinput->setVisible(true); cmd_scrolledinput->setVisible(true);
set_pane_position(pane, -170); set_pane_position(pane, -170);
...@@ -124,7 +126,7 @@ void XAttQt::change_value(int set_focus) ...@@ -124,7 +126,7 @@ void XAttQt::change_value(int set_focus)
if (value) { if (value) {
if (multiline) { if (multiline) {
cmd_scrolled_buffer->setText(fl(value)); cmd_scrolled_buffer->setPlainText(fl(value));
} else { } else {
cmd_entry->setText(fl(value)); cmd_entry->setText(fl(value));
...@@ -149,7 +151,7 @@ void XAttQtWidget::action_text_inserted() ...@@ -149,7 +151,7 @@ void XAttQtWidget::action_text_inserted()
// inserted text) // inserted text)
QString txt = xatt->cmd_scrolled_buffer->toPlainText(); QString txt = xatt->cmd_scrolled_buffer->toPlainText();
txt.truncate(xatt->input_max_length); txt.truncate(xatt->input_max_length);
xatt->cmd_scrolled_buffer->setText(txt); xatt->cmd_scrolled_buffer->setPlainText(txt);
CoWowQt wow(this); CoWowQt wow(this);
wow.DisplayError("Error message", "Attribute size exceeded"); wow.DisplayError("Error message", "Attribute size exceeded");
...@@ -223,6 +225,7 @@ void XAttQt::change_value_close() ...@@ -223,6 +225,7 @@ void XAttQt::change_value_close()
xattnav->set_attr_value(input_node, input_name, text); xattnav->set_attr_value(input_node, input_name, text);
} }
statusbar->setMaximumHeight(25);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
input_open = 0; input_open = 0;
...@@ -291,6 +294,7 @@ void XAttQtWidget::activate_cmd_scrolled_ok() ...@@ -291,6 +294,7 @@ void XAttQtWidget::activate_cmd_scrolled_ok()
xatt->message('E', "Input error, invalid character"); xatt->message('E', "Input error, invalid character");
} }
xatt->statusbar->setMaximumHeight(25);
xatt->cmd_scrolledinput->setVisible(false); xatt->cmd_scrolledinput->setVisible(false);
xatt->set_prompt(""); xatt->set_prompt("");
xatt->input_open = 0; xatt->input_open = 0;
...@@ -305,6 +309,7 @@ void XAttQtWidget::activate_cmd_scrolled_ok() ...@@ -305,6 +309,7 @@ void XAttQtWidget::activate_cmd_scrolled_ok()
void XAttQtWidget::activate_cmd_scrolled_ca() void XAttQtWidget::activate_cmd_scrolled_ca()
{ {
if (xatt->input_open) { if (xatt->input_open) {
xatt->statusbar->setMaximumHeight(25);
xatt->cmd_scrolledinput->setVisible(false); xatt->cmd_scrolledinput->setVisible(false);
set_pane_position(xatt->pane, -50); set_pane_position(xatt->pane, -50);
...@@ -406,7 +411,7 @@ XAttQt::XAttQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar, ...@@ -406,7 +411,7 @@ XAttQt::XAttQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar,
xattnav->is_authorized_cb = &xatt_is_authorized_cb; xattnav->is_authorized_cb = &xatt_is_authorized_cb;
xattnav->init_cb = &init_cb; xattnav->init_cb = &init_cb;
QStatusBar* statusbar = new QStatusBar(); statusbar = new QStatusBar();
msg_label = new QLabel(""); msg_label = new QLabel("");
cmd_prompt = new QLabel("value > "); cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall); cmd_entry = new CoWowEntryQt(&value_recall);
...@@ -428,7 +433,7 @@ XAttQt::XAttQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar, ...@@ -428,7 +433,7 @@ XAttQt::XAttQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar,
toplevel->setLayout(vbox); toplevel->setLayout(vbox);
cmd_scrolled_buffer = new QTextEdit(); cmd_scrolled_buffer = new QPlainTextEdit();
QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel, QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel,
SLOT(action_text_inserted())); SLOT(action_text_inserted()));
......
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
#include "xtt_xatt.h" #include "xtt_xatt.h"
#include <QLabel> #include <QLabel>
#include <QPlainTextEdit>
#include <QSplitter> #include <QSplitter>
#include <QTextEdit> #include <QStatusBar>
class XAttQtWidget; class XAttQtWidget;
...@@ -59,12 +60,13 @@ public: ...@@ -59,12 +60,13 @@ public:
QLabel* msg_label; QLabel* msg_label;
QLabel* cmd_prompt; QLabel* cmd_prompt;
QWidget* cmd_scrolledinput; QWidget* cmd_scrolledinput;
QTextEdit* cmd_scrolled_buffer; QPlainTextEdit* cmd_scrolled_buffer;
QSplitter* pane; QSplitter* pane;
static CoWowRecall value_recall; static CoWowRecall value_recall;
CoWowEntryQt* cmd_entry; CoWowEntryQt* cmd_entry;
CoWowFocusTimerQt focustimer; CoWowFocusTimerQt focustimer;
int input_max_length; int input_max_length;
QStatusBar* statusbar;
void message(char severity, const char* message); void message(char severity, const char* message);
void set_prompt(const char* prompt); void set_prompt(const char* prompt);
......
...@@ -145,6 +145,7 @@ int XAttOneQt::change_value(int set_focus) ...@@ -145,6 +145,7 @@ int XAttOneQt::change_value(int set_focus)
cmd_label->setText(fl(buf)); cmd_label->setText(fl(buf));
} else { } else {
if (atype == pwr_eType_Text) { if (atype == pwr_eType_Text) {
statusbar->setMaximumHeight(QWIDGETSIZE_MAX);
cmd_entry->setVisible(false); cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(true); cmd_scrolledinput->setVisible(true);
...@@ -155,11 +156,12 @@ int XAttOneQt::change_value(int set_focus) ...@@ -155,11 +156,12 @@ int XAttOneQt::change_value(int set_focus)
input_multiline = 1; input_multiline = 1;
if (value) { if (value) {
cmd_scrolled_buffer->setText(fl(value)); cmd_scrolled_buffer->setPlainText(fl(value));
} else { } else {
cmd_scrolled_buffer->setText(""); cmd_scrolled_buffer->setPlainText("");
} }
} else { } else {
statusbar->setMaximumHeight(25);
cmd_entry->setVisible(true); cmd_entry->setVisible(true);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
if (set_focus) { if (set_focus) {
...@@ -288,7 +290,7 @@ XAttOneQt::XAttOneQt(void* xa_parent_ctx, pwr_sAttrRef* xa_aref, char* xa_title, ...@@ -288,7 +290,7 @@ XAttOneQt::XAttOneQt(void* xa_parent_ctx, pwr_sAttrRef* xa_aref, char* xa_title,
SLOT(activate_cmd_entry())); SLOT(activate_cmd_entry()));
// Scrolled text input // Scrolled text input
cmd_scrolled_buffer = new QTextEdit(); cmd_scrolled_buffer = new QPlainTextEdit();
// Buttons // Buttons
QDialogButtonBox* buttons = new QDialogButtonBox(); QDialogButtonBox* buttons = new QDialogButtonBox();
...@@ -303,7 +305,7 @@ XAttOneQt::XAttOneQt(void* xa_parent_ctx, pwr_sAttrRef* xa_aref, char* xa_title, ...@@ -303,7 +305,7 @@ XAttOneQt::XAttOneQt(void* xa_parent_ctx, pwr_sAttrRef* xa_aref, char* xa_title,
toplevel, SLOT(close())); toplevel, SLOT(close()));
// Horizontal box // Horizontal box
QStatusBar* statusbar = new QStatusBar(); statusbar = new QStatusBar();
statusbar->addWidget(msg_label); statusbar->addWidget(msg_label);
statusbar->addWidget(cmd_prompt); statusbar->addWidget(cmd_prompt);
add_expanding(statusbar, cmd_label); add_expanding(statusbar, cmd_label);
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
#include "xtt_xattone.h" #include "xtt_xattone.h"
#include <QLabel> #include <QLabel>
#include <QTextEdit> #include <QPlainTextEdit>
#include <QStatusBar>
class XAttOneQtWidget; class XAttOneQtWidget;
...@@ -59,9 +60,10 @@ public: ...@@ -59,9 +60,10 @@ public:
QLabel* cmd_prompt; QLabel* cmd_prompt;
QLabel* cmd_label; QLabel* cmd_label;
QWidget* cmd_scrolledinput; QWidget* cmd_scrolledinput;
QTextEdit* cmd_scrolled_buffer; QPlainTextEdit* cmd_scrolled_buffer;
static CoWowRecall value_recall; static CoWowRecall value_recall;
CoWowEntryQt* cmd_entry; CoWowEntryQt* cmd_entry;
QStatusBar* statusbar;
void message(char severity, const char* message); void message(char severity, const char* message);
void set_prompt(char* prompt); void set_prompt(char* prompt);
......
...@@ -83,6 +83,7 @@ void XColWindQt::change_value(int set_focus) ...@@ -83,6 +83,7 @@ void XColWindQt::change_value(int set_focus)
int input_size; int input_size;
if (input_open) { if (input_open) {
statusbar->setMaximumHeight(25);
cmd_entry->setVisible(false); cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
...@@ -102,6 +103,7 @@ void XColWindQt::change_value(int set_focus) ...@@ -102,6 +103,7 @@ void XColWindQt::change_value(int set_focus)
} }
if (multiline) { if (multiline) {
statusbar->setMaximumHeight(QWIDGETSIZE_MAX);
cmd_scrolledinput->setVisible(true); cmd_scrolledinput->setVisible(true);
set_pane_position(pane, -170); set_pane_position(pane, -170);
...@@ -123,7 +125,7 @@ void XColWindQt::change_value(int set_focus) ...@@ -123,7 +125,7 @@ void XColWindQt::change_value(int set_focus)
if (value) { if (value) {
if (multiline) { if (multiline) {
cmd_scrolled_buffer->setText(fl(value)); cmd_scrolled_buffer->setPlainText(fl(value));
} else { } else {
cmd_entry->setText(""); cmd_entry->setText("");
cmd_entry->setText(fl(value)); cmd_entry->setText(fl(value));
...@@ -151,7 +153,7 @@ void XColWindQtWidget::action_text_inserted() ...@@ -151,7 +153,7 @@ void XColWindQtWidget::action_text_inserted()
QString txt = colwind->cmd_scrolled_buffer->toPlainText(); QString txt = colwind->cmd_scrolled_buffer->toPlainText();
txt.truncate(colwind->input_max_length); txt.truncate(colwind->input_max_length);
colwind->cmd_scrolled_buffer->setText(txt); colwind->cmd_scrolled_buffer->setPlainText(txt);
CoWowQt wow(this); CoWowQt wow(this);
wow.DisplayError("Error message", "Attribute size exceeded"); wow.DisplayError("Error message", "Attribute size exceeded");
...@@ -283,6 +285,7 @@ void XColWindQt::change_value_close() ...@@ -283,6 +285,7 @@ void XColWindQt::change_value_close()
xattnav->set_attr_value(input_node, input_name, text); xattnav->set_attr_value(input_node, input_name, text);
} }
statusbar->setMaximumHeight(25);
cmd_scrolledinput->setVisible(false); cmd_scrolledinput->setVisible(false);
set_prompt(""); set_prompt("");
input_open = 0; input_open = 0;
...@@ -356,6 +359,7 @@ void XColWindQtWidget::activate_cmd_scrolled_ok() ...@@ -356,6 +359,7 @@ void XColWindQtWidget::activate_cmd_scrolled_ok()
colwind->xattnav->set_attr_value( colwind->xattnav->set_attr_value(
colwind->input_node, colwind->input_name, text); colwind->input_node, colwind->input_name, text);
colwind->statusbar->setMaximumHeight(25);
colwind->cmd_scrolledinput->setVisible(false); colwind->cmd_scrolledinput->setVisible(false);
colwind->set_prompt(""); colwind->set_prompt("");
colwind->input_open = 0; colwind->input_open = 0;
...@@ -370,6 +374,7 @@ void XColWindQtWidget::activate_cmd_scrolled_ok() ...@@ -370,6 +374,7 @@ void XColWindQtWidget::activate_cmd_scrolled_ok()
void XColWindQtWidget::activate_cmd_scrolled_ca() void XColWindQtWidget::activate_cmd_scrolled_ca()
{ {
if (colwind->input_open) { if (colwind->input_open) {
colwind->statusbar->setMaximumHeight(25);
colwind->cmd_scrolledinput->setVisible(false); colwind->cmd_scrolledinput->setVisible(false);
set_pane_position(colwind->pane, -50); set_pane_position(colwind->pane, -50);
...@@ -532,7 +537,7 @@ XColWindQt::XColWindQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar_list, ...@@ -532,7 +537,7 @@ XColWindQt::XColWindQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar_list,
xattnav->is_authorized_cb = &xcolwind_is_authorized_cb; xattnav->is_authorized_cb = &xcolwind_is_authorized_cb;
xattnav->init_cb = &init_cb; xattnav->init_cb = &init_cb;
QStatusBar* statusbar = new QStatusBar(); statusbar = new QStatusBar();
msg_label = new QLabel(""); msg_label = new QLabel("");
cmd_prompt = new QLabel("value > "); cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall); cmd_entry = new CoWowEntryQt(&value_recall);
...@@ -554,7 +559,7 @@ XColWindQt::XColWindQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar_list, ...@@ -554,7 +559,7 @@ XColWindQt::XColWindQt(void* xa_parent_ctx, pwr_sAttrRef* xa_objar_list,
toplevel->setLayout(vbox); toplevel->setLayout(vbox);
cmd_scrolled_buffer = new QTextEdit(); cmd_scrolled_buffer = new QPlainTextEdit();
QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel, QObject::connect(cmd_scrolled_buffer, SIGNAL(textChanged()), toplevel,
SLOT(action_text_inserted())); SLOT(action_text_inserted()));
......
...@@ -44,8 +44,9 @@ ...@@ -44,8 +44,9 @@
#include "xtt_xcolwind.h" #include "xtt_xcolwind.h"
#include <QLabel> #include <QLabel>
#include <QPlainTextEdit>
#include <QSplitter> #include <QSplitter>
#include <QTextEdit> #include <QStatusBar>
class XColWindQtWidget; class XColWindQtWidget;
...@@ -60,12 +61,13 @@ public: ...@@ -60,12 +61,13 @@ public:
QLabel* msg_label; QLabel* msg_label;
QLabel* cmd_prompt; QLabel* cmd_prompt;
QWidget* cmd_scrolledinput; QWidget* cmd_scrolledinput;
QTextEdit* cmd_scrolled_buffer; QPlainTextEdit* cmd_scrolled_buffer;
QSplitter* pane; QSplitter* pane;
static CoWowRecall value_recall; static CoWowRecall value_recall;
CoWowEntryQt* cmd_entry; CoWowEntryQt* cmd_entry;
CoWowFocusTimerQt focustimer; CoWowFocusTimerQt focustimer;
int input_max_length; int input_max_length;
QStatusBar* statusbar;
void message(char severity, const char* message); void message(char severity, const char* message);
void set_prompt(const char* prompt); void set_prompt(const char* prompt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment