Changeset View
Changeset View
Standalone View
Standalone View
gui/ksysguard.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | #include <QApplication> | 46 | #include <QApplication> | ||
47 | #include <QCommandLineOption> | 47 | #include <QCommandLineOption> | ||
48 | #include <QCommandLineParser> | 48 | #include <QCommandLineParser> | ||
49 | #include <QDBusConnection> | 49 | #include <QDBusConnection> | ||
50 | #include <QIcon> | 50 | #include <QIcon> | ||
51 | #include <QLabel> | 51 | #include <QLabel> | ||
52 | #include <QSplitter> | 52 | #include <QSplitter> | ||
53 | #include <QStatusBar> | 53 | #include <QStatusBar> | ||
54 | #include <QMenuBar> | ||||
sitter: That should be sorted alphabetically. | |||||
54 | 55 | | |||
55 | #include <KAboutData> | 56 | #include <KAboutData> | ||
56 | #include <KActionCollection> | 57 | #include <KActionCollection> | ||
57 | #include <KDBusService> | 58 | #include <KDBusService> | ||
58 | #include <KEditToolBar> | 59 | #include <KEditToolBar> | ||
59 | #include <KFormat> | 60 | #include <KFormat> | ||
60 | #include <KLocalizedString> | 61 | #include <KLocalizedString> | ||
61 | #include <KMessageBox> | 62 | #include <KMessageBox> | ||
62 | #include <KSharedConfig> | 63 | #include <KSharedConfig> | ||
63 | #include <KStandardAction> | 64 | #include <KStandardAction> | ||
64 | #include <KToggleAction> | 65 | #include <KToggleAction> | ||
65 | #include <KUserTimestamp> | 66 | #include <KUserTimestamp> | ||
66 | #include <KWindowSystem> | 67 | #include <KWindowSystem> | ||
67 | 68 | | |||
68 | #include <ksgrd/SensorAgent.h> | 69 | #include <ksgrd/SensorAgent.h> | ||
69 | #include <ksgrd/SensorManager.h> | 70 | #include <ksgrd/SensorManager.h> | ||
70 | #include <processui/ksysguardprocesslist.h> | 71 | #include <processui/ksysguardprocesslist.h> | ||
71 | 72 | | |||
73 | | ||||
ngraham: Unrelated whitespace change | |||||
72 | //Comment out to stop ksysguard from forking. Good for debugging | 74 | //Comment out to stop ksysguard from forking. Good for debugging | ||
73 | //#define FORK_KSYSGUARD | 75 | //#define FORK_KSYSGUARD | ||
74 | 76 | | |||
75 | static const char Description[] = I18N_NOOP( "KDE System Monitor" ); | 77 | static const char Description[] = I18N_NOOP( "KDE System Monitor" ); | ||
76 | TopLevel* Toplevel; | 78 | TopLevel* Toplevel; | ||
77 | 79 | | |||
78 | TopLevel::TopLevel() | 80 | TopLevel::TopLevel() | ||
79 | : KXmlGuiWindow( nullptr, Qt::WindowFlags(KDE_DEFAULT_WINDOWFLAGS) | Qt::WindowContextHelpButtonHint) | 81 | : KXmlGuiWindow( nullptr, Qt::WindowFlags(KDE_DEFAULT_WINDOWFLAGS) | Qt::WindowContextHelpButtonHint) | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 82 | { | |||
138 | mHotNewWorksheetUploadAction->setIcon( QIcon::fromTheme(QStringLiteral("network-server")) ); | 140 | mHotNewWorksheetUploadAction->setIcon( QIcon::fromTheme(QStringLiteral("network-server")) ); | ||
139 | connect(mHotNewWorksheetUploadAction, &QAction::triggered, mWorkSpace, &Workspace::uploadHotNewWorksheet); | 141 | connect(mHotNewWorksheetUploadAction, &QAction::triggered, mWorkSpace, &Workspace::uploadHotNewWorksheet); | ||
140 | 142 | | |||
141 | mQuitAction = nullptr; | 143 | mQuitAction = nullptr; | ||
142 | 144 | | |||
143 | mConfigureSheetAction = actionCollection()->addAction( QStringLiteral("configure_sheet") ); | 145 | mConfigureSheetAction = actionCollection()->addAction( QStringLiteral("configure_sheet") ); | ||
144 | mConfigureSheetAction->setIcon( QIcon::fromTheme(QStringLiteral("configure")) ); | 146 | mConfigureSheetAction->setIcon( QIcon::fromTheme(QStringLiteral("configure")) ); | ||
145 | connect(mConfigureSheetAction, &QAction::triggered, this, &TopLevel::configureCurrentSheet); | 147 | connect(mConfigureSheetAction, &QAction::triggered, this, &TopLevel::configureCurrentSheet); | ||
146 | 148 | | |||
ngraham: Extra whitespace | |||||
@broulik just pointed out that KStandardAction has gained support for the more modern slot syntax. So, ideally this line should be changed to mShowMenuBarAction = KStandardAction::showMenubar(this, &TopLevel::toggleShowMenuBar, actionCollection()); Which has the advantage of letting the compiler assert slot compatibility, whereas the old SLOT() syntax turns it into a runtime problem which is easy to miss should it break in the future. Not technically a blocking issue though. sitter: @broulik just pointed out that KStandardAction has gained support for the more modern slot… | |||||
149 | // setup 'Settings' menu | ||||
Minor nitpick: "setup" is a noun; it should be "set up" so that there's a verb in the sentence. ngraham: Minor nitpick: "setup" is a noun; it should be "set up" so that there's a verb in the sentence. | |||||
150 | KToggleAction* showMenuBar = KStandardAction::showMenubar(nullptr, nullptr, actionCollection()); | ||||
151 | connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822 | ||||
152 | this, &TopLevel::toggleShowMenuBar, Qt::QueuedConnection); | ||||
153 | | ||||
147 | retranslateUi(); | 154 | retranslateUi(); | ||
148 | } | 155 | } | ||
149 | 156 | | |||
157 | void TopLevel::toggleShowMenuBar() | ||||
158 | { | ||||
159 | const bool visible = menuBar()->isVisible(); | ||||
160 | menuBar()->setVisible(!visible); | ||||
161 | } | ||||
162 | | ||||
150 | void TopLevel::setLocalProcessController(ProcessController * localProcessController) | 163 | void TopLevel::setLocalProcessController(ProcessController * localProcessController) | ||
151 | { | 164 | { | ||
152 | Q_ASSERT(!mLocalProcessController); | 165 | Q_ASSERT(!mLocalProcessController); | ||
153 | mLocalProcessController = localProcessController; | 166 | mLocalProcessController = localProcessController; | ||
154 | connect( mLocalProcessController, &ProcessController::processListChanged, this, &TopLevel::updateProcessCount); | 167 | connect( mLocalProcessController, &ProcessController::processListChanged, this, &TopLevel::updateProcessCount); | ||
155 | for(int i = 0; i < mLocalProcessController->actions().size(); i++) { | 168 | for(int i = 0; i < mLocalProcessController->actions().size(); i++) { | ||
156 | actionCollection()->addAction("processAction" + QString::number(i), mLocalProcessController->actions().at(i)); | 169 | actionCollection()->addAction("processAction" + QString::number(i), mLocalProcessController->actions().at(i)); | ||
157 | } | 170 | } | ||
▲ Show 20 Lines • Show All 460 Lines • Show Last 20 Lines |
That should be sorted alphabetically.