Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:epopov:branches:openSUSE:Factory
ksysguard5
2000-fixup.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2000-fixup.patch of Package ksysguard5
diff --git a/gui/SensorDisplayLib/FancyPlotter.cpp b/gui/SensorDisplayLib/FancyPlotter.cpp index 1d84a128348f7b09e5baae5161c4d1afff65d24e..180fc42cd4ac0978f0997c189829b3675a7049f8 100644 --- a/gui/SensorDisplayLib/FancyPlotter.cpp +++ b/gui/SensorDisplayLib/FancyPlotter.cpp @@ -34,6 +34,7 @@ #include <KMessageBox> #include <ksignalplotter.h> +#include <QFrame> #include <ksgrd/SensorManager.h> #include "StyleEngine.h" @@ -172,18 +173,27 @@ FancyPlotter::FancyPlotter( QWidget* parent, mIndicatorSymbol = circleCharacter(QFontMetrics(QToolTip::font())); QBoxLayout *layout = new QVBoxLayout(this); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); mPlotter = new KSignalPlotter( this ); - int axisTextWidth = fontMetrics().boundingRect(i18nc("Largest axis title", "99999 XXXX")).width(); - mPlotter->setMaxAxisTextWidth( axisTextWidth ); mPlotter->setUseAutoRange( true ); mHeading = new QLabel(translatedTitle(), this); QFont headingFont; headingFont.setWeight(QFont::Bold); headingFont.setPointSizeF(headingFont.pointSizeF() * 1.19); mHeading->setFont(headingFont); + QWidget *plotterFrameBackground = new QWidget; + plotterFrameBackground->setAutoFillBackground(true); + plotterFrameBackground->setBackgroundRole(QPalette::Base); + QVBoxLayout *plotterFrameBackgroundLayout = new QVBoxLayout(plotterFrameBackground); + plotterFrameBackgroundLayout->addWidget(mPlotter); + QFrame *plotterFrame = new QFrame; + plotterFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + QVBoxLayout *plotterFrameLayout = new QVBoxLayout(plotterFrame); + plotterFrameLayout->setContentsMargins(0, 0, 0, 0); + plotterFrameLayout->addWidget(plotterFrameBackground); layout->addWidget(mHeading); - layout->addWidget(mPlotter); + layout->addWidget(plotterFrame); /* Create a set of labels underneath the graph. */ mLabelsWidget = new QWidget; @@ -192,9 +202,6 @@ FancyPlotter::FancyPlotter( QWidget* parent, outerLabelLayout->setSpacing(0); outerLabelLayout->setContentsMargins(0,0,0,0); - /* create a spacer to fill up the space up to the start of the graph */ - outerLabelLayout->addItem(new QSpacerItem(axisTextWidth + 10, 0, QSizePolicy::Preferred)); - mLabelLayout = new QHBoxLayout; outerLabelLayout->addLayout(mLabelLayout); mLabelLayout->setContentsMargins(0,0,0,0); @@ -218,8 +225,10 @@ FancyPlotter::~FancyPlotter() void FancyPlotter::setTitle( const QString &title ) { //virtual KSGRD::SensorDisplay::setTitle( title ); - if(mHeading) + if(mHeading) { mHeading->setText(translatedTitle()); + updateLayout(); + } } bool FancyPlotter::eventFilter( QObject* object, QEvent* event ) { //virtual @@ -358,16 +367,7 @@ void FancyPlotter::applySettings() { void FancyPlotter::resizeEvent( QResizeEvent* ) { - bool showHeading = true; - bool showLabels = true; - - if( height() < mLabelsWidget->sizeHint().height() + mHeading->sizeHint().height() + mPlotter->minimumHeight() ) - showHeading = false; - if( height() < mLabelsWidget->sizeHint().height() + mPlotter->minimumHeight() ) - showLabels = false; - mHeading->setVisible(showHeading); - mLabelsWidget->setVisible(showLabels); - + updateLayout(); } void FancyPlotter::reorderBeams(const QList<int> & orderOfBeams) @@ -630,6 +630,20 @@ void FancyPlotter::sendDataToPlotter( ) } mSampleBuf.clear(); } + +void FancyPlotter::updateLayout() +{ + bool showHeading = !mHeading->text().isEmpty(); + bool showLabels = true; + + if( height() < mLabelsWidget->sizeHint().height() + mHeading->sizeHint().height() + mPlotter->minimumHeight() ) + showHeading = false; + if( height() < mLabelsWidget->sizeHint().height() + mPlotter->minimumHeight() ) + showLabels = false; + mHeading->setVisible(showHeading); + mLabelsWidget->setVisible(showLabels); +} + void FancyPlotter::timerTick() //virtual { if(mNumAnswers < sensors().count()) @@ -808,7 +822,7 @@ bool FancyPlotter::restoreSettings( QDomElement &element ) mPlotter->setStackGraph( element.attribute(QStringLiteral("stacked"), QStringLiteral("0")).toInt()); QString filename = element.attribute( QStringLiteral("svgBackground")); - if (!filename.isEmpty() && filename[0] == QLatin1Char('/')) { + if (!filename.isEmpty() && filename[0] != QLatin1Char('/')) { filename = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("ksysguard/") + filename); } mPlotter->setSvgBackground( filename ); diff --git a/gui/SensorDisplayLib/FancyPlotter.h b/gui/SensorDisplayLib/FancyPlotter.h index 6a1db034906b4ca73a482b494484829e159e1431..71f7acd9082e979803bc4b1773e5102010e613fd 100644 --- a/gui/SensorDisplayLib/FancyPlotter.h +++ b/gui/SensorDisplayLib/FancyPlotter.h @@ -104,6 +104,7 @@ class FancyPlotter : public KSGRD::SensorDisplay private: void sendDataToPlotter(); + void updateLayout(); uint mBeams; int mNumAnswers; diff --git a/gui/SystemLoad2.sgrd b/gui/SystemLoad2.sgrd index d56d32332ca7f4d64e1718510867c011362a35af..860a2ce62a1da2bf150c2af6c3a04795d69f9b27 100644 --- a/gui/SystemLoad2.sgrd +++ b/gui/SystemLoad2.sgrd @@ -6,7 +6,7 @@ <beam sensorType="float" hostName="localhost" regexpSensorName="cpu/cpu.*/TotalLoad" color="0xffff8000,0xffe20800" /> </display> <display title="Memory and Swap History" svgBackground="widgets/plot-background" autoRange="0" class="FancyPlotter" column="0" row="1" version="1" > - <beam summationName="Memory" sensorName="mem/physical/application" sensorType="integer" hostName="localhost" color="0xffc000c0" /> + <beam summationName="Memory" sensorName="mem/physical/allocated" sensorType="integer" hostName="localhost" color="0xffc000c0" /> <beam summationName="Swap" sensorName="mem/swap/used" sensorType="integer" hostName="localhost" color="0xff00c000" /> </display> <display title="Network History" svgBackground="widgets/plot-background" autoRange="1" class="FancyPlotter" column="0" row="2" version="1" min="0" max="20" manualRange="1"> diff --git a/gui/Workspace.cpp b/gui/Workspace.cpp index 8505848ad21e7de3856e441c99fa1d027f09f91e..96e59e750fa6a5a23a48c3fbcce2daba96d9fbe2 100644 --- a/gui/Workspace.cpp +++ b/gui/Workspace.cpp @@ -73,11 +73,6 @@ void Workspace::readProperties( const KConfigGroup& cfg ) * then "restore" a special default configuration. */ selectedSheets << QStringLiteral("ProcessTable.sgrd"); selectedSheets << QStringLiteral("SystemLoad2.sgrd"); - } else if(selectedSheets[0] != QLatin1String("ProcessTable.sgrd")) { - //We need to make sure that this is really is the process table on the first tab. No GUI way of changing this, but should make sure anyway. - //Plus this migrates users from the kde3 setup - selectedSheets.removeAll(QStringLiteral("ProcessTable.sgrd")); - selectedSheets.prepend( QStringLiteral("ProcessTable.sgrd")); } int oldSystemLoad = selectedSheets.indexOf(QLatin1String("SystemLoad.sgrd")); diff --git a/gui/ksysguard.cpp b/gui/ksysguard.cpp index 2590a4947afdc00b55a3e33e4c21aed2570db4c7..669c2bfe5ca38f3fa3a3cf1ec253d8dde696cb12 100644 --- a/gui/ksysguard.cpp +++ b/gui/ksysguard.cpp @@ -369,7 +369,7 @@ void TopLevel::timerEvent( QTimerEvent* ) (KSGRD::SensorClient*)this, 2 ); KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/physical/used"), (KSGRD::SensorClient*)this, 3 ); - KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/physical/application"), + KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/physical/allocated"), (KSGRD::SensorClient*)this, 4 ); KSGRD::SensorMgr->sendRequest( localhostString, QStringLiteral("mem/swap/free"), (KSGRD::SensorClient*)this, 5 ); @@ -452,7 +452,7 @@ void TopLevel::answerReceived( int id, const QList<QByteArray> &answerList ) QString s; static QString unit; static qlonglong mFree = 0; - static qlonglong mUsedApplication = 0; + static qlonglong mAllocated = 0; static qlonglong mUsedTotal = 0; static qlonglong sUsed = 0; static qlonglong sFree = 0; @@ -476,8 +476,8 @@ void TopLevel::answerReceived( int id, const QList<QByteArray> &answerList ) case 4: { - mUsedApplication = answer.toLongLong(); - const auto used = KFormat().formatByteSize( mUsedApplication*1024); + mAllocated = answer.toLongLong(); + const auto used = KFormat().formatByteSize( mAllocated*1024); const auto total = KFormat().formatByteSize( (mFree+mUsedTotal)*1024 ); //Use a multi-length string s = i18nc( "Arguments are formatted byte sizes (used/total)", "Memory: %1 / %2", used, total );
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor