Commit 8eb3bca0 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Added missing callbacks in Ev widget.

parent 6335dfe5
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
class CallbackWidget : public QDialog { class CallbackWidget : public QDialog {
public: public:
CallbackWidget(EvQt* parent, void (EvQt::*close)(), void (EvQt::*focus)()) CallbackWidget(EvQtObject* parent, void (EvQtObject::*close)(), void (EvQtObject::*focus)())
: QDialog(), ev(parent), close_cb(close), focus_cb(focus){} : QDialog(), ev(parent), close_cb(close), focus_cb(focus){}
protected: protected:
...@@ -61,9 +61,9 @@ protected: ...@@ -61,9 +61,9 @@ protected:
void focusInEvent(QFocusEvent* event); void focusInEvent(QFocusEvent* event);
private: private:
EvQt* ev; EvQtObject* ev;
void (EvQt::*close_cb)(); void (EvQtObject::*close_cb)();
void (EvQt::*focus_cb)(); void (EvQtObject::*focus_cb)();
}; };
void CallbackWidget::closeEvent(QCloseEvent* event) void CallbackWidget::closeEvent(QCloseEvent* event)
...@@ -122,7 +122,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -122,7 +122,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
// Eve Window // Eve Window
{ {
parent_wid_eve = new CallbackWidget( parent_wid_eve = new CallbackWidget(
this, &EvQt::eve_activate_exit, &EvQt::eve_action_inputfocus); object, &EvQtObject::eve_activate_exit, &EvQtObject::eve_action_inputfocus);
parent_wid_eve->setMinimumSize(eve_width, eve_height); parent_wid_eve->setMinimumSize(eve_width, eve_height);
parent_wid_eve->setToolTip(fl("xtt_ev eve widget")); parent_wid_eve->setToolTip(fl("xtt_ev eve widget"));
parent_wid_eve->setWindowTitle(translate_utf8(eve_name)); parent_wid_eve->setWindowTitle(translate_utf8(eve_name));
...@@ -140,7 +140,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -140,7 +140,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
addMenuItem(object, file, "&Print", SLOT(eve_activate_print()), "", addMenuItem(object, file, "&Print", SLOT(eve_activate_print()), "",
"document-print"); "document-print");
addMenuItem( addMenuItem(
object, file, "&Close", SLOT(close()), "CTRL+W", "window-close"); object, file, "&Close", SLOT(eve_activate_exit()), "CTRL+W", "window-close");
// Functions entry // Functions entry
QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions")); QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions"));
...@@ -156,13 +156,13 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -156,13 +156,13 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
addMenuItem(object, view, "Zoom &Out", SLOT(eve_activate_zoom_out()), addMenuItem(object, view, "Zoom &Out", SLOT(eve_activate_zoom_out()),
"CTRL+O", "zoom-out"); "CTRL+O", "zoom-out");
addMenuItem(object, view, "Zoom &Reset", SLOT(eve_activate_zoom_reset()), addMenuItem(object, view, "Zoom &Reset", SLOT(eve_activate_zoom_reset()),
"CTRL+B", "zoom-reset"); "CTRL+B", "zoom-original");
addCheckableMenuItem(object, view, "&Display hundredth", addCheckableMenuItem(object, view, "&Display hundredth",
SLOT(eve_activate_disp_hundredth())); SLOT(eve_activate_disp_hundredth(bool)));
addCheckableMenuItem( addCheckableMenuItem(
object, view, "&Hide Event Name", SLOT(eve_activate_hide_object())); object, view, "&Hide Event Name", SLOT(eve_activate_hide_object(bool)));
addCheckableMenuItem( addCheckableMenuItem(
object, view, "Hide &Event Text", SLOT(eve_activate_hide_text())); object, view, "Hide &Event Text", SLOT(eve_activate_hide_text(bool)));
// Help entry // Help entry
QMenu* help = menu_bar->addMenu(translate_utf8("&Help")); QMenu* help = menu_bar->addMenu(translate_utf8("&Help"));
...@@ -227,7 +227,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -227,7 +227,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
// Ala Window // Ala Window
{ {
parent_wid_ala = new CallbackWidget( parent_wid_ala = new CallbackWidget(
this, &EvQt::ala_activate_exit, &EvQt::ala_action_inputfocus); object, &EvQtObject::ala_activate_exit, &EvQtObject::ala_action_inputfocus);
parent_wid_eve->setToolTip(fl("xtt_ev ala widget")); parent_wid_eve->setToolTip(fl("xtt_ev ala widget"));
parent_wid_ala->setMinimumSize(ala_width, ala_height); parent_wid_ala->setMinimumSize(ala_width, ala_height);
parent_wid_ala->setWindowTitle(translate_utf8(ala_name)); parent_wid_ala->setWindowTitle(translate_utf8(ala_name));
...@@ -245,7 +245,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -245,7 +245,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
addMenuItem(object, file, "&Print", SLOT(ala_activate_print()), "", addMenuItem(object, file, "&Print", SLOT(ala_activate_print()), "",
"document-print"); "document-print");
addMenuItem( addMenuItem(
object, file, "&Close", SLOT(close()), "CTRL+W", "window-close"); object, file, "&Close", SLOT(ala_activate_exit()), "CTRL+W", "window-close");
// Functions entry // Functions entry
QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions")); QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions"));
...@@ -289,13 +289,13 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -289,13 +289,13 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
addMenuItem(object, view, "Zoom &Out", SLOT(ala_activate_zoom_out()), addMenuItem(object, view, "Zoom &Out", SLOT(ala_activate_zoom_out()),
"CTRL+O", "zoom-out"); "CTRL+O", "zoom-out");
addMenuItem(object, view, "Zoom &Reset", SLOT(ala_activate_zoom_reset()), addMenuItem(object, view, "Zoom &Reset", SLOT(ala_activate_zoom_reset()),
"CTRL+B", "zoom-reset"); "CTRL+B", "zoom-original");
addCheckableMenuItem(object, view, "&Display hundredth", addCheckableMenuItem(object, view, "&Display hundredth",
SLOT(ala_activate_disp_hundredth())); SLOT(ala_activate_disp_hundredth(bool)));
addCheckableMenuItem( addCheckableMenuItem(
object, view, "&Hide Event Name", SLOT(ala_activate_hide_object())); object, view, "&Hide Event Name", SLOT(ala_activate_hide_object(bool)));
addCheckableMenuItem( addCheckableMenuItem(
object, view, "Hide &Event Text", SLOT(ala_activate_hide_text())); object, view, "Hide &Event Text", SLOT(ala_activate_hide_text(bool)));
// Help entry // Help entry
QMenu* help = menu_bar->addMenu(translate_utf8("&Help")); QMenu* help = menu_bar->addMenu(translate_utf8("&Help"));
...@@ -365,7 +365,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -365,7 +365,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
// Blk Window // Blk Window
{ {
parent_wid_blk = new CallbackWidget( parent_wid_blk = new CallbackWidget(
this, &EvQt::blk_activate_exit, &EvQt::blk_action_inputfocus); object, &EvQtObject::blk_activate_exit, &EvQtObject::blk_action_inputfocus);
parent_wid_eve->setToolTip(fl("xtt_ev blk widget")); parent_wid_eve->setToolTip(fl("xtt_ev blk widget"));
parent_wid_blk->setMinimumSize(blk_width, blk_height); parent_wid_blk->setMinimumSize(blk_width, blk_height);
parent_wid_blk->setWindowTitle(translate_utf8(blk_name)); parent_wid_blk->setWindowTitle(translate_utf8(blk_name));
...@@ -383,7 +383,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -383,7 +383,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
addMenuItem(object, file, "&Print", SLOT(blk_activate_print()), "", addMenuItem(object, file, "&Print", SLOT(blk_activate_print()), "",
"document-print"); "document-print");
addMenuItem( addMenuItem(
object, file, "&Close", SLOT(close()), "CTRL+W", "window-close"); object, file, "&Close", SLOT(blk_activate_exit()), "CTRL+W", "window-close");
// Functions entry // Functions entry
QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions")); QMenu* functions = menu_bar->addMenu(translate_utf8("&Functions"));
...@@ -401,7 +401,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name, ...@@ -401,7 +401,7 @@ EvQt::EvQt(void* ev_parent_ctx, QWidget* ev_parent_wid, char* eve_name,
addMenuItem(object, view, "Zoom &Out", SLOT(blk_activate_zoom_out()), addMenuItem(object, view, "Zoom &Out", SLOT(blk_activate_zoom_out()),
"CTRL+O", "zoom-out"); "CTRL+O", "zoom-out");
addMenuItem(object, view, "Zoom &Reset", SLOT(blk_activate_zoom_reset()), addMenuItem(object, view, "Zoom &Reset", SLOT(blk_activate_zoom_reset()),
"CTRL+B", "zoom-reset"); "CTRL+B", "zoom-original");
// Help entry // Help entry
QMenu* help = menu_bar->addMenu(translate_utf8("&Help")); QMenu* help = menu_bar->addMenu(translate_utf8("&Help"));
...@@ -620,43 +620,43 @@ void EvQt::set_title_ala(char* title) ...@@ -620,43 +620,43 @@ void EvQt::set_title_ala(char* title)
parent_wid_ala->setWindowTitle(fl(title)); parent_wid_ala->setWindowTitle(fl(title));
} }
void EvQt::eve_action_inputfocus() void EvQtObject::eve_action_inputfocus()
{ {
if (eve_displayed) { if (ev->eve_displayed) {
eve->set_input_focus(); ev->eve->set_input_focus();
} }
} }
void EvQt::ala_action_inputfocus() void EvQtObject::ala_action_inputfocus()
{ {
if (ala_displayed) { if (ev->ala_displayed) {
ala->set_input_focus(); ev->ala->set_input_focus();
} }
} }
void EvQt::blk_action_inputfocus() void EvQtObject::blk_action_inputfocus()
{ {
if (blk_displayed) { if (ev->blk_displayed) {
blk->set_input_focus(); ev->blk->set_input_focus();
} }
} }
void EvQt::eve_activate_exit() void EvQtObject::eve_activate_exit()
{ {
unmap_eve(); ev->unmap_eve();
eve_displayed = 0; ev->eve_displayed = 0;
} }
void EvQt::ala_activate_exit() void EvQtObject::ala_activate_exit()
{ {
unmap_ala(); ev->unmap_ala();
ala_displayed = 0; ev->ala_displayed = 0;
} }
void EvQt::blk_activate_exit() void EvQtObject::blk_activate_exit()
{ {
unmap_blk(); ev->unmap_blk();
blk_displayed = 0; ev->blk_displayed = 0;
} }
void EvQtObject::eve_activate_print() void EvQtObject::eve_activate_print()
......
...@@ -81,13 +81,6 @@ public: ...@@ -81,13 +81,6 @@ public:
int width, int height, int x, int y, pwr_tObjid view, int width, int height, int x, int y, pwr_tObjid view,
unsigned int options = 0, void* widget = 0); unsigned int options = 0, void* widget = 0);
void eve_action_inputfocus();
void ala_action_inputfocus();
void blk_action_inputfocus();
void eve_activate_exit();
void ala_activate_exit();
void blk_activate_exit();
private: private:
EvQtObject* object; EvQtObject* object;
}; };
...@@ -101,6 +94,12 @@ public: ...@@ -101,6 +94,12 @@ public:
} }
public slots: public slots:
void eve_action_inputfocus();
void ala_action_inputfocus();
void blk_action_inputfocus();
void eve_activate_exit();
void ala_activate_exit();
void blk_activate_exit();
void eve_activate_print(); void eve_activate_print();
void ala_activate_print(); void ala_activate_print();
void blk_activate_print(); void blk_activate_print();
......
...@@ -96,8 +96,8 @@ static void modifyBackground(QWidget* widget, QColor& color) ...@@ -96,8 +96,8 @@ static void modifyBackground(QWidget* widget, QColor& color)
QPalette pal; QPalette pal;
pal.setColor(QPalette::Background, color); pal.setColor(QPalette::Background, color);
widget->setAutoFillBackground(true);
widget->setPalette(pal); widget->setPalette(pal);
widget->setAutoFillBackground(true);
} }
static void modifyForeground(QWidget* widget, QColor& color) static void modifyForeground(QWidget* widget, QColor& color)
...@@ -314,7 +314,7 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace, ...@@ -314,7 +314,7 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace,
SLOT(activate_help_proview())); SLOT(activate_help_proview()));
// End Help submenu // End Help submenu
addMenuItem( functions_close = addMenuItem(
toplevel, functions, "&Close", SLOT(close()), "CTRL+W", "window-close"); toplevel, functions, "&Close", SLOT(close()), "CTRL+W", "window-close");
// Toolbar // Toolbar
...@@ -327,7 +327,7 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace, ...@@ -327,7 +327,7 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace,
"$pwr_exe/xtt_zoom_out.png"); "$pwr_exe/xtt_zoom_out.png");
addToolItem( addToolItem(
toplevel, tools, "Help", SLOT(activate_help()), "$pwr_exe/xtt_help.png"); toplevel, tools, "Help", SLOT(activate_help()), "$pwr_exe/xtt_help.png");
addToolItem( tools_close = addToolItem(
toplevel, tools, "Close", SLOT(close()), "$pwr_exe/xtt_close.png"); toplevel, tools, "Close", SLOT(close()), "$pwr_exe/xtt_close.png");
addToolItem(toplevel, tools2, "Alarm List", SLOT(activate_alarmlist()), addToolItem(toplevel, tools2, "Alarm List", SLOT(activate_alarmlist()),
...@@ -395,6 +395,7 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace, ...@@ -395,6 +395,7 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace,
sup_vect[i].node_name); sup_vect[i].node_name);
node_label->setText(convert_utf8(text)); node_label->setText(convert_utf8(text));
QPushButton* node_button = new QPushButton();
QHBoxLayout* node_hbox = new QHBoxLayout(); QHBoxLayout* node_hbox = new QHBoxLayout();
QWidget* node_ind = new QWidget(); QWidget* node_ind = new QWidget();
...@@ -418,20 +419,19 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace, ...@@ -418,20 +419,19 @@ OpQt::OpQt(void* op_parent_ctx, QWidget* op_parent_wid, char* opplace,
modifyBackground(node_ind_frame, black_color); modifyBackground(node_ind_frame, black_color);
node_ind_frame->setFixedSize(20, 20); node_ind_frame->setFixedSize(20, 20);
QWidget* node_image = layout_to_widget(node_image_layout);
if (buttonwidth) { if (buttonwidth) {
node_image->setFixedWidth(buttonwidth); node_button->setFixedWidth(buttonwidth);
} }
sup_vect[i].indw = (void*)node_ind; sup_vect[i].indw = (void*)node_ind;
sup_vect[i].indfiller1w = (void*)node_ind_filler1; sup_vect[i].indfiller1w = (void*)node_ind_filler1;
sup_vect[i].indfiller2w = (void*)node_ind_filler2; sup_vect[i].indfiller2w = (void*)node_ind_filler2;
sup_vect[i].textw = (void*)node_label; sup_vect[i].textw = (void*)node_label;
sup_vect[i].textbgw = (void*)node_label; sup_vect[i].textbgw = (void*)node_label;
sup_vect[i].buttonw = (void*)node_image; sup_vect[i].buttonw = (void*)node_button;
QObject::connect( QObject::connect(
node_image, SIGNAL(clicked()), toplevel, SLOT(activate_sup_node())); node_button, SIGNAL(clicked()), toplevel, SLOT(activate_sup_node()));
status_bar->setContentsMargins(padding2, padding2, padding2, padding2); status_bar->setContentsMargins(padding2, padding2, padding2, padding2);
status_bar->addWidget(node_image); status_bar->addWidget(node_button);
} }
if (buttonwidth) { if (buttonwidth) {
status_bar->setFixedWidth(xtt_monitor_geometry.width()); status_bar->setFixedWidth(xtt_monitor_geometry.width());
...@@ -925,15 +925,17 @@ int OpQt::configure(char* opplace_str) ...@@ -925,15 +925,17 @@ int OpQt::configure(char* opplace_str)
for (i = 0; for (i = 0;
i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]); i < sizeof(opplace_p->FastAvail) / sizeof(opplace_p->FastAvail[0]);
i++) { i++) {
if ((i + 1) % 5 == 0) { if ((i == 0) || ((i + 1) % 5 == 0)) {
funcbox[(i + 1) / 5] = layout_to_widget(new QHBoxLayout()); funcbox[(i + 1) / 5] = layout_to_widget(new QHBoxLayout());
appl_form->addWidget(funcbox[(i + 1) / 5]); appl_form->addWidget(funcbox[(i + 1) / 5]);
} }
int i2 = ((int)(i / 5)); if (cdh_ObjidIsNotNull(button_aref[i].Objid)) {
add_expanding(funcbox[i2]->layout(), appl_buttons[i]); int i2 = (int)(i / 5);
if (i >= 15) { add_expanding(funcbox[i2]->layout(), appl_buttons[i]);
a_height = i2 + 1; if (i >= 15) {
a_height = i2 + 1;
}
} }
} }
...@@ -1410,9 +1412,9 @@ void OpQt::set_color_theme(int idx) ...@@ -1410,9 +1412,9 @@ void OpQt::set_color_theme(int idx)
modifyForeground(aalarm_mark, bg_text); modifyForeground(aalarm_mark, bg_text);
modifyBackground(balarm_mark, bg); modifyBackground(balarm_mark, bg);
modifyForeground(balarm_mark, bg_text); modifyForeground(balarm_mark, bg_text);
modifyBackground(balarm_active_box, bg); modifyBackground(balarm_active, bg);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
modifyBackground(aalarm_active_box[i], bg); modifyBackground(aalarm_active[i], bg);
} }
modifyBackground(menu_bar, menu); modifyBackground(menu_bar, menu);
......
...@@ -73,20 +73,18 @@ public: ...@@ -73,20 +73,18 @@ public:
QWidget* aalarm_mark; QWidget* aalarm_mark;
QLabel* aalarm_label[5]; QLabel* aalarm_label[5];
QWidget* aalarm_active[5]; QWidget* aalarm_active[5];
QWidget* aalarm_active_box[5];
QWidget* aalarm_info[5]; QWidget* aalarm_info[5];
QWidget* aalarm_box[5]; QWidget* aalarm_box[5];
QLabel* balarm_label; QLabel* balarm_label;
QWidget* balarm_active; QWidget* balarm_active;
QWidget* balarm_active_box;
QWidget* balarm_info; QWidget* balarm_info;
QWidget* balarm_box; QWidget* balarm_box;
QWidget* balarm_ebox; QWidget* balarm_ebox;
QLabel* balarm_mark; QLabel* balarm_mark;
QVBoxLayout* appl_form; QVBoxLayout* appl_form;
QWidget* decr_button; QWidget* decr_button;
QWidget* tools_close; QAction* tools_close;
QWidget* functions_close; QAction* functions_close;
QWidget* funcbox[5]; QWidget* funcbox[5];
QMenuBar* menu_bar; QMenuBar* menu_bar;
QLabel* title_label; QLabel* title_label;
......
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