MainTabController::MainTabController(MainTabView* mainContentWidget) : OSQObjectController() { m_mainContentWidget = mainContentWidget; addQObject(mainContentWidget); }
SubTabController::SubTabController(SubTabView* subTabView) : OSQObjectController(), m_subTabView(subTabView) { addQObject(subTabView); bool isConnected = false; isConnected = connect(subTabView, SIGNAL(itemSelected(OSItem*)), this, SLOT(selectItem(OSItem*))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(itemRemoveClicked(OSItem*)), this, SLOT(removeItem(OSItem*))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(itemReplacementDropped(OSItem*, const OSItemId&)), this, SLOT(replaceItem(OSItem*, const OSItemId&))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(selectionCleared()), this, SLOT(clearSelection())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(itemDropped(const OSItemId&)), this, SLOT(handleDrop(const OSItemId&))); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(addClicked()), this, SLOT(doAdd())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(copyClicked()), this, SLOT(doCopy())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(removeClicked()), this, SLOT(doRemove())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(purgeClicked()), this, SLOT(doPurge())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(openBclDlgClicked()), this, SIGNAL(openBclDlgClicked())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(openLibDlgClicked()), this, SIGNAL(openLibDlgClicked())); BOOST_ASSERT(isConnected); isConnected = connect(subTabView, SIGNAL(dropZoneItemClicked(OSItem*)), this, SLOT(inspectItem(OSItem*))); BOOST_ASSERT(isConnected); }
SchedulesTabController::SchedulesTabController(bool isIP, const model::Model & model) : MainTabController(new SchedulesTabView(model)), m_yearSettingsWidget(nullptr), m_model(model), m_scheduleDialog(nullptr), m_isIP(isIP) { m_yearDescription = m_model.getUniqueModelObject<model::YearDescription>(); m_yearSettingsWidget = new YearSettingsWidget(m_model); addQObject(m_yearSettingsWidget); this->mainContentWidget()->addSubTab("Year Settings",m_yearSettingsWidget,YEAR_SETTINGS); m_scheduleSetsController = std::shared_ptr<ScheduleSetsController>( new ScheduleSetsController(m_model) ); this->mainContentWidget()->addSubTab("Schedule Sets",m_scheduleSetsController->subTabView(),SCHEDULE_SETS); m_schedulesView = new SchedulesView(m_isIP,m_model); addQObject(m_schedulesView); this->mainContentWidget()->addSubTab("Schedules",m_schedulesView,SCHEDULES); connect(this, &SchedulesTabController::toggleUnitsClicked, this, &SchedulesTabController::toggleUnits); connect(this, &SchedulesTabController::toggleUnitsClicked, m_schedulesView, &SchedulesView::toggleUnitsClicked); connect(m_scheduleSetsController.get(), &ScheduleSetsController::downloadComponentsClicked, this, &SchedulesTabController::downloadComponentsClicked); connect(m_scheduleSetsController.get(), &ScheduleSetsController::openLibDlgClicked, this, &SchedulesTabController::openLibDlgClicked); connect(m_schedulesView, &SchedulesView::addScheduleClicked, this, &SchedulesTabController::addScheduleRuleset); connect(m_schedulesView, &SchedulesView::copySelectedScheduleClicked, this, &SchedulesTabController::copySelectedSchedule); connect(m_schedulesView, &SchedulesView::removeSelectedScheduleClicked, this, &SchedulesTabController::removeSelectedSchedule); connect(m_schedulesView, &SchedulesView::purgeUnusedScheduleRulesetsClicked, this, &SchedulesTabController::purgeUnusedScheduleRulesets); connect(m_schedulesView, &SchedulesView::addRuleClicked, this, &SchedulesTabController::addRule); connect(m_schedulesView, &SchedulesView::addSummerProfileClicked, this, &SchedulesTabController::addSummerProfile); connect(m_schedulesView, &SchedulesView::addWinterProfileClicked, this, &SchedulesTabController::addWinterProfile); connect(m_schedulesView, &SchedulesView::dayScheduleSceneChanged, this, &SchedulesTabController::onDayScheduleSceneChanged); connect(m_schedulesView, &SchedulesView::startDateTimeChanged, this, &SchedulesTabController::onStartDateTimeChanged); connect(m_schedulesView, &SchedulesView::endDateTimeChanged, this, &SchedulesTabController::onEndDateTimeChanged); connect(m_schedulesView, &SchedulesView::removeScheduleRuleClicked, this, &SchedulesTabController::removeScheduleRule); connect(m_schedulesView, &SchedulesView::itemDropped, this, &SchedulesTabController::onItemDropped); connect(m_schedulesView, &SchedulesView::modelObjectSelected, this, &SchedulesTabController::modelObjectSelected); connect(m_yearSettingsWidget, &YearSettingsWidget::calendarYearSelected, this, &SchedulesTabController::setCalendarYear); connect(m_yearSettingsWidget, &YearSettingsWidget::firstDayofYearSelected, this, &SchedulesTabController::setFirstDayofYear); connect(m_yearSettingsWidget, &YearSettingsWidget::daylightSavingTimeClicked, this, &SchedulesTabController::setDaylightSavingsTime); connect(m_yearSettingsWidget, &YearSettingsWidget::dstStartDayOfWeekAndMonthChanged, this, &SchedulesTabController::setDstStartDayOfWeekAndMonth); connect(m_yearSettingsWidget, &YearSettingsWidget::dstStartDateChanged, this, &SchedulesTabController::setDstStartDate); connect(m_yearSettingsWidget, &YearSettingsWidget::dstEndDayOfWeekAndMonthChanged, this, &SchedulesTabController::setDstEndDayOfWeekAndMonth); connect(m_yearSettingsWidget, &YearSettingsWidget::dstEndDateChanged, this, &SchedulesTabController::setDstEndDate); }
void SchedulesTabController::setSubTab(int index) { if (m_currentIndex == index) { return; } else { m_currentIndex = index; } if (qobject_cast<ScheduleSetsView *>(m_currentView) && qobject_cast<ScheduleSetsController *>(m_currentController)) { disconnect(qobject_cast<ScheduleSetsController *>(m_currentController), &ScheduleSetsController::downloadComponentsClicked, this, &SchedulesTabController::downloadComponentsClicked); disconnect(qobject_cast<ScheduleSetsController *>(m_currentController), &ScheduleSetsController::openLibDlgClicked, this, &SchedulesTabController::openLibDlgClicked); disconnect(this, &SchedulesTabController::toggleUnitsClicked, this, &SchedulesTabController::toggleUnits); m_currentController = nullptr; } else if (qobject_cast<SchedulesView *>(m_currentView)) { disconnect(this, &SchedulesTabController::toggleUnitsClicked, qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::toggleUnitsClicked); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::addScheduleClicked, this, &SchedulesTabController::addScheduleRuleset); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::copySelectedScheduleClicked, this, &SchedulesTabController::copySelectedSchedule); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::removeSelectedScheduleClicked, this, &SchedulesTabController::removeSelectedSchedule); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::purgeUnusedScheduleRulesetsClicked, this, &SchedulesTabController::purgeUnusedScheduleRulesets); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::addRuleClicked, this, &SchedulesTabController::addRule); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::addSummerProfileClicked, this, &SchedulesTabController::addSummerProfile); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::addWinterProfileClicked, this, &SchedulesTabController::addWinterProfile); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::dayScheduleSceneChanged, this, &SchedulesTabController::onDayScheduleSceneChanged); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::startDateTimeChanged, this, &SchedulesTabController::onStartDateTimeChanged); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::endDateTimeChanged, this, &SchedulesTabController::onEndDateTimeChanged); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::removeScheduleRuleClicked, this, &SchedulesTabController::removeScheduleRule); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::itemDropped, this, &SchedulesTabController::onItemDropped); disconnect(qobject_cast<SchedulesView *>(m_currentView), &SchedulesView::modelObjectSelected, this, &SchedulesTabController::modelObjectSelected); disconnect(this, &SchedulesTabController::toggleUnitsClicked, this, &SchedulesTabController::toggleUnits); } else if (m_currentView) { // Oops! Should never get here OS_ASSERT(false); } switch (index){ case 0: { auto scheduleSetsController = new ScheduleSetsController(m_model); connect(scheduleSetsController, &ScheduleSetsController::downloadComponentsClicked, this, &SchedulesTabController::downloadComponentsClicked); connect(scheduleSetsController, &ScheduleSetsController::openLibDlgClicked, this, &SchedulesTabController::openLibDlgClicked); connect(this, &SchedulesTabController::toggleUnitsClicked, this, &SchedulesTabController::toggleUnits); this->mainContentWidget()->setSubTab(scheduleSetsController->subTabView()); m_currentView = scheduleSetsController->subTabView(); m_currentController = scheduleSetsController; break; } case 1: { auto schedulesView = new SchedulesView(m_isIP, m_model); addQObject(schedulesView); connect(this, &SchedulesTabController::toggleUnitsClicked, schedulesView, &SchedulesView::toggleUnitsClicked); connect(schedulesView, &SchedulesView::addScheduleClicked, this, &SchedulesTabController::addScheduleRuleset); connect(schedulesView, &SchedulesView::copySelectedScheduleClicked, this, &SchedulesTabController::copySelectedSchedule); connect(schedulesView, &SchedulesView::removeSelectedScheduleClicked, this, &SchedulesTabController::removeSelectedSchedule); connect(schedulesView, &SchedulesView::purgeUnusedScheduleRulesetsClicked, this, &SchedulesTabController::purgeUnusedScheduleRulesets); connect(schedulesView, &SchedulesView::addRuleClicked, this, &SchedulesTabController::addRule); connect(schedulesView, &SchedulesView::addSummerProfileClicked, this, &SchedulesTabController::addSummerProfile); connect(schedulesView, &SchedulesView::addWinterProfileClicked, this, &SchedulesTabController::addWinterProfile); connect(schedulesView, &SchedulesView::dayScheduleSceneChanged, this, &SchedulesTabController::onDayScheduleSceneChanged); connect(schedulesView, &SchedulesView::startDateTimeChanged, this, &SchedulesTabController::onStartDateTimeChanged); connect(schedulesView, &SchedulesView::endDateTimeChanged, this, &SchedulesTabController::onEndDateTimeChanged); connect(schedulesView, &SchedulesView::removeScheduleRuleClicked, this, &SchedulesTabController::removeScheduleRule); connect(schedulesView, &SchedulesView::itemDropped, this, &SchedulesTabController::onItemDropped); connect(schedulesView, &SchedulesView::modelObjectSelected, this, &SchedulesTabController::modelObjectSelected); connect(this, &SchedulesTabController::toggleUnitsClicked, this, &SchedulesTabController::toggleUnits); this->mainContentWidget()->setSubTab(schedulesView); m_currentView = schedulesView; break; } default: OS_ASSERT(false); break; } }
GeometryPreviewController::GeometryPreviewController(bool isIP, const model::Model& model) : OSQObjectController() { m_view = new GeometryPreviewView(isIP, model); addQObject(m_view); }