PhoneBook::PhoneBook(QWidget *parent) : QMainWindow(parent) { QWidget *centralWidget = new QWidget(this); m_editorPage = new ContactEditor(centralWidget); connect(m_editorPage, SIGNAL(showListPage()), this, SLOT(activateList())); m_filterPage = new FilterPage(centralWidget); connect(m_filterPage, SIGNAL(showListPage(QContactFilter)), this, SLOT(activateList(QContactFilter))); m_listPage = new ContactListPage(this, centralWidget); connect(m_listPage, SIGNAL(showEditorPage(QContactLocalId)), this, SLOT(activateEditor(QContactLocalId))); connect(m_listPage, SIGNAL(showFilterPage(QContactFilter)), this, SLOT(activateFind())); connect(m_listPage, SIGNAL(managerChanged(QContactManager*)), this, SLOT(managerChanged(QContactManager*))); connect(m_listPage, SIGNAL(clearFilter()), m_filterPage, SLOT(clearFilter())); m_stackedWidget = new QStackedWidget(centralWidget); m_stackedWidget->addWidget(m_listPage); m_stackedWidget->addWidget(m_editorPage); m_stackedWidget->addWidget(m_filterPage); m_stackedWidget->setCurrentIndex(0); QVBoxLayout *centralLayout = new QVBoxLayout; centralLayout->addWidget(m_stackedWidget); centralWidget->setLayout(centralLayout); setCentralWidget(centralWidget); }
SmartAttributeEditorManager::SmartAttributeEditorManager(wxWindow* parent, View::MapDocumentWPtr document) : wxPanel(parent), m_document(document), m_name("") { createEditors(); activateEditor(defaultEditor(), ""); bindObservers(); }
void SmartAttributeEditorManager::switchEditor(const Model::AttributeName& name, const Model::AttributableNodeList& attributables) { EditorPtr editor = selectEditor(name, attributables); activateEditor(editor, name); updateEditor(); }
void TrackEditorTool::initToolWidget() { // prototypeListWidget->setMaximumWidth(156); QGridLayout *toolLayout = new QGridLayout; // ButtonGroup // // // A button group so only one button can be checked at a time QButtonGroup *toolGroup = new QButtonGroup; connect(toolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int))); // Tools // // QPushButton *toolButton; int row = -1; // button row QLabel *trackLabel = new QLabel(tr("Track Tools")); toolLayout->addWidget(trackLabel, ++row, 0, 1, ColumnCount); // toolButton = new QPushButton("Select"); // toolButton->setCheckable(true); // toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); // toolGroup->addButton(toolButton, ODD::TTE_SELECT); // button, id toolButton = new QPushButton("Move Rotate"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TTE_MOVE_ROTATE); // button, id toolButton = new QPushButton("Add Line"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TTE_ADD_LINE); // button, id toolButton = new QPushButton("Add Curve"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, row, 1); toolGroup->addButton(toolButton, ODD::TTE_ADD_CURVE); // button, id // toolButton->setChecked(true); toolButton = new QPushButton("Add Prototype"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_ADD); // button, id toolButton = new QPushButton("Delete Tracks"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_DELETE); // button, id toolButton = new QPushButton("Split Track"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_TRACK_SPLIT); // button, id QFrame *line = new QFrame(); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setLineWidth(1); toolLayout->addWidget(line, ++row, 0, 1, ColumnCount); QLabel *roadLabel = new QLabel(tr("Road Tools")); toolLayout->addWidget(roadLabel, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Move Rotate"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TTE_ROAD_MOVE_ROTATE); // button, id toolButton = new QPushButton("New Road"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_ROAD_NEW); // button, id toolButton = new QPushButton("Add Prototype"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_ROADSYSTEM_ADD); // button, id toolButton = new QPushButton("Delete Road"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_ROAD_DELETE); // button, id toolButton = new QPushButton("Split Road"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_ROAD_SPLIT); // button, id toolButton = new QPushButton("Merge"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TTE_ROAD_MERGE); // button, id toolButton = new QPushButton("Snap to"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, row, 1); toolGroup->addButton(toolButton, ODD::TTE_ROAD_SNAP); // button, id line = new QFrame(); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setLineWidth(1); toolLayout->addWidget(line, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Split Track and Road"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_TRACK_ROAD_SPLIT); // button, id // Tiles // line = new QFrame(); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setLineWidth(1); toolLayout->addWidget(line, ++row, 0, 1, ColumnCount); roadLabel = new QLabel(tr("Tile Tools")); toolLayout->addWidget(roadLabel, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Move Tile"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TTE_TILE_MOVE); // button, id toolButton = new QPushButton("New Tile"); toolButton->setCheckable(false); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_TILE_NEW); // button, id toolButton = new QPushButton("Delete Tile"); toolButton->setCheckable(false); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TTE_TILE_DELETE); // button, id // Prototypes // // // QGridLayout *groupBoxLayout; QLabel *label; QComboBox *comboBox; // Track Prototypes // // // groupBoxLayout = new QGridLayout; trackPrototypesGroupBox_ = new QGroupBox(tr("Track Settings")); trackPrototypesGroupBox_->setLayout(groupBoxLayout); trackPrototypesGroupBox_->setEnabled(false); toolLayout->addWidget(trackPrototypesGroupBox_, ++row, 0, 1, ColumnCount); label = new QLabel(tr("Track Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_TrackPrototype)) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleTrackSelection(int))); comboBox->setCurrentIndex(0); // this doesn't trigger an event... handleTrackSelection(0); // ... so do it yourself groupBoxLayout->addWidget(label, 0, 0); groupBoxLayout->addWidget(comboBox, 1, 0); // Section Prototypes // // // groupBoxLayout = new QGridLayout; sectionPrototypesGroupBox_ = new QGroupBox(tr("Section Settings")); sectionPrototypesGroupBox_->setLayout(groupBoxLayout); sectionPrototypesGroupBox_->setEnabled(false); toolLayout->addWidget(sectionPrototypesGroupBox_, ++row, 0, 1, ColumnCount); int groupBoxLayoutRow = 0; // LaneSection Prototype // // label = new QLabel(tr("LaneSection Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_LaneSectionPrototype)) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleLaneSectionSelection(int))); comboBox->setCurrentIndex(0); handleLaneSectionSelection(0); groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0); groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0); // RoadType Prototype // // label = new QLabel(tr("RoadType Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_RoadTypePrototype)) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleRoadTypeSelection(int))); comboBox->setCurrentIndex(0); handleRoadTypeSelection(0); groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0); groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0); // Elevation Prototype // // label = new QLabel(tr("Elevation Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_ElevationPrototype)) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleElevationSelection(int))); comboBox->setCurrentIndex(0); handleElevationSelection(0); groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0); groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0); // Superelevation Prototype // // label = new QLabel(tr("Superelevation Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_SuperelevationPrototype)) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSuperelevationSelection(int))); comboBox->setCurrentIndex(0); handleSuperelevationSelection(0); groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0); groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0); // Crossfall Prototype // // label = new QLabel(tr("Crossfall Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RSystemElementRoad *> *container, prototypeManager_->getRoadPrototypes(PrototypeManager::PTP_CrossfallPrototype)) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleCrossfallSelection(int))); comboBox->setCurrentIndex(0); handleCrossfallSelection(0); groupBoxLayout->addWidget(label, groupBoxLayoutRow++, 0); groupBoxLayout->addWidget(comboBox, groupBoxLayoutRow++, 0); // RoadSystem Prototypes // // // groupBoxLayout = new QGridLayout; roadSystemPrototypesGroupBox_ = new QGroupBox(tr("RoadSystem Settings")); roadSystemPrototypesGroupBox_->setLayout(groupBoxLayout); roadSystemPrototypesGroupBox_->setEnabled(false); toolLayout->addWidget(roadSystemPrototypesGroupBox_, ++row, 0, 1, ColumnCount); label = new QLabel(tr("RoadSystem Prototype")); comboBox = new QComboBox; foreach (const PrototypeContainer<RoadSystem *> *container, prototypeManager_->getRoadSystemPrototypes()) { comboBox->addItem(container->getPrototypeIcon(), container->getPrototypeName()); } comboBox->setIconSize(QSize(16, 16)); connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(handleRoadSystemSelection(int))); comboBox->setCurrentIndex(0); handleRoadSystemSelection(0); groupBoxLayout->addWidget(label, 0, 0); groupBoxLayout->addWidget(comboBox, 1, 0); // Finish Layout // // toolLayout->setRowStretch(++row, 1); // row x fills the rest of the availlable space toolLayout->setColumnStretch(ColumnCount, 1); // column 2 fills the rest of the availlable space // Widget/Layout // // ToolWidget *toolWidget = new ToolWidget(); toolWidget->setLayout(toolLayout); toolManager_->addToolBoxWidget(toolWidget, tr("Track Editor")); connect(toolWidget, SIGNAL(activated()), this, SLOT(activateEditor())); // Default Settings // // sectionPrototypesGroupBox_->setVisible(false); trackPrototypesGroupBox_->setVisible(false); roadSystemPrototypesGroupBox_->setVisible(false); }
void CrossfallEditorTool::initToolWidget() { QGridLayout *toolLayout = new QGridLayout; // ButtonGroup // // // A button group so only one button can be checked at a time QButtonGroup *toolGroup = new QButtonGroup; connect(toolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int))); // Tools // // QPushButton *toolButton; int row = -1; // button row toolButton = new QPushButton(tr("Select")); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TCF_SELECT); // button, id toolButton->setChecked(true); // toolButton = new QPushButton(tr("Move Section")); // toolButton->setCheckable(true); // toolLayout->addWidget(toolButton, ++row, 0); // toolGroup->addButton(toolButton, ODD::TCF_MOVE); // button, id toolButton = new QPushButton(tr("Add Section")); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TCF_ADD); // button, id toolButton = new QPushButton(tr("Del Section")); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TCF_DEL); // button, id QLabel *radiusLabel = new QLabel("Smooth Radius:"); radiusEdit_ = new QDoubleSpinBox(); radiusEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter); radiusEdit_->setRange(0.01, 1000000.0); radiusEdit_->setValue(2000.0); radiusEdit_->setMinimumWidth(80.0); radiusEdit_->setMaximumWidth(80.0); toolLayout->addWidget(radiusLabel, ++row, 0); toolLayout->addWidget(radiusEdit_, ++row, 0); connect(radiusEdit_, SIGNAL(editingFinished()), this, SLOT(setRadius())); // Finish Layout // // toolLayout->setRowStretch(++row, 1); // row 3 fills the rest of the availlable space toolLayout->setColumnStretch(1, 1); // column 1 fills the rest of the availlable space // Widget/Layout // // ToolWidget *toolWidget = new ToolWidget(); toolWidget->setLayout(toolLayout); toolManager_->addToolBoxWidget(toolWidget, tr("Crossfall Editor")); connect(toolWidget, SIGNAL(activated()), this, SLOT(activateEditor())); // Ribbon // // ToolWidget *ribbonWidget = new ToolWidget(); //ribbonWidget-> Ui::CrossfallRibbon *ui = new Ui::CrossfallRibbon(); ui->setupUi(ribbonWidget); QButtonGroup *ribbonToolGroup = new QButtonGroup; connect(ribbonToolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int))); ribbonToolGroup->addButton(ui->crossfallSelect, ODD::TSE_SELECT); ribbonToolGroup->addButton(ui->crossfallAdd, ODD::TSE_ADD); ribbonToolGroup->addButton(ui->crossfallDelete, ODD::TSE_DEL); //ribbonToolGroup->addButton(ui->elevationSmooth, ODD::TSE_SMOOTH); connect(ui->radiusEdit, SIGNAL(editingFinished()), this, SLOT(setRadius())); toolManager_->addRibbonWidget(ribbonWidget, tr("Crossfall")); connect(ribbonWidget, SIGNAL(activated()), this, SLOT(activateEditor())); }
void MainWindow::on_typeSelector_currentIndexChanged(int index) { activateEditor(index); }
void JunctionEditorTool::initToolWidget() { // prototypeListWidget->setMaximumWidth(156); QGridLayout *toolLayout = new QGridLayout; // ButtonGroup // // // A button group so only one button can be checked at a time QButtonGroup *toolGroup = new QButtonGroup; connect(toolGroup, SIGNAL(buttonClicked(int)), this, SLOT(handleToolClick(int))); // Tools // // QPushButton *toolButton; int row = -1; // button row // toolButton = new QPushButton("Select"); // toolButton->setCheckable(true); // toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); // toolGroup->addButton(toolButton, ODD::TTE_SELECT); // button, id toolButton = new QPushButton("Select"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TJE_SELECT); // button, id QLabel *junctionLabel = new QLabel(tr("Prepare Roads")); toolLayout->addWidget(junctionLabel, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Split"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TJE_SPLIT); // button, id toolButton = new QPushButton("Adjust"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, row, 1); toolGroup->addButton(toolButton, ODD::TJE_MOVE); // button, id toolButton = new QPushButton("Create Connecting Lane"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TJE_CREATE_LANE); // button, id toolButton = new QPushButton("Create Connecting Road"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TJE_CREATE_ROAD); // button, id QFrame *line = new QFrame(); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setLineWidth(1); toolLayout->addWidget(line, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Create Junction from selected elements"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TJE_CREATE_JUNCTION); // button, id // toolButton->setChecked(true); junctionLabel = new QLabel(tr("Junction")); toolLayout->addWidget(junctionLabel, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Select"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TJE_SELECT_JUNCTION); // button, id toolButton = new QPushButton("Add Selected Roads"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, ++row, 0); toolGroup->addButton(toolButton, ODD::TJE_ADD_TO_JUNCTION); // button, id toolButton = new QPushButton("Remove Selected Roads"); toolButton->setCheckable(true); toolLayout->addWidget(toolButton, row, 1); toolGroup->addButton(toolButton, ODD::TJE_REMOVE_FROM_JUNCTION); // button, id line = new QFrame(); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setLineWidth(1); toolLayout->addWidget(line, ++row, 0, 1, ColumnCount); toolButton = new QPushButton("Link Selected Roads"); toolButton->setCheckable(false); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TJE_LINK_ROADS); // button, id toolButton = new QPushButton("Unlink Selected Roads"); toolButton->setCheckable(false); toolLayout->addWidget(toolButton, ++row, 0, 1, ColumnCount); toolGroup->addButton(toolButton, ODD::TJE_UNLINK_ROADS); // button, id line = new QFrame(); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); line->setLineWidth(1); toolLayout->addWidget(line, ++row, 0, 1, ColumnCount); // Circular cutting tool // // cuttingCircleButton_ = new QPushButton(tr("Circular Cut")); cuttingCircleButton_->setCheckable(false); toolLayout->addWidget(cuttingCircleButton_, ++row, 0); toolGroup->addButton(cuttingCircleButton_, ODD::TJE_CIRCLE); // button, id connect(cuttingCircleButton_, SIGNAL(toggled(bool)), this, SLOT(cuttingCircle(bool))); // Threshold // // QLabel *thresholdLabel = new QLabel("Threshold:"); thresholdEdit_ = new QDoubleSpinBox(); thresholdEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter); thresholdEdit_->setRange(0.0, 1000.0); thresholdEdit_->setValue(10.0); thresholdEdit_->setMinimumWidth(80.0); thresholdEdit_->setMaximumWidth(80.0); toolLayout->addWidget(thresholdLabel, row, 1); toolLayout->addWidget(thresholdEdit_, row, 2); connect(thresholdEdit_, SIGNAL(editingFinished()), this, SLOT(setThreshold())); // Finish Layout // // toolLayout->setRowStretch(++row, 1); // row x fills the rest of the availlable space toolLayout->setColumnStretch(ColumnCount, 1); // column 2 fills the rest of the availlable space // Widget/Layout // // ToolWidget *toolWidget = new ToolWidget(); toolWidget->setLayout(toolLayout); toolManager_->addToolBoxWidget(toolWidget, tr("Junction Editor")); connect(toolWidget, SIGNAL(activated()), this, SLOT(activateEditor())); }