void PackageManager::onFinished(PackageKit::Transaction::Exit status, uint runtime) { #ifdef PACKAGEMANAGER_LOG qDebug() << Q_FUNC_INFO << status << runtime; #endif PackageKit::Transaction *t = qobject_cast<PackageKit::Transaction*>(sender()); if (sender() == m_getUpdatesTransaction) { // delete m_getUpdatesTransaction; m_getUpdatesTransaction = 0; } else if (sender() == m_getPackagesTransaction) { // delete m_getPackagesTransaction; m_getPackagesTransaction = 0; } if (t && t->role() == PackageKit::Transaction::RoleRemovePackages) { m_packManContext.setSelectedGroup(PackageKit::Transaction::GroupUnknown); refreshUpdate(); refreshInstalled(); } else if (t && t->role() == PackageKit::Transaction::RoleUpdatePackages) { m_packManContext.setSelectedGroup(PackageKit::Transaction::GroupUnknown); refreshUpdate(); refreshInstalled(); } else if (t && t->role() == PackageKit::Transaction::RoleInstallPackages) { uint group = m_packManContext.selectedGroup(); refreshCache(); // includes refreshUpdate(); refreshInstalled(); if (m_bSimulation == false) { refreshAvailable(group); } } }
ProgressLine::ProgressLine(QWidget *parent, Context *context) : QWidget(parent), context(context) { setFixedHeight(2); hide(); connect(context, SIGNAL(refreshStart()), this, SLOT(show())); connect(context, SIGNAL(refreshEnd()), this, SLOT(hide())); connect(context, SIGNAL(refreshUpdate(QDate)), this, SLOT(show())); // we might miss 1st one connect(context, SIGNAL(refreshUpdate(QDate)), this, SLOT(repaint())); }
void PackageManager::onRefreshCacheFinished(PackageKit::Transaction::Exit status, uint runtime) { #ifdef PACKAGEMANAGER_LOG qDebug() << Q_FUNC_INFO; #endif if (status == PackageKit::Transaction::ExitSuccess) { refreshUpdate(); // refreshInstalled(); } m_refreshCacheTransaction = 0; }
void PackageManager::refreshAll(uint delay) { #ifdef PACKAGEMANAGER_LOG qDebug() << Q_FUNC_INFO << delay; #endif if (delay == 0) { refreshUpdate(); refreshInstalled(); } else { QTimer::singleShot(delay, this, SLOT(refreshAll())); } }
LTMWindow::LTMWindow(Context *context) : GcChartWindow(context), context(context), dirty(true), stackDirty(true), compareDirty(true) { useToToday = useCustom = false; plotted = DateRange(QDate(01,01,01), QDate(01,01,01)); lastRefresh = QTime::currentTime().addSecs(-10); // the plot QVBoxLayout *mainLayout = new QVBoxLayout; QPalette palette; palette.setBrush(QPalette::Background, QBrush(GColor(CTRENDPLOTBACKGROUND))); // single plot plotWidget = new QWidget(this); plotWidget->setPalette(palette); QVBoxLayout *plotLayout = new QVBoxLayout(plotWidget); plotLayout->setSpacing(0); plotLayout->setContentsMargins(0,0,0,0); ltmPlot = new LTMPlot(this, context, true); spanSlider = new QxtSpanSlider(Qt::Horizontal, this); spanSlider->setFocusPolicy(Qt::NoFocus); spanSlider->setHandleMovementMode(QxtSpanSlider::NoOverlapping); spanSlider->setLowerValue(0); spanSlider->setUpperValue(15); QFont smallFont; smallFont.setPointSize(6); scrollLeft = new QPushButton("<", this); scrollLeft->setFont(smallFont); scrollLeft->setAutoRepeat(true); scrollLeft->setFixedHeight(16); scrollLeft->setFixedWidth(16); scrollLeft->setContentsMargins(0,0,0,0); scrollRight = new QPushButton(">", this); scrollRight->setFont(smallFont); scrollRight->setAutoRepeat(true); scrollRight->setFixedHeight(16); scrollRight->setFixedWidth(16); scrollRight->setContentsMargins(0,0,0,0); QHBoxLayout *span = new QHBoxLayout; span->addWidget(scrollLeft); span->addWidget(spanSlider); span->addWidget(scrollRight); plotLayout->addWidget(ltmPlot); plotLayout->addLayout(span); #ifdef Q_OS_MAC // BUG in QMacStyle and painting of spanSlider // so we use a plain style to avoid it, but only // on a MAC, since win and linux are fine #if QT_VERSION > 0x5000 QStyle *style = QStyleFactory::create("fusion"); #else QStyle *style = QStyleFactory::create("Cleanlooks"); #endif spanSlider->setStyle(style); scrollLeft->setStyle(style); scrollRight->setStyle(style); #endif // the stack of plots plotsWidget = new QWidget(this); plotsWidget->setPalette(palette); plotsLayout = new QVBoxLayout(plotsWidget); plotsLayout->setSpacing(0); plotsLayout->setContentsMargins(0,0,0,0); plotArea = new QScrollArea(this); #ifdef Q_OS_WIN QStyle *cde = QStyleFactory::create(OS_STYLE); plotArea->setStyle(cde); #endif plotArea->setAutoFillBackground(false); plotArea->setWidgetResizable(true); plotArea->setWidget(plotsWidget); plotArea->setFrameStyle(QFrame::NoFrame); plotArea->setContentsMargins(0,0,0,0); plotArea->setPalette(palette); // the data table QFont defaultFont; // mainwindow sets up the defaults.. we need to apply #ifdef NOWEBKIT dataSummary = new QWebEngineView(this); dataSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1); dataSummary->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family()); #else dataSummary = new QWebView(this); dataSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); dataSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); #endif dataSummary->setContentsMargins(0,0,0,0); dataSummary->page()->view()->setContentsMargins(0,0,0,0); dataSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); dataSummary->setAcceptDrops(false); // compare plot page compareplotsWidget = new QWidget(this); compareplotsWidget->setPalette(palette); compareplotsLayout = new QVBoxLayout(compareplotsWidget); compareplotsLayout->setSpacing(0); compareplotsLayout->setContentsMargins(0,0,0,0); compareplotArea = new QScrollArea(this); #ifdef Q_OS_WIN cde = QStyleFactory::create(OS_STYLE); compareplotArea->setStyle(cde); #endif compareplotArea->setAutoFillBackground(false); compareplotArea->setWidgetResizable(true); compareplotArea->setWidget(compareplotsWidget); compareplotArea->setFrameStyle(QFrame::NoFrame); compareplotArea->setContentsMargins(0,0,0,0); compareplotArea->setPalette(palette); // the stack stackWidget = new QStackedWidget(this); stackWidget->addWidget(plotWidget); stackWidget->addWidget(dataSummary); stackWidget->addWidget(plotArea); stackWidget->addWidget(compareplotArea); stackWidget->setCurrentIndex(0); mainLayout->addWidget(stackWidget); setChartLayout(mainLayout); HelpWhatsThis *helpStack = new HelpWhatsThis(stackWidget); stackWidget->setWhatsThis(helpStack->getWhatsThisText(HelpWhatsThis::ChartTrends_MetricTrends)); // reveal controls QHBoxLayout *revealLayout = new QHBoxLayout; revealLayout->setContentsMargins(0,0,0,0); revealLayout->addStretch(); revealLayout->addWidget(new QLabel(tr("Group by"),this)); rGroupBy = new QxtStringSpinBox(this); QStringList strings; strings << tr("Days") << tr("Weeks") << tr("Months") << tr("Years") << tr("Time Of Day") << tr("All"); rGroupBy->setStrings(strings); rGroupBy->setValue(0); revealLayout->addWidget(rGroupBy); rData = new QCheckBox(tr("Data Table"), this); rStack = new QCheckBox(tr("Stacked"), this); QVBoxLayout *checks = new QVBoxLayout; checks->setSpacing(2); checks->setContentsMargins(0,0,0,0); checks->addWidget(rData); checks->addWidget(rStack); revealLayout->addLayout(checks); revealLayout->addStretch(); setRevealLayout(revealLayout); // add additional menu items before setting // controls since the menu is SET from setControls QAction *exportData = new QAction(tr("Export Chart Data..."), this); addAction(exportData); // the controls QWidget *c = new QWidget; c->setContentsMargins(0,0,0,0); HelpWhatsThis *helpConfig = new HelpWhatsThis(c); c->setWhatsThis(helpConfig->getWhatsThisText(HelpWhatsThis::ChartTrends_MetricTrends)); QVBoxLayout *cl = new QVBoxLayout(c); cl->setContentsMargins(0,0,0,0); cl->setSpacing(0); setControls(c); // the popup popup = new GcPane(); ltmPopup = new LTMPopup(context); QVBoxLayout *popupLayout = new QVBoxLayout(); popupLayout->addWidget(ltmPopup); popup->setLayout(popupLayout); ltmTool = new LTMTool(context, &settings); // initialise settings.ltmTool = ltmTool; settings.groupBy = LTM_DAY; settings.legend = ltmTool->showLegend->isChecked(); settings.events = ltmTool->showEvents->isChecked(); settings.shadeZones = ltmTool->shadeZones->isChecked(); settings.showData = ltmTool->showData->isChecked(); settings.stack = ltmTool->showStack->isChecked(); settings.stackWidth = ltmTool->stackSlider->value(); rData->setChecked(ltmTool->showData->isChecked()); rStack->setChecked(ltmTool->showStack->isChecked()); cl->addWidget(ltmTool); connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); connect(this, SIGNAL(styleChanged(int)), this, SLOT(styleChanged(int))); connect(ltmTool, SIGNAL(filterChanged()), this, SLOT(filterChanged())); connect(context, SIGNAL(homeFilterChanged()), this, SLOT(filterChanged())); connect(ltmTool->groupBy, SIGNAL(currentIndexChanged(int)), this, SLOT(groupBySelected(int))); connect(rGroupBy, SIGNAL(valueChanged(int)), this, SLOT(rGroupBySelected(int))); connect(ltmTool->applyButton, SIGNAL(clicked(bool)), this, SLOT(applyClicked(void))); connect(ltmTool->shadeZones, SIGNAL(stateChanged(int)), this, SLOT(shadeZonesClicked(int))); connect(ltmTool->showData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int))); connect(rData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int))); connect(ltmTool->showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int))); connect(rStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int))); connect(ltmTool->stackSlider, SIGNAL(valueChanged(int)), this, SLOT(zoomSliderChanged())); connect(ltmTool->showLegend, SIGNAL(stateChanged(int)), this, SLOT(showLegendClicked(int))); connect(ltmTool->showEvents, SIGNAL(stateChanged(int)), this, SLOT(showEventsClicked(int))); connect(ltmTool, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange))); connect(ltmTool, SIGNAL(useThruToday()), this, SLOT(useThruToday())); connect(ltmTool, SIGNAL(useStandardRange()), this, SLOT(useStandardRange())); connect(ltmTool, SIGNAL(curvesChanged()), this, SLOT(refresh())); connect(context, SIGNAL(filterChanged()), this, SLOT(filterChanged())); connect(context, SIGNAL(refreshUpdate(QDate)), this, SLOT(refreshUpdate(QDate))); connect(context, SIGNAL(refreshEnd()), this, SLOT(refresh())); // comparing things connect(context, SIGNAL(compareDateRangesStateChanged(bool)), this, SLOT(compareChanged())); connect(context, SIGNAL(compareDateRangesChanged()), this, SLOT(compareChanged())); connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void))); connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void))); connect(context, SIGNAL(rideSaved(RideItem*)), this, SLOT(refresh(void))); connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32))); connect(context, SIGNAL(presetSelected(int)), this, SLOT(presetSelected(int))); // custom menu item connect(exportData, SIGNAL(triggered()), this, SLOT(exportData())); // normal view connect(spanSlider, SIGNAL(lowerPositionChanged(int)), this, SLOT(spanSliderChanged())); connect(spanSlider, SIGNAL(upperPositionChanged(int)), this, SLOT(spanSliderChanged())); connect(scrollLeft, SIGNAL(clicked()), this, SLOT(moveLeft())); connect(scrollRight, SIGNAL(clicked()), this, SLOT(moveRight())); configChanged(CONFIG_APPEARANCE); }