CurvesDialog::CurvesDialog( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ) { setName( "CurvesDialog" ); setWindowTitle( tr( "QtiPlot - Add/Remove curves" ) ); setSizeGripEnabled(true); setFocus(); QHBoxLayout *hl = new QHBoxLayout(); hl->addWidget(new QLabel(tr("New curves style"))); boxStyle = new QComboBox(); boxStyle->addItem( QPixmap(lPlot_xpm), tr( " Line" ) ); boxStyle->addItem( QPixmap(pPlot_xpm), tr( " Scatter" ) ); boxStyle->addItem( QPixmap(lpPlot_xpm), tr( " Line + Symbol" ) ); boxStyle->addItem( QPixmap(dropLines_xpm), tr( " Vertical drop lines" ) ); boxStyle->addItem( QPixmap(spline_xpm), tr( " Spline" ) ); boxStyle->addItem( QPixmap(vert_steps_xpm), tr( " Vertical steps" ) ); boxStyle->addItem( QPixmap(hor_steps_xpm), tr( " Horizontal steps" ) ); boxStyle->addItem( QPixmap(area_xpm), tr( " Area" ) ); boxStyle->addItem( QPixmap(vertBars_xpm), tr( " Vertical Bars" ) ); boxStyle->addItem( QPixmap(hBars_xpm), tr( " Horizontal Bars" ) ); boxStyle->addItem( QPixmap(histogram_xpm), tr( " Histogram" ) ); hl->addWidget(boxStyle); boxMatrixStyle = new QComboBox(); boxMatrixStyle->addItem( QPixmap(color_map_xpm), tr("Contour - Color Fill")); boxMatrixStyle->addItem( QPixmap(contour_map_xpm), tr("Contour Lines")); boxMatrixStyle->addItem( QPixmap(gray_map_xpm), tr("Gray Scale Map")); boxMatrixStyle->addItem( QPixmap(histogram_xpm), tr("Histogram")); hl->addWidget(boxMatrixStyle); hl->addStretch(); QGridLayout *gl = new QGridLayout(); gl->addWidget(new QLabel( tr( "Available data" )), 0, 0); QHBoxLayout *hbc = new QHBoxLayout; hbc->addWidget(new QLabel( tr( "Graph contents" ))); btnUp = new QPushButton(); btnUp->setIcon(QPixmap(arrow_up_xpm)); btnUp->setMaximumWidth(20); hbc->addWidget(btnUp); btnDown = new QPushButton(); btnDown->setIcon(QPixmap(arrow_down_xpm)); btnDown->setMaximumWidth(20); hbc->addWidget(btnDown); hbc->addStretch(); gl->addLayout(hbc, 0, 2); available = new QTreeWidget(); available->setColumnCount(1); available->header()->hide(); available->setIndentation(15); available->setSelectionMode (QAbstractItemView::ExtendedSelection); gl->addWidget(available, 1, 0); QVBoxLayout* vl1 = new QVBoxLayout(); btnAdd = new QPushButton(); btnAdd->setPixmap( QPixmap(next_xpm) ); btnAdd->setFixedWidth (35); btnAdd->setFixedHeight (30); vl1->addWidget(btnAdd); btnRemove = new QPushButton(); btnRemove->setPixmap( QPixmap(prev_xpm) ); btnRemove->setFixedWidth (35); btnRemove->setFixedHeight(30); vl1->addWidget(btnRemove); vl1->addStretch(); gl->addLayout(vl1, 1, 1); contents = new QListWidget(); contents->setSelectionMode (QAbstractItemView::ExtendedSelection); gl->addWidget(contents, 1, 2); QVBoxLayout* vl2 = new QVBoxLayout(); btnAssociations = new QPushButton(tr( "&Plot Associations..." )); btnAssociations->setEnabled(false); vl2->addWidget(btnAssociations); btnRange = new QPushButton(tr( "Edit &Range..." )); btnRange->setEnabled(false); vl2->addWidget(btnRange); btnEditFunction = new QPushButton(tr( "&Edit Function..." )); btnEditFunction->setEnabled(false); vl2->addWidget(btnEditFunction); btnOK = new QPushButton(tr( "OK" )); btnOK->setDefault( true ); vl2->addWidget(btnOK); btnCancel = new QPushButton(tr( "Close" )); vl2->addWidget(btnCancel); boxShowRange = new QCheckBox(tr( "&Show Range" )); vl2->addWidget(boxShowRange); vl2->addStretch(); gl->addLayout(vl2, 1, 3); QVBoxLayout* vl3 = new QVBoxLayout(this); vl3->addLayout(hl); vl3->addLayout(gl); boxShowCurrentFolder = new QCheckBox(tr("Show current &folder only" )); vl3->addWidget(boxShowCurrentFolder); init(); connect(btnUp, SIGNAL(clicked()),this, SLOT(raiseCurve())); connect(btnDown, SIGNAL(clicked()),this, SLOT(shiftCurveBy())); connect(boxShowCurrentFolder, SIGNAL(toggled(bool)), this, SLOT(showCurrentFolder(bool))); connect(boxShowRange, SIGNAL(toggled(bool)), this, SLOT(showCurveRange(bool))); connect(btnRange, SIGNAL(clicked()),this, SLOT(showCurveRangeDialog())); connect(btnAssociations, SIGNAL(clicked()),this, SLOT(showPlotAssociations())); connect(btnEditFunction, SIGNAL(clicked()),this, SLOT(showFunctionDialog())); connect(btnAdd, SIGNAL(clicked()),this, SLOT(addCurves())); connect(btnRemove, SIGNAL(clicked()),this, SLOT(removeCurves())); connect(btnOK, SIGNAL(clicked()),this, SLOT(close())); connect(btnCancel, SIGNAL(clicked()),this, SLOT(close())); connect(contents, SIGNAL(currentRowChanged(int)), this, SLOT(showCurveBtn(int))); connect(contents, SIGNAL(itemSelectionChanged()), this, SLOT(enableContentsBtns())); connect(available, SIGNAL(itemSelectionChanged()), this, SLOT(enableAddBtn())); QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this); connect(shortcut, SIGNAL(activated()), this, SLOT(removeCurves())); shortcut = new QShortcut(QKeySequence("-"), this); connect(shortcut, SIGNAL(activated()), this, SLOT(removeCurves())); shortcut = new QShortcut(QKeySequence("+"), this); connect(shortcut, SIGNAL(activated()), this, SLOT(addCurves())); }
CurvesDialog::CurvesDialog( ApplicationWindow* app, Graph* g, Qt::WFlags fl ) : QDialog( g, fl ), d_app(app), d_graph(g) { setName( "CurvesDialog" ); setWindowTitle( tr( "MantidPlot - Add/Remove curves" ) ); setSizeGripEnabled(true); setFocus(); QHBoxLayout *hl = new QHBoxLayout(); hl->addWidget(new QLabel(tr("New curves style"))); boxStyle = new QComboBox(); boxStyle->addItem( getQPixmap("lPlot_xpm"), tr( " Line" ) ); boxStyle->addItem( getQPixmap("pPlot_xpm"), tr( " Scatter" ) ); boxStyle->addItem( getQPixmap("lpPlot_xpm"), tr( " Line + Symbol" ) ); boxStyle->addItem( getQPixmap("dropLines_xpm"), tr( " Vertical drop lines" ) ); boxStyle->addItem( getQPixmap("spline_xpm"), tr( " Spline" ) ); boxStyle->addItem( getQPixmap("hor_steps_xpm"), tr( " Horizontal steps" ) ); boxStyle->addItem( getQPixmap("vert_steps_xpm"), tr( " Vertical steps" ) ); boxStyle->addItem( getQPixmap("area_xpm"), tr( " Area" ) ); boxStyle->addItem( getQPixmap("vertBars_xpm"), tr( " Vertical Bars" ) ); boxStyle->addItem( getQPixmap("hBars_xpm"), tr( " Horizontal Bars" ) ); hl->addWidget(boxStyle); boxMatrixStyle = new QComboBox(); boxMatrixStyle->addItem( getQPixmap("color_map_xpm"), tr("Contour - Color Fill")); boxMatrixStyle->addItem( getQPixmap("contour_map_xpm"), tr("Contour Lines")); boxMatrixStyle->addItem( getQPixmap("gray_map_xpm"), tr("Gray Scale Map")); boxMatrixStyle->addItem( getQPixmap("histogram_xpm"), tr("Histogram")); boxMatrixStyle->hide(); hl->addWidget(boxMatrixStyle); hl->addStretch(); QGridLayout *gl = new QGridLayout(); gl->addWidget(new QLabel( tr( "Available data" )), 0, 0); gl->addWidget(new QLabel( tr( "Graph contents" )), 0, 2); available = new QListWidget(); available->setSelectionMode (QAbstractItemView::ExtendedSelection); gl->addWidget(available, 1, 0); QVBoxLayout* vl1 = new QVBoxLayout(); btnAdd = new QPushButton(); btnAdd->setPixmap( getQPixmap("next_xpm") ); btnAdd->setFixedWidth (35); btnAdd->setFixedHeight (30); vl1->addWidget(btnAdd); btnRemove = new QPushButton(); btnRemove->setPixmap( getQPixmap("prev_xpm") ); btnRemove->setFixedWidth (35); btnRemove->setFixedHeight(30); vl1->addWidget(btnRemove); vl1->addStretch(); gl->addLayout(vl1, 1, 1); contents = new QListWidget(); contents->setSelectionMode (QAbstractItemView::ExtendedSelection); gl->addWidget(contents, 1, 2); QVBoxLayout* vl2 = new QVBoxLayout(); btnAssociations = new QPushButton(tr( "&Plot Associations..." )); btnAssociations->setEnabled(false); vl2->addWidget(btnAssociations); btnRange = new QPushButton(tr( "Edit &Range..." )); btnRange->setEnabled(false); vl2->addWidget(btnRange); btnEditFunction = new QPushButton(tr( "&Edit Function..." )); btnEditFunction->setEnabled(false); vl2->addWidget(btnEditFunction); btnOK = new QPushButton(tr( "OK" )); btnOK->setDefault( true ); vl2->addWidget(btnOK); btnCancel = new QPushButton(tr( "Close" )); vl2->addWidget(btnCancel); boxShowRange = new QCheckBox(tr( "&Show Range" )); vl2->addWidget(boxShowRange); vl2->addStretch(); gl->addLayout(vl2, 1, 3); QVBoxLayout* vl3 = new QVBoxLayout(this); vl3->addLayout(hl); vl3->addLayout(gl); boxShowCurrentFolder = new QCheckBox(tr("Show current &folder only" )); vl3->addWidget(boxShowCurrentFolder); init(); connect(boxShowCurrentFolder, SIGNAL(toggled(bool)), this, SLOT(showCurrentFolder(bool))); connect(boxShowRange, SIGNAL(toggled(bool)), this, SLOT(showCurveRange(bool))); connect(btnRange, SIGNAL(clicked()),this, SLOT(showCurveRangeDialog())); connect(btnAssociations, SIGNAL(clicked()),this, SLOT(showPlotAssociations())); connect(btnEditFunction, SIGNAL(clicked()),this, SLOT(showFunctionDialog())); connect(btnAdd, SIGNAL(clicked()),this, SLOT(addCurves())); connect(btnRemove, SIGNAL(clicked()),this, SLOT(removeCurves())); connect(btnOK, SIGNAL(clicked()),this, SLOT(close())); connect(btnCancel, SIGNAL(clicked()),this, SLOT(close())); connect(contents, SIGNAL(currentRowChanged(int)), this, SLOT(showCurveBtn(int))); connect(contents, SIGNAL(itemSelectionChanged()), this, SLOT(enableRemoveBtn())); connect(available, SIGNAL(itemSelectionChanged()), this, SLOT(enableAddBtn())); QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this); connect(shortcut, SIGNAL(activated()), this, SLOT(removeCurves())); shortcut = new QShortcut(QKeySequence("-"), this); connect(shortcut, SIGNAL(activated()), this, SLOT(removeCurves())); shortcut = new QShortcut(QKeySequence("+"), this); connect(shortcut, SIGNAL(activated()), this, SLOT(addCurves())); setGraph(g); }