Commit 6e4e1530 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fixed xtt_multiview.

parent 2ce48869
...@@ -561,7 +561,7 @@ void CoWowQt::PopupPosition( ...@@ -561,7 +561,7 @@ void CoWowQt::PopupPosition(
QPoint p0((int)x_event, (int)y_event); QPoint p0((int)x_event, (int)y_event);
grandparent = parent->parentWidget(); grandparent = parent->parentWidget();
while (!grandparent->isWindow()) { while (grandparent && !grandparent->isWindow()) {
if (parent->geometry().x() || parent->geometry().y()) { if (parent->geometry().x() || parent->geometry().y()) {
p0 = parent->mapToParent(p0); p0 = parent->mapToParent(p0);
} }
......
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
#include "xtt_stream_qt.h" #include "xtt_stream_qt.h"
#include "xtt_xnav.h" #include "xtt_xnav.h"
// TODO: Clean up this mess
QWidget* XttMultiViewQt::error_msg(const char* msg, pwr_tStatus sts) QWidget* XttMultiViewQt::error_msg(const char* msg, pwr_tStatus sts)
{ {
char str1[200]; char str1[200];
...@@ -82,24 +84,6 @@ void XttMultiViewQtWidget::focusInEvent(QFocusEvent* event) ...@@ -82,24 +84,6 @@ void XttMultiViewQtWidget::focusInEvent(QFocusEvent* event)
QWidget::focusInEvent(event); QWidget::focusInEvent(event);
} }
void XttMultiViewQtWidget::resize(int width, int height)
{
int default_width;
int default_height;
float rd = 0.05;
;
default_width = width + 20;
default_height = height + 20;
if (width < 300 || height < 300) {
rd = 0.2;
}
default_height = MIN(default_height, width);
default_height = MAX(default_height, width * 1.02);
QWidget::resize(default_width, default_height);
}
void XttMultiViewQt::set_size(int width, int height) void XttMultiViewQt::set_size(int width, int height)
{ {
toplevel->resize(width, height); toplevel->resize(width, height);
...@@ -107,10 +91,33 @@ void XttMultiViewQt::set_size(int width, int height) ...@@ -107,10 +91,33 @@ void XttMultiViewQt::set_size(int width, int height)
XttMultiViewQt::~XttMultiViewQt() XttMultiViewQt::~XttMultiViewQt()
{ {
debug_print("XttMultiViewQt::~XttMultiViewQt\n");
if (close_cb) { if (close_cb) {
(close_cb)(parent_ctx, this); (close_cb)(parent_ctx, this);
} }
for (unsigned int i = 0; i < MV_SIZE; i++) {
if (sala[i]) {
delete sala[i];
}
if (seve[i]) {
delete seve[i];
}
if (gectx[i]) {
delete gectx[i];
}
if (mvctx[i]) {
delete mvctx[i];
}
if (trend[i]) {
delete trend[i];
}
if (sevhist[i]) {
delete sevhist[i];
}
if (strmctx[i]) {
delete strmctx[i];
}
}
} }
void XttMultiViewQt::pop() void XttMultiViewQt::pop()
...@@ -120,7 +127,6 @@ void XttMultiViewQt::pop() ...@@ -120,7 +127,6 @@ void XttMultiViewQt::pop()
void XttMultiViewQtWidget::closeEvent(QCloseEvent* event) void XttMultiViewQtWidget::closeEvent(QCloseEvent* event)
{ {
debug_print("XttMultiViewQtWidget::closeEvent\n");
if (multiview->options & ge_mOptions_IsMain) { if (multiview->options & ge_mOptions_IsMain) {
(multiview->close_cb)(multiview->parent_ctx, multiview); (multiview->close_cb)(multiview->parent_ctx, multiview);
} else { } else {
...@@ -141,11 +147,8 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -141,11 +147,8 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
mv_y, mv_options, mv_color_theme, mv_command_cb, mv_y, mv_options, mv_color_theme, mv_command_cb,
mv_get_current_objects_cb, mv_is_authorized_cb, mv_keyboard_cb) mv_get_current_objects_cb, mv_is_authorized_cb, mv_keyboard_cb)
{ {
int window_width = 600;
int window_height = 500;
pwr_tStatus lsts; pwr_tStatus lsts;
XNav* xnav = get_xnav(); XNav* xnav = get_xnav();
pwr_sClass_XttMultiView mv;
memset(gectx, 0, sizeof(gectx)); memset(gectx, 0, sizeof(gectx));
memset(mvctx, 0, sizeof(mvctx)); memset(mvctx, 0, sizeof(mvctx));
...@@ -161,11 +164,13 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -161,11 +164,13 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
memset(comp_x, 0, sizeof(comp_x)); memset(comp_x, 0, sizeof(comp_x));
memset(comp_y, 0, sizeof(comp_y)); memset(comp_y, 0, sizeof(comp_y));
pwr_sClass_XttMultiView mv;
*sts = gdh_GetObjectInfoAttrref(&aref, &mv, sizeof(mv)); *sts = gdh_GetObjectInfoAttrref(&aref, &mv, sizeof(mv));
if (EVEN(*sts)) { if (EVEN(*sts)) {
return; return;
} }
int window_width, window_height;
if (mv_width != 0 && mv_height != 0) { if (mv_width != 0 && mv_height != 0) {
window_width = mv_width; window_width = mv_width;
window_height = mv_height; window_height = mv_height;
...@@ -178,10 +183,9 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -178,10 +183,9 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
} }
// Qt // Qt
toplevel = new XttMultiViewQtWidget(this, mv_parent_wid);
toplevel->setMinimumSize(window_width, window_height);
if (!(options & ge_mOptions_Embedded)) { if (!(options & ge_mOptions_Embedded)) {
toplevel = new XttMultiViewQtWidget(this, mv_parent_wid);
toplevel->setToolTip(fl("xtt_multiview widget"));
toplevel->setMinimumSize(window_width, window_height);
toplevel->setWindowTitle(QString::fromLatin1(mv.Title)); toplevel->setWindowTitle(QString::fromLatin1(mv.Title));
toplevel->setAttribute(Qt::WA_DeleteOnClose); toplevel->setAttribute(Qt::WA_DeleteOnClose);
...@@ -189,89 +193,55 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -189,89 +193,55 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
toplevel->setWindowFlags(Qt::CustomizeWindowHint); toplevel->setWindowFlags(Qt::CustomizeWindowHint);
} }
if (mv.Layout == pwr_eMultiViewLayoutEnum_Fix
|| mv.Layout == pwr_eMultiViewLayoutEnum_Table) {
toplevel->setMinimumSize(window_width, window_height);
}
if (mv.Options & pwr_mMultiViewOptionsMask_Dialog) { if (mv.Options & pwr_mMultiViewOptionsMask_Dialog) {
toplevel->setWindowFlags(Qt::Dialog); toplevel->setWindowFlags(Qt::Dialog);
toplevel->setMinimumSize(window_width, window_height);
} }
CoWowQt::SetWindowIcon(toplevel); CoWowQt::SetWindowIcon(toplevel);
} else {
box_widget = layout_to_widget(new QHBoxLayout());
} }
{ {
rows = mv.Rows; rows = mv.Rows;
cols = mv.Columns; cols = mv.Columns;
QHBoxLayout* col_widget_box = NULL; QHBoxLayout* col_widget_box = new QHBoxLayout();
QSplitter* col_widget_pane = NULL; QSplitter* col_widget_pane = new QSplitter();
QGridLayout* col_widget_table = NULL; QGridLayout* col_widget_table = new QGridLayout();
switch (mv.Layout) { if (!(mv.Layout == pwr_eMultiViewLayoutEnum_Box ||
case pwr_eMultiViewLayoutEnum_Box: mv.Layout == pwr_eMultiViewLayoutEnum_Fix ||
col_widget_box = new QHBoxLayout(); mv.Layout == pwr_eMultiViewLayoutEnum_Pane ||
break; mv.Layout == pwr_eMultiViewLayoutEnum_Table)) {
case pwr_eMultiViewLayoutEnum_Pane:
col_widget_pane = new QSplitter();
break;
case pwr_eMultiViewLayoutEnum_Table:
col_widget_table = new QGridLayout(); //(rows, cols);
break;
default:
return; return;
} }
bool escape = false; bool escape = false;
for (int i = 0; i < cols; i++) { for (int i = 0; i < cols; i++) {
QVBoxLayout* row_widget_box = NULL; QVBoxLayout* row_widget_box = new QVBoxLayout();
QSplitter* row_widget_pane = NULL; QSplitter* row_widget_pane = new QSplitter(Qt::Vertical);
if (mv.Layout == pwr_eMultiViewLayoutEnum_Pane && i > 1) {
break;
}
switch (mv.Layout) {
case pwr_eMultiViewLayoutEnum_Box:
row_widget_box = new QVBoxLayout();
break;
case pwr_eMultiViewLayoutEnum_Pane:
row_widget_pane = new QSplitter(Qt::Vertical);
break;
default:
break;
}
for (int j = 0; j < rows; j++) { for (int j = 0; j < rows; j++) {
pwr_tFileName graph_name; pwr_tFileName graph_name;
int w, h, scrollbar, menu, type;
if (i * rows + j >= MV_SIZE) { if (i * rows + j >= MV_SIZE) {
escape = true; escape = true;
break; break;
} }
if (mv.Layout == pwr_eMultiViewLayoutEnum_Pane && j > 1) {
break;
}
w = comp_width[i * rows + j] = mv.Action[i * rows + j].Width; int w = comp_width[i * rows + j] = mv.Action[i * rows + j].Width;
h = comp_height[i * rows + j] = mv.Action[i * rows + j].Height; int h = comp_height[i * rows + j] = mv.Action[i * rows + j].Height;
comp_x[i * rows + j] = mv.Action[i * rows + j].X; comp_x[i * rows + j] = mv.Action[i * rows + j].X;
comp_y[i * rows + j] = mv.Action[i * rows + j].Y; comp_y[i * rows + j] = mv.Action[i * rows + j].Y;
scrollbar = (mv.Action[i * rows + j].Options int scrollbar = (mv.Action[i * rows + j].Options
& pwr_mMultiViewElemOptionsMask_Scrollbars) & pwr_mMultiViewElemOptionsMask_Scrollbars)
? 1 ? 1
: 0; : 0;
menu = (mv.Action[i * rows + j].Options int menu = (mv.Action[i * rows + j].Options
& pwr_mMultiViewElemOptionsMask_Menu) & pwr_mMultiViewElemOptionsMask_Menu)
? 1 ? 1
: 0; : 0;
strcpy(graph_name, mv.Action[i * rows + j].Action); strcpy(graph_name, mv.Action[i * rows + j].Action);
type = mv.Action[i * rows + j].Type; int type = mv.Action[i * rows + j].Type;
switch (type) { switch (type) {
case pwr_eMultiViewContentEnum_AlarmList: { case pwr_eMultiViewContentEnum_AlarmList: {
...@@ -401,12 +371,9 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -401,12 +371,9 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
break; break;
} }
case pwr_eMultiViewContentEnum_TrendCurve: { case pwr_eMultiViewContentEnum_TrendCurve: {
int plotgroup_found = 0;
pwr_tAttrRef plotgroup;
pwr_tCid classid; pwr_tCid classid;
QWidget* widget; QWidget* widget;
pwr_tAttrRef arefv[2]; pwr_tAttrRef arefv[2];
int skip = 0;
lsts lsts
= gdh_GetAttrRefTid(&mv.Action[i * rows + j].Object[0], &classid); = gdh_GetAttrRefTid(&mv.Action[i * rows + j].Object[0], &classid);
...@@ -414,33 +381,19 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -414,33 +381,19 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
break; break;
} }
switch (classid) { if (classid == pwr_cClass_PlotGroup) {
case pwr_cClass_DsTrend: arefv[0] = mv.Action[i * rows + j].Object[0];
case pwr_cClass_DsTrendCurve:
break;
case pwr_cClass_PlotGroup:
plotgroup_found = 1;
plotgroup = mv.Action[i * rows + j].Object[0];
arefv[0] = plotgroup;
break;
default:
skip = 1;
}
if (skip) {
break;
}
if (plotgroup_found) {
trend[i * rows + j] = new XttTrendQt(this, toplevel, trend[i * rows + j] = new XttTrendQt(this, toplevel,
(char*)"No title", &widget, 0, &plotgroup, w, h, (char*)"No title", &widget, 0, &(arefv[0]), w, h,
(unsigned int)curve_mOptions_Embedded, color_theme, 0, sts); (unsigned int)curve_mOptions_Embedded, color_theme, 0, sts);
} else { } else if (classid == pwr_cClass_DsTrend || classid == pwr_cClass_DsTrendCurve) {
arefv[0] = mv.Action[i * rows + j].Object[0]; arefv[0] = mv.Action[i * rows + j].Object[0];
memset(&arefv[1], 0, sizeof(arefv[0])); memset(&arefv[1], 0, sizeof(arefv[0]));
trend[i * rows + j] = new XttTrendQt(this, toplevel, trend[i * rows + j] = new XttTrendQt(this, toplevel,
(char*)"No title", &widget, arefv, 0, w, h, (char*)"No title", &widget, arefv, 0, w, h,
(unsigned int)curve_mOptions_Embedded, color_theme, 0, sts); (unsigned int)curve_mOptions_Embedded, color_theme, 0, sts);
} else {
break;
} }
if (EVEN(*sts)) { if (EVEN(*sts)) {
break; break;
...@@ -462,23 +415,19 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -462,23 +415,19 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
pwr_tOName anamev[11]; pwr_tOName anamev[11];
pwr_tOName onamev[11]; pwr_tOName onamev[11];
bool sevhistobjectv[11]; bool sevhistobjectv[11];
pwr_tAttrRef attr_aref, sevhist_aref, histthread_aref; pwr_tAttrRef attr_aref, sevhist_aref;
pwr_tOid histthread_oid; pwr_tOid histthread_oid;
char server_node[40]; char server_node[40];
char* s; char* s;
pwr_tAName aname; pwr_tAName aname;
int plotgroup_found = 0;
int sevHistObjectFound = 0;
int oid_cnt = 0; int oid_cnt = 0;
pwr_tCid classid; pwr_tCid classid;
int skip = 0;
if (cdh_ObjidIsNull(mv.Action[i * rows + j].Object[0].Objid)) { if (cdh_ObjidIsNull(mv.Action[i * rows + j].Object[0].Objid)) {
break; break;
} }
pwr_tAttrRef arefv[2]; pwr_tAttrRef arefv[2];
pwr_tAttrRef plotgroup;
arefv[0] = mv.Action[i * rows + j].Object[0]; arefv[0] = mv.Action[i * rows + j].Object[0];
memset(&arefv[1], 0, sizeof(arefv[0])); memset(&arefv[1], 0, sizeof(arefv[0]));
...@@ -487,35 +436,16 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -487,35 +436,16 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
break; break;
}; };
switch (classid) { if (classid == pwr_cClass_PlotGroup) {
case pwr_cClass_SevHist:
break;
case pwr_cClass_SevHistObject:
sevHistObjectFound = true;
break;
case pwr_cClass_PlotGroup:
plotgroup = mv.Action[i * rows + j].Object[0];
plotgroup_found = 1;
break;
default:
skip = 1;
}
if (skip) {
break;
}
if (plotgroup_found) {
pwr_sClass_PlotGroup plot; pwr_sClass_PlotGroup plot;
pwr_tCid cid; pwr_tCid cid;
int j;
lsts = gdh_GetObjectInfoAttrref(&plotgroup, &plot, sizeof(plot)); lsts = gdh_GetObjectInfoAttrref(&(mv.Action[i * rows + j].Object[0]), &plot, sizeof(plot));
if (EVEN(lsts)) { if (EVEN(lsts)) {
break; break;
} }
for (j = 0; j < 20; j++) { for (int j = 0; j < 20; j++) {
if (cdh_ObjidIsNull(plot.YObjectName[j].Objid)) { if (cdh_ObjidIsNull(plot.YObjectName[j].Objid)) {
break; break;
} }
...@@ -588,7 +518,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -588,7 +518,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
oid_cnt++; oid_cnt++;
} }
} }
} else if (sevHistObjectFound) { } else if (classid == pwr_cClass_SevHistObject) {
lsts = gdh_ArefANameToAref( lsts = gdh_ArefANameToAref(
&mv.Action[i * rows + j].Object[0], "Object", &attr_aref); &mv.Action[i * rows + j].Object[0], "Object", &attr_aref);
if (EVEN(lsts)) { if (EVEN(lsts)) {
...@@ -619,7 +549,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -619,7 +549,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
strcpy(onamev[oid_cnt], ""); strcpy(onamev[oid_cnt], "");
sevhist_aref = mv.Action[i * rows + j].Object[0]; sevhist_aref = mv.Action[i * rows + j].Object[0];
oid_cnt = 1; oid_cnt = 1;
} else { } else if (classid == pwr_cClass_SevHist) {
lsts = gdh_ArefANameToAref( lsts = gdh_ArefANameToAref(
&mv.Action[i * rows + j].Object[0], "Attribute", &attr_aref); &mv.Action[i * rows + j].Object[0], "Attribute", &attr_aref);
if (EVEN(lsts)) { if (EVEN(lsts)) {
...@@ -650,6 +580,8 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -650,6 +580,8 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
sevhistobjectv[0] = false; sevhistobjectv[0] = false;
oid_cnt = 1; oid_cnt = 1;
sevhist_aref = mv.Action[i * rows + j].Object[0]; sevhist_aref = mv.Action[i * rows + j].Object[0];
} else {
break;
} }
oidv[oid_cnt] = pwr_cNOid; oidv[oid_cnt] = pwr_cNOid;
...@@ -666,7 +598,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -666,7 +598,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
break; break;
} }
histthread_aref = cdh_ObjidToAref(histthread_oid); pwr_tAttrRef histthread_aref = cdh_ObjidToAref(histthread_oid);
lsts lsts
= gdh_ArefANameToAref(&histthread_aref, "ServerNode", &attr_aref); = gdh_ArefANameToAref(&histthread_aref, "ServerNode", &attr_aref);
if (EVEN(lsts)) { if (EVEN(lsts)) {
...@@ -711,10 +643,9 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -711,10 +643,9 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
} }
case pwr_eMultiViewContentEnum_Camera: { case pwr_eMultiViewContentEnum_Camera: {
pwr_sClass_XttCamera xttcamera; pwr_sClass_XttCamera xttcamera;
pwr_tObjid objid;
pwr_tCid cid; pwr_tCid cid;
objid = mv.Action[i * rows + j].Object[0].Objid; pwr_tObjid objid = mv.Action[i * rows + j].Object[0].Objid;
if (cdh_ObjidIsNull(objid)) { if (cdh_ObjidIsNull(objid)) {
break; break;
} }
...@@ -789,30 +720,21 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -789,30 +720,21 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
} }
switch (mv.Layout) { switch (mv.Layout) {
case pwr_eMultiViewLayoutEnum_Box: case pwr_eMultiViewLayoutEnum_Box:
add_expanding(row_widget_box, exchange_widget[i * rows + j]); row_widget_box->addWidget(exchange_widget[i * rows + j]);
break; break;
case pwr_eMultiViewLayoutEnum_Fix: case pwr_eMultiViewLayoutEnum_Fix:
comp_widget[i * rows + j]->setMinimumSize( comp_widget[i * rows + j]->setMinimumSize(
mv.Action[i * rows + j].Width, mv.Action[i * rows + j].Height); mv.Action[i * rows + j].Width, mv.Action[i * rows + j].Height);
fixed_put(toplevel, exchange_widget[i * rows + j], fixed_put(toplevel, exchange_widget[i * rows + j],
mv.Action[i * rows + j].X, mv.Action[i * rows + j].Y); mv.Action[i * rows + j].X, mv.Action[i * rows + j].Y);
exchange_widget[i * rows + j]->show();
break; break;
case pwr_eMultiViewLayoutEnum_Pane: case pwr_eMultiViewLayoutEnum_Pane:
if (j == 0) { row_widget_pane->addWidget(exchange_widget[i * rows + j]);
if (row_widget_pane->widget(0) && row_widget_pane->count() == 2) {
row_widget_pane->widget(0)->setParent(NULL);
}
row_widget_pane->insertWidget(0, exchange_widget[i * rows + j]);
} else {
if (row_widget_pane->widget(1)) {
row_widget_pane->widget(1)->setParent(NULL);
}
row_widget_pane->insertWidget(1, exchange_widget[i * rows + j]);
}
break; break;
case pwr_eMultiViewLayoutEnum_Table: case pwr_eMultiViewLayoutEnum_Table:
col_widget_table->addWidget( col_widget_table->addWidget(
exchange_widget[i * rows + j], i, j, i + 1, j + 1); exchange_widget[i * rows + j], j, i);
break; break;
default:; default:;
} }
...@@ -820,7 +742,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -820,7 +742,7 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
if (comp_widget[i * rows + j]) { if (comp_widget[i * rows + j]) {
switch (mv.Layout) { switch (mv.Layout) {
case pwr_eMultiViewLayoutEnum_Box: case pwr_eMultiViewLayoutEnum_Box:
add_expanding(row_widget_box, comp_widget[i * rows + j]); row_widget_box->addWidget(comp_widget[i * rows + j]);
break; break;
case pwr_eMultiViewLayoutEnum_Fix: case pwr_eMultiViewLayoutEnum_Fix:
comp_widget[i * rows + j]->setMinimumSize( comp_widget[i * rows + j]->setMinimumSize(
...@@ -828,24 +750,14 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -828,24 +750,14 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
mv.Action[i * rows + j].Height); mv.Action[i * rows + j].Height);
fixed_put(toplevel, comp_widget[i * rows + j], fixed_put(toplevel, comp_widget[i * rows + j],
mv.Action[i * rows + j].X, mv.Action[i * rows + j].Y); mv.Action[i * rows + j].X, mv.Action[i * rows + j].Y);
comp_widget[i * rows + j]->show();
break; break;
case pwr_eMultiViewLayoutEnum_Pane: case pwr_eMultiViewLayoutEnum_Pane:
if (j == 0) { row_widget_pane->addWidget(comp_widget[i * rows + j]);
if (row_widget_pane->widget(0)
&& row_widget_pane->count() == 2) {
row_widget_pane->widget(0)->setParent(NULL);
}
row_widget_pane->insertWidget(0, comp_widget[i * rows + j]);
} else {
if (row_widget_pane->widget(1)) {
row_widget_pane->widget(1)->setParent(NULL);
}
row_widget_pane->insertWidget(1, comp_widget[i * rows + j]);
}
break; break;
case pwr_eMultiViewLayoutEnum_Table: case pwr_eMultiViewLayoutEnum_Table:
col_widget_table->addWidget( col_widget_table->addWidget(
comp_widget[i * rows + j], i, j, i + 1, j + 1); comp_widget[i * rows + j], j, i);
default:; default:;
} }
} }
...@@ -857,28 +769,10 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -857,28 +769,10 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
} }
} }
switch (mv.Layout) { if (mv.Layout == pwr_eMultiViewLayoutEnum_Box) {
case pwr_eMultiViewLayoutEnum_Box: { col_widget_box->addLayout(row_widget_box);
add_expanding(col_widget_box, row_widget_box); } else if (mv.Layout == pwr_eMultiViewLayoutEnum_Pane) {
break; col_widget_pane->addWidget(row_widget_pane);
}
case pwr_eMultiViewLayoutEnum_Fix:
break;
case pwr_eMultiViewLayoutEnum_Pane: {
if (i == 0) {
if (col_widget_pane->widget(0) && col_widget_pane->count() == 2) {
col_widget_pane->widget(0)->setParent(NULL);
}
col_widget_pane->insertWidget(0, row_widget_pane);
} else {
if (col_widget_pane->widget(1)) {
col_widget_pane->widget(1)->setParent(NULL);
}
col_widget_pane->insertWidget(1, row_widget_pane);
}
break;
}
default:;
} }
if (mv.Layout == pwr_eMultiViewLayoutEnum_Box if (mv.Layout == pwr_eMultiViewLayoutEnum_Box
...@@ -894,23 +788,19 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -894,23 +788,19 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
switch (mv.Layout) { switch (mv.Layout) {
case pwr_eMultiViewLayoutEnum_Box: case pwr_eMultiViewLayoutEnum_Box:
col_widget = layout_to_widget(col_widget_box); toplevel->setLayout(col_widget_box);
break; break;
case pwr_eMultiViewLayoutEnum_Pane: case pwr_eMultiViewLayoutEnum_Pane: {
col_widget = col_widget_pane; QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(col_widget_pane);
toplevel->setLayout(layout);
break; break;
}
case pwr_eMultiViewLayoutEnum_Table: case pwr_eMultiViewLayoutEnum_Table:
col_widget = layout_to_widget(col_widget_table); toplevel->setLayout(col_widget_table);
break; break;
default: default:
return; break;
}
if (!(options & ge_mOptions_Embedded)) {
// setLayout(col_widget);
col_widget->setParent(toplevel);
} else {
box_widget->layout()->addWidget(col_widget);
} }
} }
...@@ -935,11 +825,6 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -935,11 +825,6 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
sevhist[i]->setup(); sevhist[i]->setup();
} }
} }
for (int i = 0; i < MV_SIZE; i++) {
if (strmctx[i]) {
strmctx[i]->setup();
}
}
if (options & ge_mOptions_FullScreen if (options & ge_mOptions_FullScreen
|| mv.Options & pwr_mMultiViewOptionsMask_FullScreen) { || mv.Options & pwr_mMultiViewOptionsMask_FullScreen) {
...@@ -956,12 +841,6 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -956,12 +841,6 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
} else if (options & ge_mOptions_Invisible) { } else if (options & ge_mOptions_Invisible) {
toplevel->setVisible(false); toplevel->setVisible(false);
} }
if (basewidget) {
toplevel->setModal(true);
}
} else {
box_widget->setMinimumSize(window_width, window_height);
} }
*sts = XNAV__SUCCESS; *sts = XNAV__SUCCESS;
...@@ -969,26 +848,17 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx, ...@@ -969,26 +848,17 @@ XttMultiViewQt::XttMultiViewQt(QWidget* mv_parent_wid, void* mv_parent_ctx,
void* XttMultiViewQt::get_widget() void* XttMultiViewQt::get_widget()
{ {
if (!(options & ge_mOptions_Embedded)) { return toplevel;
return toplevel;
} else {
return box_widget;
}
} }
int XttMultiViewQt::set_subwindow_source(const char* name, char* source, int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
char* object, double* borders, int insert, int cont) char* object, double* borders, int insert, int cont)
{ {
pwr_sClass_XttMultiView mv; pwr_sClass_XttMultiView mv;
pwr_tStatus sts;
int x, y, w, h;
int scrollbar;
int menu;
int type;
char comp_name[80]; char comp_name[80];
char* sub_name; char* sub_name;
sts = gdh_GetObjectInfoAttrref(&aref, &mv, sizeof(mv)); pwr_tStatus sts = gdh_GetObjectInfoAttrref(&aref, &mv, sizeof(mv));
if (EVEN(sts)) { if (EVEN(sts)) {
return sts; return sts;
} }
...@@ -1006,19 +876,17 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1006,19 +876,17 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
if (str_NoCaseStrcmp(comp_name, mv.Action[i * rows + j].Name) == 0) { if (str_NoCaseStrcmp(comp_name, mv.Action[i * rows + j].Name) == 0) {
if (!sub_name) { if (!sub_name) {
// Replace component // Replace component
x = 0; int w = mv.Action[i * rows + j].Width;
y = 0; int h = mv.Action[i * rows + j].Height;
w = mv.Action[i * rows + j].Width; int scrollbar = (mv.Action[i * rows + j].Options
h = mv.Action[i * rows + j].Height;
scrollbar = (mv.Action[i * rows + j].Options
& pwr_mMultiViewElemOptionsMask_Scrollbars) & pwr_mMultiViewElemOptionsMask_Scrollbars)
? 1 ? 1
: 0; : 0;
menu = (mv.Action[i * rows + j].Options int menu = (mv.Action[i * rows + j].Options
& pwr_mMultiViewElemOptionsMask_Menu) & pwr_mMultiViewElemOptionsMask_Menu)
? 1 ? 1
: 0; : 0;
type = mv.Action[i * rows + j].Type; int type = mv.Action[i * rows + j].Type;
if (!(mv.Action[i * rows + j].Options if (!(mv.Action[i * rows + j].Options
& pwr_mMultiViewElemOptionsMask_Exchangeable)) { & pwr_mMultiViewElemOptionsMask_Exchangeable)) {
...@@ -1029,7 +897,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1029,7 +897,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
case pwr_eMultiViewContentEnum_Graph: case pwr_eMultiViewContentEnum_Graph:
case pwr_eMultiViewContentEnum_ObjectGraph: { case pwr_eMultiViewContentEnum_ObjectGraph: {
XttGeQt* ctx = new XttGeQt(toplevel, toplevel, "No title", source, XttGeQt* ctx = new XttGeQt(toplevel, toplevel, "No title", source,
scrollbar, menu, 0, w, h, x, y, 1.0, object, 0, 0, scrollbar, menu, 0, w, h, 0, 0, 1.0, object, 0, 0,
ge_mOptions_Embedded, 0, borders, color_theme, ge_mOptions_Embedded, 0, borders, color_theme,
multiview_ge_command_cb, multiview_ge_get_current_objects_cb, multiview_ge_command_cb, multiview_ge_get_current_objects_cb,
multiview_ge_is_authorized_cb, multiview_keyboard_cb); multiview_ge_is_authorized_cb, multiview_keyboard_cb);
...@@ -1071,7 +939,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1071,7 +939,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
} }
XttMultiViewQt* ctx = new XttMultiViewQt(toplevel, this, "No title", XttMultiViewQt* ctx = new XttMultiViewQt(toplevel, this, "No title",
&source_aref, w, h, x, y, ge_mOptions_Embedded, 0, color_theme, &source_aref, w, h, 0, 0, ge_mOptions_Embedded, 0, color_theme,
&sts, multiview_ge_command_cb, &sts, multiview_ge_command_cb,
multiview_ge_get_current_objects_cb, multiview_ge_get_current_objects_cb,
multiview_ge_is_authorized_cb, multiview_keyboard_cb); multiview_ge_is_authorized_cb, multiview_keyboard_cb);
...@@ -1106,12 +974,9 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1106,12 +974,9 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
break; break;
} }
case pwr_eMultiViewContentEnum_TrendCurve: { case pwr_eMultiViewContentEnum_TrendCurve: {
int plotgroup_found = 0;
pwr_tAttrRef plotgroup;
pwr_tCid classid; pwr_tCid classid;
QWidget* comp_w; QWidget* comp_w;
pwr_tAttrRef arefv[2]; pwr_tAttrRef arefv[2];
int skip = 0;
pwr_tStatus lsts; pwr_tStatus lsts;
pwr_tAttrRef object_aref; pwr_tAttrRef object_aref;
...@@ -1125,34 +990,20 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1125,34 +990,20 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
break; break;
} }
switch (classid) {
case pwr_cClass_DsTrend:
case pwr_cClass_DsTrendCurve:
break;
case pwr_cClass_PlotGroup:
plotgroup_found = 1;
plotgroup = object_aref;
arefv[0] = plotgroup;
break;
default:
skip = 1;
}
if (skip) {
break;
}
XttTrendQt* ctx; XttTrendQt* ctx;
if (plotgroup_found) { if (classid == pwr_cClass_PlotGroup) {
arefv[0] = object_aref;
ctx = new XttTrendQt(this, toplevel, (char*)"No title", &comp_w, ctx = new XttTrendQt(this, toplevel, (char*)"No title", &comp_w,
0, &plotgroup, w, h, (unsigned int)curve_mOptions_Embedded, 0, &(arefv[0]), w, h, (unsigned int)curve_mOptions_Embedded,
color_theme, 0, &lsts); color_theme, 0, &lsts);
} else { } else if (classid == pwr_cClass_DsTrend || classid == pwr_cClass_DsTrendCurve) {
arefv[0] = object_aref; arefv[0] = object_aref;
memset(&arefv[1], 0, sizeof(arefv[0])); memset(&arefv[1], 0, sizeof(arefv[0]));
ctx = new XttTrendQt(this, toplevel, (char*)"No title", &comp_w, ctx = new XttTrendQt(this, toplevel, (char*)"No title", &comp_w,
arefv, 0, w, h, (unsigned int)curve_mOptions_Embedded, arefv, 0, w, h, (unsigned int)curve_mOptions_Embedded,
color_theme, 0, &lsts); color_theme, 0, &lsts);
} else {
break;
} }
if (EVEN(lsts)) { if (EVEN(lsts)) {
break; break;
...@@ -1193,15 +1044,11 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1193,15 +1044,11 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
pwr_tAttrRef attr_aref, sevhist_aref; pwr_tAttrRef attr_aref, sevhist_aref;
char* s; char* s;
pwr_tAName aname; pwr_tAName aname;
int plotgroup_found = 0;
int sevHistObjectFound = 0;
int oid_cnt = 0; int oid_cnt = 0;
pwr_tCid classid; pwr_tCid classid;
int skip = 0;
pwr_tStatus lsts; pwr_tStatus lsts;
QWidget* comp_w; QWidget* comp_w;
pwr_tAttrRef arefv[2]; pwr_tAttrRef arefv[2];
pwr_tAttrRef plotgroup;
pwr_tAttrRef object_aref; pwr_tAttrRef object_aref;
lsts = gdh_NameToAttrref(pwr_cNObjid, object, &object_aref); lsts = gdh_NameToAttrref(pwr_cNObjid, object, &object_aref);
...@@ -1217,35 +1064,16 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1217,35 +1064,16 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
break; break;
}; };
switch (classid) { if (classid == pwr_cClass_PlotGroup) {
case pwr_cClass_SevHist:
break;
case pwr_cClass_SevHistObject:
sevHistObjectFound = true;
break;
case pwr_cClass_PlotGroup:
plotgroup = object_aref;
plotgroup_found = 1;
break;
default:
skip = 1;
}
if (skip) {
break;
}
if (plotgroup_found) {
pwr_sClass_PlotGroup plot; pwr_sClass_PlotGroup plot;
pwr_tCid cid; pwr_tCid cid;
int j;
lsts = gdh_GetObjectInfoAttrref(&plotgroup, &plot, sizeof(plot)); lsts = gdh_GetObjectInfoAttrref(&object_aref, &plot, sizeof(plot));
if (EVEN(lsts)) { if (EVEN(lsts)) {
break; break;
} }
for (j = 0; j < 20; j++) { for (int j = 0; j < 20; j++) {
if (cdh_ObjidIsNull(plot.YObjectName[j].Objid)) { if (cdh_ObjidIsNull(plot.YObjectName[j].Objid)) {
break; break;
} }
...@@ -1319,7 +1147,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1319,7 +1147,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
oid_cnt++; oid_cnt++;
} }
} }
} else if (sevHistObjectFound) { } else if (classid == pwr_cClass_SevHistObject) {
lsts = gdh_ArefANameToAref(&object_aref, "Object", &attr_aref); lsts = gdh_ArefANameToAref(&object_aref, "Object", &attr_aref);
if (EVEN(lsts)) { if (EVEN(lsts)) {
break; break;
...@@ -1349,7 +1177,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1349,7 +1177,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
strcpy(onamev[oid_cnt], ""); strcpy(onamev[oid_cnt], "");
sevhist_aref = object_aref; sevhist_aref = object_aref;
oid_cnt = 1; oid_cnt = 1;
} else { } else if (classid == pwr_cClass_SevHist) {
lsts = gdh_ArefANameToAref(&object_aref, "Attribute", &attr_aref); lsts = gdh_ArefANameToAref(&object_aref, "Attribute", &attr_aref);
if (EVEN(lsts)) { if (EVEN(lsts)) {
break; break;
...@@ -1379,6 +1207,8 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1379,6 +1207,8 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
sevhistobjectv[0] = false; sevhistobjectv[0] = false;
oid_cnt = 1; oid_cnt = 1;
sevhist_aref = object_aref; sevhist_aref = object_aref;
} else {
break;
} }
oidv[oid_cnt] = pwr_cNOid; oidv[oid_cnt] = pwr_cNOid;
...@@ -1461,7 +1291,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1461,7 +1291,7 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
} }
} else { } else {
// Call set_window in component // Call set_window in component
type = mv.Action[i * rows + j].Type; int type = mv.Action[i * rows + j].Type;
switch (type) { switch (type) {
case pwr_eMultiViewContentEnum_Graph: case pwr_eMultiViewContentEnum_Graph:
...@@ -1488,16 +1318,14 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source, ...@@ -1488,16 +1318,14 @@ int XttMultiViewQt::set_subwindow_source(const char* name, char* source,
int XttMultiViewQt::key_pressed(int key) int XttMultiViewQt::key_pressed(int key)
{ {
int sts;
for (int i = 0; i < cols * rows; i++) { for (int i = 0; i < cols * rows; i++) {
if (gectx[i] != 0) { if (gectx[i] != 0) {
sts = gectx[i]->key_pressed(key); int sts = gectx[i]->key_pressed(key);
if (ODD(sts)) { if (ODD(sts)) {
return sts; return sts;
} }
} else if (mvctx[i] != 0) { } else if (mvctx[i] != 0) {
sts = mvctx[i]->key_pressed(key); int sts = mvctx[i]->key_pressed(key);
if (ODD(sts)) { if (ODD(sts)) {
return sts; return sts;
} }
...@@ -1520,9 +1348,7 @@ void XttMultiViewQt::close_input_all() ...@@ -1520,9 +1348,7 @@ void XttMultiViewQt::close_input_all()
void XttMultiViewQt::signal_send(char* signalname) void XttMultiViewQt::signal_send(char* signalname)
{ {
pwr_sClass_XttMultiView mv; pwr_sClass_XttMultiView mv;
pwr_tStatus sts; pwr_tStatus sts = gdh_GetObjectInfoAttrref(&aref, &mv, sizeof(mv));
sts = gdh_GetObjectInfoAttrref(&aref, &mv, sizeof(mv));
if (EVEN(sts)) { if (EVEN(sts)) {
return; return;
} }
......
...@@ -57,8 +57,6 @@ public: ...@@ -57,8 +57,6 @@ public:
QWidget* comp_widget[MV_SIZE]; QWidget* comp_widget[MV_SIZE];
QWidget* exchange_widget[MV_SIZE]; QWidget* exchange_widget[MV_SIZE];
QHBoxLayout* exchange_widget_layout[MV_SIZE]; QHBoxLayout* exchange_widget_layout[MV_SIZE];
QWidget* box_widget;
QWidget* col_widget;
XttGeQt* gectx[MV_SIZE]; XttGeQt* gectx[MV_SIZE];
XttMultiViewQt* mvctx[MV_SIZE]; XttMultiViewQt* mvctx[MV_SIZE];
EvAlaQt* sala[MV_SIZE]; EvAlaQt* sala[MV_SIZE];
...@@ -95,15 +93,13 @@ private: ...@@ -95,15 +93,13 @@ private:
XttMultiViewQtWidget* toplevel; XttMultiViewQtWidget* toplevel;
}; };
class XttMultiViewQtWidget : public QDialog { class XttMultiViewQtWidget : public QWidget {
public: public:
XttMultiViewQtWidget(XttMultiViewQt* parent_ctx, QWidget* parent) XttMultiViewQtWidget(XttMultiViewQt* parent_ctx, QWidget* parent)
: QDialog(parent), multiview(parent_ctx) : QWidget(parent), multiview(parent_ctx)
{ {
} }
void resize(int width, int height);
protected: protected:
void focusInEvent(QFocusEvent* event); void focusInEvent(QFocusEvent* event);
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);
......
...@@ -203,6 +203,13 @@ void XttStreamQtWidget::resizeEvent(QResizeEvent* event) ...@@ -203,6 +203,13 @@ void XttStreamQtWidget::resizeEvent(QResizeEvent* event)
} }
} }
void XttStreamQt::hidePtz()
{
if (ptz_box != NULL) {
ptz_box->setVisible(false);
}
}
void XttStreamQtWidget::mousePressEvent(QMouseEvent* event) void XttStreamQtWidget::mousePressEvent(QMouseEvent* event)
{ {
switch (event->button()) { switch (event->button()) {
...@@ -215,7 +222,7 @@ void XttStreamQtWidget::mousePressEvent(QMouseEvent* event) ...@@ -215,7 +222,7 @@ void XttStreamQtWidget::mousePressEvent(QMouseEvent* event)
int x = event->globalPos().x() + 8; int x = event->globalPos().x() + 8;
int y = event->globalPos().y(); int y = event->globalPos().y();
stream->action_mb3click(x, y); stream->action_mb3click(x, y);
stream->ptz_box->setVisible(false); stream->hidePtz();
break; break;
} }
default: default:
...@@ -259,7 +266,7 @@ void XttStreamQtWidget::mouseReleaseEvent(QMouseEvent* event) ...@@ -259,7 +266,7 @@ void XttStreamQtWidget::mouseReleaseEvent(QMouseEvent* event)
&& ABS(event->pos().y() - stream->mb_press_y) < 10) { && ABS(event->pos().y() - stream->mb_press_y) < 10) {
stream->action_click( stream->action_click(
event->pos().x() - offset_x, event->pos().y() - offset_y); event->pos().x() - offset_x, event->pos().y() - offset_y);
stream->ptz_box->setVisible(false); stream->hidePtz();
} else if (ABS(event->pos().x() - stream->mb_press_x) > 20 } else if (ABS(event->pos().x() - stream->mb_press_x) > 20
&& abs(event->pos().y() - stream->mb_press_y) > 20) { && abs(event->pos().y() - stream->mb_press_y) > 20) {
int x = MIN(event->pos().x(), stream->mb_press_x) - offset_x; int x = MIN(event->pos().x(), stream->mb_press_x) - offset_x;
...@@ -268,7 +275,7 @@ void XttStreamQtWidget::mouseReleaseEvent(QMouseEvent* event) ...@@ -268,7 +275,7 @@ void XttStreamQtWidget::mouseReleaseEvent(QMouseEvent* event)
int h = ABS(event->pos().y() - stream->mb_press_y); int h = ABS(event->pos().y() - stream->mb_press_y);
printf("Mb zoom (%d,%d) rect %d,%d\n", x, y, w, h); printf("Mb zoom (%d,%d) rect %d,%d\n", x, y, w, h);
stream->action_areaselect(x, y, w, h); stream->action_areaselect(x, y, w, h);
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
break; break;
} }
...@@ -318,12 +325,12 @@ void XttStreamQtWidget::wheelEvent(QWheelEvent* event) ...@@ -318,12 +325,12 @@ void XttStreamQtWidget::wheelEvent(QWheelEvent* event)
void XttStreamQt::scroll_cb(void* data) void XttStreamQt::scroll_cb(void* data)
{ {
XttStreamQt* strm = (XttStreamQt*)data; XttStreamQt* stream = (XttStreamQt*)data;
strm->action_scroll( stream->action_scroll(
strm->scroll_direction, strm->scroll_x, strm->scroll_y, strm->scroll_cnt); stream->scroll_direction, stream->scroll_x, stream->scroll_y, stream->scroll_cnt);
strm->scroll_cnt = 0; stream->scroll_cnt = 0;
strm->ptz_box->setVisible(false); stream->hidePtz();
} }
XttStreamQt::XttStreamQt(QWidget* st_parent_wid, void* st_parent_ctx, XttStreamQt::XttStreamQt(QWidget* st_parent_wid, void* st_parent_ctx,
...@@ -519,8 +526,8 @@ XttStreamQt::XttStreamQt(QWidget* st_parent_wid, void* st_parent_ctx, ...@@ -519,8 +526,8 @@ XttStreamQt::XttStreamQt(QWidget* st_parent_wid, void* st_parent_ctx,
} }
toplevel->setLayout(main_layout); toplevel->setLayout(main_layout);
toplevel->setMinimumSize(width, height);
if (!embedded) { if (!embedded) {
toplevel->setMinimumSize(width, height);
toplevel->show(); toplevel->show();
if (options & strm_mOptions_FullScreen) { if (options & strm_mOptions_FullScreen) {
...@@ -604,7 +611,7 @@ void XttStreamQtWidget::zoom_helper() ...@@ -604,7 +611,7 @@ void XttStreamQtWidget::zoom_helper()
} else { } else {
stream->camera_control->zoom_relative(value); stream->camera_control->zoom_relative(value);
} }
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
void XttStreamQtWidget::pan_helper() void XttStreamQtWidget::pan_helper()
...@@ -616,7 +623,7 @@ void XttStreamQtWidget::pan_helper() ...@@ -616,7 +623,7 @@ void XttStreamQtWidget::pan_helper()
int value = ((QAction *) sender())->data().toInt(); int value = ((QAction *) sender())->data().toInt();
stream->camera_control->pan_relative(value); stream->camera_control->pan_relative(value);
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
void XttStreamQtWidget::tilt_helper() void XttStreamQtWidget::tilt_helper()
...@@ -628,21 +635,21 @@ void XttStreamQtWidget::tilt_helper() ...@@ -628,21 +635,21 @@ void XttStreamQtWidget::tilt_helper()
int value = ((QAction *) sender())->data().toInt(); int value = ((QAction *) sender())->data().toInt();
stream->camera_control->tilt_relative(value); stream->camera_control->tilt_relative(value);
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
void XttStreamQtWidget::activate_preset_position() void XttStreamQtWidget::activate_preset_position()
{ {
int idx = ((QAction*)sender())->data().toInt(); int idx = ((QAction*)sender())->data().toInt();
stream->activate_preset_position(idx); stream->activate_preset_position(idx);
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
void XttStreamQtWidget::activate_preset_store_pos() void XttStreamQtWidget::activate_preset_store_pos()
{ {
int idx = ((QAction*)sender())->data().toInt(); int idx = ((QAction*)sender())->data().toInt();
stream->activate_preset_store_pos(idx); stream->activate_preset_store_pos(idx);
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
void XttStreamQtWidget::activate_get_position() void XttStreamQtWidget::activate_get_position()
...@@ -664,5 +671,5 @@ void XttStreamQtWidget::activate_get_position() ...@@ -664,5 +671,5 @@ void XttStreamQtWidget::activate_get_position()
stream->ptz_pan->setText(pan_str); stream->ptz_pan->setText(pan_str);
stream->ptz_tilt->setText(tilt_str); stream->ptz_tilt->setText(tilt_str);
stream->ptz_zoom->setText(zoom_str); stream->ptz_zoom->setText(zoom_str);
stream->ptz_box->setVisible(false); stream->hidePtz();
} }
\ No newline at end of file
...@@ -79,6 +79,7 @@ public: ...@@ -79,6 +79,7 @@ public:
void pop(); void pop();
void set_size(int width, int height); void set_size(int width, int height);
void hidePtz();
void* get_widget() void* get_widget()
{ {
......
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