Commit 61f2bfb0 authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

QT: Made all statusbars expand when editing a multiline text.

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