void TabsManager::insertTab(ChatWidget *chatWidget) { kdebugf(); Title->addChatWidget(chatWidget); bool restoreChatGeometry = true; // jeśli jest otwarty chatwindow przypisany do chat to zostanie on zamknięty if (chatWidget->parentWidget()) { chatWidget->parentWidget()->deleteLater(); restoreChatGeometry = false; } ContactSet contacts = chatWidget->chat().contacts(); DetachedChats.removeAll(chatWidget->chat()); for (Action *action : m_attachTabAction->actions()) { if (action->context()->contacts() == contacts) action->setChecked(true); } // Ustawiam tytul karty w zaleznosci od tego czy mamy do czynienia z rozmowa czy z konferencja TabDialog->insertTab(TargetTabs, chatWidget, chatWidget->title()->blinkingIcon(), QString()); if (restoreChatGeometry) chatWidget->kaduRestoreGeometry(); updateTabTitle(chatWidget); TargetTabs = -1; connect(chatWidget->edit(), SIGNAL(keyPressed(QKeyEvent*, CustomInput*, bool&)), TabDialog, SLOT(chatKeyPressed(QKeyEvent*, CustomInput*, bool&))); connect(chatWidget->title(), SIGNAL(titleChanged(ChatWidget*)), this, SLOT(onTitleChanged(ChatWidget*))); CloseOtherTabsMenuAction->setEnabled(TabDialog->count() > 1); // unreadMessagesCountChanged(chatWidget); if (_isActiveWindow(TabDialog) && TabDialog->currentWidget() == chatWidget) emit chatWidgetActivated(chatWidget); kdebugf2(); }
OS_Booting::OS_Booting( QWidget *parent, QString _caps, QString _xmlDesc) : _Tab(parent), capabilities(_caps), xmlDesc(_xmlDesc) { setObjectName("OS_Booting"); readCapabilities(); bootType = new BootType(this); bootSet = new QStackedWidget(this); bootSet->addWidget(new BIOS_Boot(this, capabilities)); bootSet->addWidget(new Host_Boot(this)); bootSet->addWidget(new Direct_Kernel_Boot(this)); bootSet->addWidget(new LXC_OSBooting(this, capabilities)); bootSet->widget(0)->setEnabled(type.toLower().compare("lxc")!=0); bootSet->widget(1)->setEnabled(type.toLower().compare("lxc")!=0); bootSet->widget(2)->setEnabled(type.toLower().compare("lxc")!=0); bootSet->widget(3)->setEnabled(type.toLower().compare("lxc")==0); bootType->osType->setEnabled(type.toLower().compare("lxc")!=0); connect(bootType->bootType, SIGNAL(currentIndexChanged(int)), bootSet, SLOT(setCurrentIndex(int))); connect(bootType->bootType, SIGNAL(currentIndexChanged(int)), this, SLOT(changeBootType())); //scrolledLayout = new QVBoxLayout(this); //scrolledLayout->addWidget(bootType); //scrolledLayout->addWidget(bootSet); //scrolledLayout->addStretch(-1); //scrolled = new QWidget(this); //scrolled->setLayout(scrolledLayout); restorePanel = new RestorePanel(this); //commonWdg = new QScrollArea(this); //commonWdg->setWidget(scrolled); //commonWdg->setWidgetResizable(true); commonLayout = new QVBoxLayout(this); commonLayout->addWidget(restorePanel, 0, Qt::AlignRight); //commonLayout->addWidget(commonWdg); commonLayout->addWidget(bootType); commonLayout->addWidget(bootSet); commonLayout->addStretch(-1); setLayout(commonLayout); readXMLDesciption(); // dataChanged connections connect(this, SIGNAL(dataChanged()), restorePanel, SLOT(stateChanged())); connect(bootType->osType, SIGNAL(textEdited(QString)), this, SLOT(stateChanged())); // action connections connect(restorePanel, SIGNAL(resetData()), this, SLOT(resetData())); connect(restorePanel, SIGNAL(revertData()), this, SLOT(revertData())); connect(restorePanel, SIGNAL(saveData()), this, SLOT(saveData())); for (int i=0; i<bootSet->count(); i++) { connect(bootSet->widget(i), SIGNAL(domainType(const QString&)), this, SIGNAL(domainType(const QString&))); connect(bootSet->widget(i), SIGNAL(osType(const QString&)), this, SLOT(changeOSType(const QString&))); connect(bootSet->widget(i), SIGNAL(emulatorType(const QString&)), this, SIGNAL(emulatorType(const QString&))); connect(bootSet->widget(i), SIGNAL(dataChanged()), this, SLOT(stateChanged())); }; BIOS_Boot *wdg = static_cast<BIOS_Boot*>(bootSet->widget(0)); connect(wdg->architecture, SIGNAL(maxVCPU(const QString&)), this, SIGNAL(maxVCPU(const QString&))); connect(wdg->architecture, SIGNAL(archType(const QString&)), this, SIGNAL(archChanged(const QString&))); }
PeakPickerTool::PeakPickerTool( Graph *graph, MantidQt::MantidWidgets::FitPropertyBrowser *fitPropertyBrowser, MantidUI *mantidUI, bool showFitPropertyBrowser) : QwtPlotPicker(graph->plotWidget()->canvas()), PlotToolInterface(graph), m_fitPropertyBrowser(fitPropertyBrowser), m_mantidUI(mantidUI), m_wsName(), m_spec(), m_init(false), m_width_set(true), m_width(0), m_addingPeak(false), m_resetting(false), m_xMin(0.), m_xMax(0.), m_changingXMin(false), m_changingXMax(false), m_shouldBeNormalised(false) { d_graph->plotWidget()->canvas()->setCursor(Qt::PointingHandCursor); addExistingFitsAndGuess(d_graph->curvesList()); if (d_graph->plotWidget()->curves().size() > 0) { // Initialize from the first curve that will work auto curvesMap = d_graph->plotWidget()->curves(); for (auto curveIter = curvesMap.begin(); curveIter != curvesMap.end(); ++curveIter) { auto curve = dynamic_cast<PlotCurve *>(curveIter.value()); if (initializeFromCurve(curve)) { break; } } } else { return; } m_fitPropertyBrowser->normaliseData(m_shouldBeNormalised); m_fitPropertyBrowser->getHandler()->removeAllPlots(); m_fitPropertyBrowser->setWorkspaceName(m_wsName); m_fitPropertyBrowser->setWorkspaceIndex(m_spec); connect(m_fitPropertyBrowser, SIGNAL(currentChanged()), this, SLOT(currentChanged())); connect(m_fitPropertyBrowser, SIGNAL(workspaceIndexChanged(int)), this, SLOT(workspaceIndexChanged(int))); connect(m_fitPropertyBrowser, SIGNAL(workspaceNameChanged(const QString &)), this, SLOT(workspaceNameChanged(const QString &))); connect(m_fitPropertyBrowser, SIGNAL(functionRemoved()), this, SLOT(functionRemoved())); connect(m_fitPropertyBrowser, SIGNAL(functionCleared()), this, SLOT(functionCleared())); connect(m_fitPropertyBrowser, SIGNAL(algorithmFinished(const QString &)), this, SLOT(algorithmFinished(const QString &))); connect(m_fitPropertyBrowser, SIGNAL(startXChanged(double)), this, SLOT(startXChanged(double))); connect(m_fitPropertyBrowser, SIGNAL(endXChanged(double)), this, SLOT(endXChanged(double))); connect(m_fitPropertyBrowser, SIGNAL(parameterChanged(const Mantid::API::IFunction *)), this, SLOT(parameterChanged(const Mantid::API::IFunction *))); connect(m_fitPropertyBrowser, SIGNAL(plotGuess()), this, SLOT(plotGuess())); connect(m_fitPropertyBrowser, SIGNAL(plotCurrentGuess()), this, SLOT(plotCurrentGuess())); connect(m_fitPropertyBrowser, SIGNAL(removeGuess()), this, SLOT(removeGuess())); connect(m_fitPropertyBrowser, SIGNAL(removeCurrentGuess()), this, SLOT(removeCurrentGuess())); connect(m_fitPropertyBrowser, SIGNAL(removePlotSignal(MantidQt::MantidWidgets::PropertyHandler *)), this, SLOT(removePlot(MantidQt::MantidWidgets::PropertyHandler *))); connect(m_fitPropertyBrowser, SIGNAL(removeFitCurves()), this, SLOT(removeFitCurves())); // When fit browser destroyed, disable oneself in the parent graph connect(m_fitPropertyBrowser, SIGNAL(destroyed()), graph, SLOT(disableTools())); // Show the fitPropertyBrowser if it isn't already. if (showFitPropertyBrowser) m_fitPropertyBrowser->show(); connect(this, SIGNAL(isOn(bool)), m_fitPropertyBrowser, SLOT(setPeakToolOn(bool))); emit isOn(true); auto cf = m_fitPropertyBrowser->compositeFunction(); if (m_fitPropertyBrowser->count() == 0 || (m_fitPropertyBrowser->count() == 1 && m_fitPropertyBrowser->isAutoBack())) { m_init = true; QwtScaleMap xMap = d_graph->plotWidget()->canvasMap(QwtPlot::xBottom); double s1 = xMap.s1(), s2 = xMap.s2(); double ds = fabs(s2 - s1) * 0.05; xMin(s1 + ds); xMax(s2 - ds); m_changingXMin = false; m_changingXMax = false; m_fitPropertyBrowser->setStartX(xMin()); m_fitPropertyBrowser->setEndX(xMax()); if (m_fitPropertyBrowser->isAutoBack()) { m_fitPropertyBrowser->addAutoBackground(); } } else { m_init = true; xMin(m_fitPropertyBrowser->startX()); xMax(m_fitPropertyBrowser->endX()); m_changingXMin = false; m_changingXMax = false; for (size_t i = 0; i < cf->nFunctions(); i++) { auto pf = dynamic_cast<Mantid::API::IPeakFunction *>(cf->getFunction(i).get()); if (pf) { m_width = pf->fwhm(); if (m_width != 0.) break; } } } attach(d_graph->plotWidget()); d_graph->plotWidget()->replot(); connect(d_graph, SIGNAL(curveRemoved()), this, SLOT(curveRemoved())); connect(d_graph, SIGNAL(modifiedGraph()), this, SLOT(modifiedGraph())); try { // if it's a MatrixWorkspace in the ADS m_ws = boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>( Mantid::API::AnalysisDataService::Instance().retrieve( m_wsName.toStdString())); } catch (...) { // or it can be a TableWorkspace m_ws = boost::dynamic_pointer_cast<Mantid::API::MatrixWorkspace>( m_fitPropertyBrowser->createMatrixFromTableWorkspace()); } }