FlightTaskRowEditor::FlightTaskRowEditor(QWeakPointer<PlanningProblem> problem, QWeakPointer<FlightTaskArea> area, QWeakPointer<FlightTask> task, QWidget *parent) : QWidget(parent), ui(new Ui::FlightTaskRowEditor), _problem(problem), _area(area), _task(task) { ui->setupUi(this); QSharedPointer<FlightTask> strongTask = task.toStrongRef(); if (strongTask.isNull()) return; QSharedPointer<FlightTaskArea> strongArea = area.toStrongRef(); if (strongArea.isNull()) return; //Set our label to be the task's name/type ui->taskNameLabel->setText(strongTask->taskType()); //If the task or the area go away we need to close connect(strongArea.data(), SIGNAL(destroyed()), this, SLOT(deleteLater())); connect(strongTask.data(), SIGNAL(destroyed()), this, SLOT(deleteLater())); }
static QSharedPointer<ObjectTemplateModel> sharedTemplateModel() { static QWeakPointer<ObjectTemplateModel> templateModel; auto model = templateModel.lock(); if (model) return model; model = QSharedPointer<ObjectTemplateModel>::create(); templateModel = model; Preferences *prefs = Preferences::instance(); // Set the initial root path QDir templatesDir(prefs->templatesDirectory()); if (!templatesDir.exists()) templatesDir.setPath(QDir::currentPath()); model->setRootPath(templatesDir.absolutePath()); // Make sure the root path stays updated ObjectTemplateModel *modelPointer = model.data(); QObject::connect(prefs, &Preferences::templatesDirectoryChanged, modelPointer, [modelPointer] (const QString &templatesDirectory) { modelPointer->setRootPath(QDir(templatesDirectory).absolutePath()); }); return model; }
void CacheTest::testMaximumCacheSize() { QpCache cache; int cacheSize = 10; cache.setMaximumCacheSize(cacheSize); QWeakPointer<QObject> weakRef = cache.insert(0, new QObject()).toWeakRef(); QWeakPointer<QObject> weakRef4; QWeakPointer<QObject> weakRef5; for (int i = 1; i < cacheSize; ++i) { QWeakPointer<QObject> weak = cache.insert(i, new QObject()).toWeakRef(); QVERIFY(weakRef.toStrongRef()); if (i == 4) { weakRef4 = weak; } if (i == 5) { weakRef5 = weak; } } cache.insert(10, new QObject()); QVERIFY(!weakRef.toStrongRef()); cache.setMaximumCacheSize(6); QVERIFY(!weakRef4.toStrongRef()); QVERIFY(weakRef5.toStrongRef()); }
void LocationEditor::buttonClicked() { const QWeakPointer<LocationDialog> dialogPtr(new LocationDialog(this)); if (LocationDialog *const dialog = dialogPtr.data()) { dialog->setLongitude(this->startLongitude); dialog->setLatitude(this->startLatitude); dialog->setAltitude(this->startAltitude); dialog->exec(); } if (LocationDialog *const dialog = dialogPtr.data()) { const double lon = dialog->getLongitude(); const double lat = dialog->getLatitude(); const double alt = dialog->getAltitude(); startAltitude = alt; startLongitude = lon; startLatitude = lat; if (dialog->okPressed()) { NoteTable ntable(global.db); if (lon == 0.0 && lat == 0.0) { setText(defaultText); ntable.resetGeography(currentLid, true); } else { setText(dialog->locationText()); ntable.setGeography(currentLid, lon,lat,alt, true); } } delete dialog; } }
int onHeadersComplete(http_parser *parser) { TcpSocket *socket = static_cast<TcpSocket*>(parser->data); #ifndef NO_LOG sLog(LogEndpoint::LogLevel::DEBUG) << " === parsed header ===="; const QHash<QString, QSharedPointer<QString>> &headers = socket->getHeader().getHeaderInfo(); QHash<QString, QSharedPointer<QString>>::const_iterator i = headers.constBegin(); while (i != headers.constEnd()) { sLog(LogEndpoint::LogLevel::DEBUG) << i.key() << *(i.value().data()); ++i; } sLog(LogEndpoint::LogLevel::DEBUG) << " === ============= ===="; sLogFlush(); #endif QWeakPointer<QString> host = socket->getHeader().getHeaderInfo("Host"); if (!host.isNull()) { socket->getHeader().setHost(*host.data()); } return 0; }
void ProblemModelAdapter::handleAreaObjectDestroyed() { QSharedPointer<PlanningProblem> strongProblem = _problem.toStrongRef(); if (strongProblem.isNull()) return; QObject * sender = QObject::sender(); if (!sender) return; /* Don't do anything with this pointer! At this point TaskAreaObject's destructor has finished and QObject's destructor is running. */ TaskAreaObject * obj = (TaskAreaObject *)sender; if (!_objectToArea.contains(obj)) return; QWeakPointer<TaskArea> weakArea = _objectToArea.take(obj); QSharedPointer<TaskArea> area = weakArea.toStrongRef(); if (!area.isNull()) strongProblem->removeArea(area); }
// The access function for guarded QObject pointers. static void *qpointer_access_func(sipSimpleWrapper *w, AccessFuncOp op) { #if QT_VERSION >= 0x040500 QWeakPointer<QObject> *guard = reinterpret_cast<QWeakPointer<QObject> *>(w->data); #else QObjectGuard *guard = reinterpret_cast<QObjectGuard *>(w->data); #endif void *addr; switch (op) { case UnguardedPointer: #if QT_VERSION >= 0x040500 addr = guard->data(); #else addr = guard->unguarded; #endif break; case GuardedPointer: #if QT_VERSION >= 0x040500 addr = guard->isNull() ? 0 : guard->data(); #else addr = (QObject *)guard->guarded; #endif break; case ReleaseGuard: delete guard; addr = 0; break; } return addr; }
static QObject *createInstance() { static QWeakPointer<QObject> instance; if (!instance) instance = QWeakPointer<QObject>(new qutim_sdk_0_3::ScriptExtensionPlugin); return instance.data(); }
QNetworkAccessManager* nam() { if ( s_nam.isNull() ) return 0; return s_nam.data(); }
void tst_QSharedPointer::downCast() { { QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData); QSharedPointer<Data> baseptr = qSharedPointerCast<Data>(ptr); QSharedPointer<Data> other; QVERIFY(ptr == baseptr); QVERIFY(baseptr == ptr); QVERIFY(! (ptr != baseptr)); QVERIFY(! (baseptr != ptr)); QVERIFY(ptr != other); QVERIFY(other != ptr); QVERIFY(! (ptr == other)); QVERIFY(! (other == ptr)); } { QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData); QSharedPointer<Data> baseptr = ptr; } int destructorCount; destructorCount = DerivedData::derivedDestructorCounter; { QSharedPointer<Data> baseptr; { QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData); baseptr = ptr; QVERIFY(baseptr == ptr); } } QCOMPARE(DerivedData::derivedDestructorCounter, destructorCount + 1); destructorCount = DerivedData::derivedDestructorCounter; { QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData); QWeakPointer<Data> baseptr = ptr; QVERIFY(baseptr == ptr); ptr = QSharedPointer<DerivedData>(); QVERIFY(baseptr.isNull()); } QCOMPARE(DerivedData::derivedDestructorCounter, destructorCount + 1); destructorCount = DerivedData::derivedDestructorCounter; { QSharedPointer<DerivedData> ptr = QSharedPointer<DerivedData>(new DerivedData); QWeakPointer<DerivedData> weakptr(ptr); QSharedPointer<Data> baseptr = weakptr; QVERIFY(baseptr == ptr); QWeakPointer<Data> baseweakptr = weakptr; QVERIFY(baseweakptr == ptr); } QCOMPARE(DerivedData::derivedDestructorCounter, destructorCount + 1); }
//static void DrKonqi::saveReport(const QString & reportText, QWidget *parent) { if (KCmdLineArgs::parsedArgs()->isSet("safer")) { KTemporaryFile tf; tf.setSuffix(".kcrash.txt"); tf.setAutoRemove(false); if (tf.open()) { QTextStream textStream(&tf); textStream << reportText; textStream.flush(); KMessageBox::information(parent, i18nc("@info", "Report saved to <filename>%1</filename>.", tf.fileName())); } else { KMessageBox::sorry(parent, i18nc("@info","Could not create a file in which to save the report.")); } } else { QString defname = getSuggestedKCrashFilename(crashedApplication()); QWeakPointer<KFileDialog> dlg = new KFileDialog(defname, QString(), parent); dlg.data()->setSelection(defname); dlg.data()->setCaption(i18nc("@title:window","Select Filename")); dlg.data()->setOperationMode(KFileDialog::Saving); dlg.data()->setMode(KFile::File); dlg.data()->setConfirmOverwrite(true); dlg.data()->exec(); if (dlg.isNull()) { //Dialog is invalid, it was probably deleted (ex. via DBus call) //return and do not crash return; } KUrl fileUrl = dlg.data()->selectedUrl(); delete dlg.data(); if (fileUrl.isValid()) { KTemporaryFile tf; if (tf.open()) { QTextStream ts(&tf); ts << reportText; ts.flush(); } else { KMessageBox::sorry(parent, i18nc("@info","Cannot open file <filename>%1</filename> " "for writing.", tf.fileName())); return; } if (!KIO::NetAccess::upload(tf.fileName(), fileUrl, parent)) { KMessageBox::sorry(parent, KIO::NetAccess::lastErrorString()); } } } }
/** * \brief Initialization * * Initializes the TabsApplet with default parameters */ void TabsApplet::init() { // applet base initialization Context::Applet::init(); // create the header label enableHeader( true ); setHeaderText( i18nc( "Guitar tablature", "Tabs" ) ); // creates the tab view m_tabsView = new TabsView( this ); // Set the collapse size setCollapseOffHeight( -1 ); setCollapseHeight( m_header->height() ); setMinimumHeight( collapseHeight() ); setPreferredHeight( collapseHeight() ); // create the reload icon QAction* reloadAction = new QAction( this ); reloadAction->setIcon( KIcon( "view-refresh" ) ); reloadAction->setVisible( true ); reloadAction->setEnabled( true ); reloadAction->setText( i18nc( "Guitar tablature", "Reload tabs" ) ); m_reloadIcon = addLeftHeaderAction( reloadAction ); m_reloadIcon.data()->setEnabled( false ); connect( m_reloadIcon.data(), SIGNAL(clicked()), this, SLOT(reloadTabs()) ); // create the settings icon QAction* settingsAction = new QAction( this ); settingsAction->setIcon( KIcon( "preferences-system" ) ); settingsAction->setEnabled( true ); settingsAction->setText( i18n( "Settings" ) ); QWeakPointer<Plasma::IconWidget> settingsIcon = addRightHeaderAction( settingsAction ); connect( settingsIcon.data(), SIGNAL(clicked()), this, SLOT(showConfigurationInterface()) ); m_layout = new QGraphicsLinearLayout( Qt::Vertical ); m_layout->addItem( m_header ); m_layout->addItem( m_tabsView ); setLayout( m_layout ); // read configuration data and update the engine. KConfigGroup config = Amarok::config("Tabs Applet"); m_fetchGuitar = config.readEntry( "FetchGuitar", true ); m_fetchBass = config.readEntry( "FetchBass", true ); Plasma::DataEngine *engine = dataEngine( "amarok-tabs" ); engine->setProperty( "fetchGuitarTabs", m_fetchGuitar ); engine->setProperty( "fetchBassTabs", m_fetchBass ); engine->connectSource( "tabs", this ); updateInterface( InitState ); }
void Ut_MApplicationPage::testCustomNavigationBarContentOwnershipOnPageDeletion() { QGraphicsWidget *customNavigationBarContent = new QGraphicsWidget; QWeakPointer<QGraphicsWidget> customNavigationBarContentPointer = customNavigationBarContent; m_subject->setCustomNavigationBarContent(customNavigationBarContent); delete m_subject; m_subject = 0; QVERIFY(customNavigationBarContentPointer.isNull()); }
void Workspace::addBrowseView(QString cubename) { /* Close the last browse window if necessary. */ if (subWindowList().size()) { QWeakPointer<QMdiSubWindow> windowToRemove = subWindowList()[subWindowList().size() - 1]; removeSubWindow(windowToRemove.data()); delete windowToRemove.data(); } addCubeViewport(cubename); }
int PasswordDialog::exec() { Q_D(PasswordDialog); if (d->eventLoop) // recursive call return -1; QEventLoop eventLoop; d->eventLoop = &eventLoop; QWeakPointer<PasswordDialog> guard = this; (void) eventLoop.exec(); d->eventLoop = 0; if (guard.isNull()) return PasswordDialog::Rejected; return result(); }
void SimplePersonSetTest::testConstructorDestructorCreate() { // Create a PersonSet. SimplePersonSetPtr personSet = SimplePersonSet::create(); QVERIFY(!personSet.isNull()); // Get a QWeakPointer to it, for testing destruction. QWeakPointer<PersonSet> weakPtr = QWeakPointer<PersonSet>(personSet.data()); // Remove the only strong ref. personSet.reset(); // Check the PersonSet was deleted OK QVERIFY(personSet.isNull()); QVERIFY(weakPtr.isNull()); }
void QGraphicsWebViewPrivate::updateCompositingScrollPosition() { if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) { const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition(); rootGraphicsLayer.data()->setPos(-scrollPosition); } }
void PDFViewer::documentChanged(const QWeakPointer<QtPDF::Backend::Document> newDoc) { if (_counter) { QSharedPointer<QtPDF::Backend::Document> doc(newDoc.toStrongRef()); _counter->setLastPage(doc->numPages()); } }
void MetaQueryWidget::populateComboBox( QStringList results ) { QObject* query = sender(); if( !query ) return; QWeakPointer<KComboBox> combo = m_runningQueries.value(query); if( combo.isNull() ) return; // note: adding items seems to reset the edit text, so we have // to take care of that. disconnect( combo.data(), 0, this, 0 ); // want the results unique and sorted const QSet<QString> dataSet = results.toSet(); QStringList dataList = dataSet.toList(); dataList.sort(); combo.data()->addItems( dataList ); KCompletion* comp = combo.data()->completionObject(); comp->setItems( dataList ); // reset the text and re-enable the signal combo.data()->setEditText( m_filter.value ); connect( combo.data(), SIGNAL(editTextChanged( const QString& ) ), SLOT(valueChanged(const QString&)) ); }
void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer) { if (rootGraphicsLayer) { rootGraphicsLayer.data()->setParentItem(0); q->scene()->removeItem(rootGraphicsLayer.data()); QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive(); } rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0; if (layer) { layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); layer->setParentItem(q); layer->setZValue(RootGraphicsLayerZValue); updateCompositingScrollPosition(); } createOrDeleteOverlay(); }
void Ut_MApplicationPage::testCustomNavigationBarContentSetterAndGetter() { QGraphicsWidget *customNavigationBarContent = new QGraphicsWidget; QWeakPointer<QGraphicsWidget> customNavigationBarContentPointer = customNavigationBarContent; QVERIFY(m_subject->customNavigationBarContent() == 0); m_subject->setCustomNavigationBarContent(customNavigationBarContent); QVERIFY(m_subject->customNavigationBarContent() == customNavigationBarContent); m_subject->setCustomNavigationBarContent(0); QVERIFY(m_subject->customNavigationBarContent() == 0); // Page should have deleted the old widget when replacing it with the 0 (null) one. QVERIFY(customNavigationBarContentPointer.isNull()); }
QSharedPointer<Accounts::Manager> SharedManager::instance() { QSharedPointer<Accounts::Manager> manager = sharedManager.toStrongRef(); if (manager.isNull()) { manager = QSharedPointer<Accounts::Manager>(new Accounts::Manager); sharedManager = manager; } return manager; }
void setProxy( QNetworkProxy* proxy ) { s_proxy = proxy; s_nam.data()->setProxy( *proxy ); qDebug() << Q_FUNC_INFO << "setting proxy to use proxy DNS?" << (TomahawkSettings::instance()->proxyDns() ? "true" : "false"); if ( !TomahawkSettings::instance()->proxyDns() ) s_proxy->setCapabilities( QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability | QNetworkProxy::UdpTunnelingCapability ); }
void addModel(QAbstractItemModel *model, ViewType viewtype, Kickoff::MenuView::ModelOptions options = Kickoff::MenuView::MergeFirstLevel, int formattype = -1) { Kickoff::MenuView* mainView = menuview.data(); Kickoff::MenuView* m = mainView; if (viewtypes.count() > 1 || !m) { m = new Kickoff::MenuView(mainView, viewText(viewtype), KIcon(viewIcon(viewtype))); m->setFormatType((formattype >= 0 || !mainView) ? (Kickoff::MenuView::FormatType)formattype : mainView->formatType()); mainView->addMenu(m); } m->addModel(model, options); }
void CacheTest::testRemove() { QpCache cache; QObject *object = new QObject(); int id1 = 123; QWeakPointer<QObject> weakRef; { QSharedPointer<QObject> strongRef = cache.insert(id1, object); weakRef = strongRef.toWeakRef(); QVERIFY(cache.contains(id1)); QVERIFY(weakRef.toStrongRef()); cache.remove(id1); QVERIFY(!cache.contains(id1)); QVERIFY(weakRef.toStrongRef()); } QVERIFY(!weakRef.toStrongRef()); }
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id) { //qDebug(); // See if there is still an existing framebuffer to this WId. if (m_frameBuffers.contains(id)) { QWeakPointer<FrameBuffer> weakFrameBuffer = m_frameBuffers.value(id); if (weakFrameBuffer) { //qDebug() << "Found cached frame buffer."; return weakFrameBuffer.toStrongRef(); } else { //qDebug() << "Found deleted cached frame buffer. Don't use."; m_frameBuffers.remove(id); } } // We don't already have that frame buffer. QMap<QString, FrameBufferPlugin *>::const_iterator iter = m_plugins.constBegin(); while (iter != m_plugins.constEnd()) { if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) { qDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin(); QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id)); if (frameBuffer) { m_frameBuffers.insert(id, frameBuffer.toWeakRef()); return frameBuffer; } } ++iter; } // No valid framebuffer plugin found. qDebug() << "No valid framebuffer found. returning null."; return QSharedPointer<FrameBuffer>(); }
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& manager, QWidget *parent) : QDialog(parent), ui(new Ui::AutomatedRssDownloader), m_manager(manager), m_editedRule(0) { ui->setupUi(this); // Icons ui->removeRuleBtn->setIcon(IconProvider::instance()->getIcon("list-remove")); ui->addRuleBtn->setIcon(IconProvider::instance()->getIcon("list-add")); // Ui Settings ui->listRules->setSortingEnabled(true); ui->listRules->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->treeMatchingArticles->setSortingEnabled(true); ui->hsplitter->setCollapsible(0, false); ui->hsplitter->setCollapsible(1, false); ui->hsplitter->setCollapsible(2, true); // Only the preview list is collapsible bool ok; Q_UNUSED(ok); ok = connect(ui->checkRegex, SIGNAL(toggled(bool)), SLOT(updateFieldsToolTips(bool))); Q_ASSERT(ok); ok = connect(ui->listRules, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayRulesListMenu(const QPoint&))); Q_ASSERT(ok); m_ruleList = manager.toStrongRef()->downloadRules(); m_editableRuleList = new RssDownloadRuleList; // Read rule list from disk initLabelCombobox(); loadFeedList(); loadSettings(); ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateRuleDefinitionBox())); Q_ASSERT(ok); ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateFeedList())); Q_ASSERT(ok); ok = connect(ui->listFeeds, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(handleFeedCheckStateChange(QListWidgetItem*))); Q_ASSERT(ok); // Update matching articles when necessary ok = connect(ui->lineContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles())); Q_ASSERT(ok); ok = connect(ui->lineContains, SIGNAL(textEdited(QString)), SLOT(updateMustLineValidity())); Q_ASSERT(ok); ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMatchingArticles())); Q_ASSERT(ok); ok = connect(ui->lineNotContains, SIGNAL(textEdited(QString)), SLOT(updateMustNotLineValidity())); Q_ASSERT(ok); ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMatchingArticles())); Q_ASSERT(ok); ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustLineValidity())); Q_ASSERT(ok); ok = connect(ui->checkRegex, SIGNAL(stateChanged(int)), SLOT(updateMustNotLineValidity())); Q_ASSERT(ok); ok = connect(this, SIGNAL(finished(int)), SLOT(on_finished(int))); Q_ASSERT(ok); updateRuleDefinitionBox(); updateFeedList(); }
tSidebarPageTroll::tSidebarPageTroll( const QWeakPointer<tMercuryStyle>& xStyle, const QWeakPointer<tMercurySettings>& xSettings, const QWeakPointer<tMercuryDataManager>& xDataManager, QGraphicsItem* pParent) : Base(xStyle, xSettings, pParent) , m_xDataManager(xDataManager) , m_pStatus(0) , m_pIndicator(0) , m_pButton(0) , m_pUp(0) , m_pDown(0) , m_CurrentRPM(0) , m_TimeoutTicks(0) , m_TrollAllowed(true) , m_RotaryFocus(false) { tSidebarPage::ItemsCollection items(this); tSidebarControlTitle* objTitle = new tSidebarControlTitle(xStyle.data(), tr("VESSEL CONTROL", "Mercury Vessel Control section heading"), tr("TROLL", "Mercury Troll Control page title"), tSidebarControlTitle::eModeBack); Connect(objTitle, SIGNAL(Triggered()), this, SIGNAL(Back())); items .Add(objTitle, 1.f, Qt::AlignAbsolute) .Add(m_pUp = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionUp), 1.5f, Qt::AlignAbsolute) .Add(m_pIndicator = new tSidebarControlIndicator( xStyle.data(), "", "", "", tSidebarControlIndicator::eModeNormal, true), -1.f, Qt::AlignAbsolute) .Add(m_pDown = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionDown), 1.5f, Qt::AlignAbsolute) .Add(m_pStatus = new tSidebarStaticText(xStyle.data(), ""), 0.5f, Qt::AlignAbsolute) .Add(m_pButton = new tSidebarControlButtonToggle(xStyle.data(), tr("Enable"), tr("Disable")), 1.f, Qt::AlignBottom) .End(); Connect(m_pUp, SIGNAL(Triggered()), this, SLOT(OnUpClicked())); Connect(m_pDown, SIGNAL(Triggered()), this, SLOT(OnDownClicked())); Connect(m_pButton, SIGNAL(Triggered()), this, SLOT(OnEnableClicked())); Connect(m_pIndicator, SIGNAL(Triggered()), this, SLOT(OnIndicatorTouched())); if( !m_xDataManager.isNull() ) { tMercuryCommand* command = m_xDataManager.data()->MercuryCommand(); if( command != 0 ) { m_CurrentRPM = static_cast<int>(command->TrollRpmSetpoint()); UpdateStatus(command->IsTrollActive()); SetTrollAllowed(command->IsTrollAllowed()); Connect(command, SIGNAL(TrollEngaged(int)), this, SLOT(StatusEnable())); Connect(command, SIGNAL(TrollDisengaged(int)), this, SLOT(StatusDisable())); Connect(command, SIGNAL(TrollActiveDetected()), this, SLOT(StatusEnable())); Connect(command, SIGNAL(TrollInactiveDetected()), this, SLOT(StatusDisable())); Connect(command, SIGNAL(TrollAllowedChanged(bool)), this, SLOT(SetTrollAllowed(bool))); }
void myMessageOutput(QtMsgType type, const char *msg) { QString strMsg = QString::fromLatin1(msg); if (!QCoreApplication::closingDown()) { if (!logger.isNull()) { if (recursiveLock.testAndSetOrdered(0, 1)) { QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); recursiveLock = 0; } } else { warnings += strMsg; warnings += QLatin1Char('\n'); } } if (systemMsgOutput) { // Windows systemMsgOutput(type, msg); } else { // Unix fprintf(stderr, "%s\n", msg); fflush(stderr); } }
//public slot void ProblemModelAdapter::setProblem(QWeakPointer<PlanningProblem> problem) { /* We have to do this with the start and end markers to prevent and annoying save/load bug where the markers disappear and reappear upong loading over and over */ if (!_startMarker.isNull()) { disconnect(_startMarker.data(), SIGNAL(destroyed()), this, SLOT(handleStartMarkerDestroyed())); _startMarker->deleteLater(); _startMarker = 0; } _problem = problem; if (problem.isNull()) return; _objectToArea.clear(); PlanningProblem * raw = problem.data(); connect(raw, SIGNAL(startPositionChanged(Position)), this, SLOT(handleStartPositionChanged(Position))); connect(raw, SIGNAL(startPositionRemoved()), this, SLOT(handleStartPositionRemoved())); connect(raw, SIGNAL(areaAdded(QSharedPointer<TaskArea>)), this, SLOT(handleAreaAdded(QSharedPointer<TaskArea>))); }