Changeset View
Changeset View
Standalone View
Standalone View
gui/ksysguard.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | #include <unistd.h> | 44 | #include <unistd.h> | ||
45 | 45 | | |||
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 <QMenuBar> | ||||
52 | #include <QSplitter> | 53 | #include <QSplitter> | ||
53 | #include <QStatusBar> | 54 | #include <QStatusBar> | ||
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 | | |||
72 | //Comment out to stop ksysguard from forking. Good for debugging | 73 | //Comment out to stop ksysguard from forking. Good for debugging | ||
ngraham: Unrelated whitespace change | |||||
73 | //#define FORK_KSYSGUARD | 74 | //#define FORK_KSYSGUARD | ||
74 | 75 | | |||
75 | static const char Description[] = I18N_NOOP( "KDE System Monitor" ); | 76 | static const char Description[] = I18N_NOOP( "KDE System Monitor" ); | ||
76 | TopLevel* Toplevel; | 77 | TopLevel* Toplevel; | ||
77 | 78 | | |||
78 | TopLevel::TopLevel() | 79 | TopLevel::TopLevel() | ||
79 | : KXmlGuiWindow( nullptr, Qt::WindowFlags(KDE_DEFAULT_WINDOWFLAGS) | Qt::WindowContextHelpButtonHint) | 80 | : KXmlGuiWindow( nullptr, Qt::WindowFlags(KDE_DEFAULT_WINDOWFLAGS) | Qt::WindowContextHelpButtonHint) | ||
80 | { | 81 | { | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
138 | mHotNewWorksheetUploadAction->setIcon( QIcon::fromTheme(QStringLiteral("network-server")) ); | 139 | mHotNewWorksheetUploadAction->setIcon( QIcon::fromTheme(QStringLiteral("network-server")) ); | ||
139 | connect(mHotNewWorksheetUploadAction, &QAction::triggered, mWorkSpace, &Workspace::uploadHotNewWorksheet); | 140 | connect(mHotNewWorksheetUploadAction, &QAction::triggered, mWorkSpace, &Workspace::uploadHotNewWorksheet); | ||
140 | 141 | | |||
141 | mQuitAction = nullptr; | 142 | mQuitAction = nullptr; | ||
142 | 143 | | |||
143 | mConfigureSheetAction = actionCollection()->addAction( QStringLiteral("configure_sheet") ); | 144 | mConfigureSheetAction = actionCollection()->addAction( QStringLiteral("configure_sheet") ); | ||
144 | mConfigureSheetAction->setIcon( QIcon::fromTheme(QStringLiteral("configure")) ); | 145 | mConfigureSheetAction->setIcon( QIcon::fromTheme(QStringLiteral("configure")) ); | ||
145 | connect(mConfigureSheetAction, &QAction::triggered, this, &TopLevel::configureCurrentSheet); | 146 | connect(mConfigureSheetAction, &QAction::triggered, this, &TopLevel::configureCurrentSheet); | ||
147 | // set up 'Settings' menu | ||||
148 | mShowMenuBarAction = KStandardAction::showMenubar(this, &TopLevel::toggleShowMenuBar, actionCollection()); | ||||
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… | |||||
146 | 149 | | |||
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. | |||||
147 | retranslateUi(); | 150 | retranslateUi(); | ||
148 | } | 151 | } | ||
149 | 152 | | |||
153 | void TopLevel::toggleShowMenuBar() | ||||
154 | { | ||||
155 | if (mShowMenuBarAction->isChecked()) { | ||||
156 | menuBar()->show(); | ||||
157 | } else { | ||||
158 | const QString accel = mShowMenuBarAction->shortcut().toString(); | ||||
159 | KMessageBox::information(this, i18n("This will hide the menu bar completely." | ||||
160 | " You can show it again by typing %1.", accel), | ||||
161 | i18n("Hide menu bar"), QLatin1String("HideMenuBarWarning")); | ||||
162 | menuBar()->hide(); | ||||
163 | } | ||||
164 | } | ||||
165 | | ||||
150 | void TopLevel::setLocalProcessController(ProcessController * localProcessController) | 166 | void TopLevel::setLocalProcessController(ProcessController * localProcessController) | ||
151 | { | 167 | { | ||
152 | Q_ASSERT(!mLocalProcessController); | 168 | Q_ASSERT(!mLocalProcessController); | ||
153 | mLocalProcessController = localProcessController; | 169 | mLocalProcessController = localProcessController; | ||
154 | connect( mLocalProcessController, &ProcessController::processListChanged, this, &TopLevel::updateProcessCount); | 170 | connect( mLocalProcessController, &ProcessController::processListChanged, this, &TopLevel::updateProcessCount); | ||
155 | for(int i = 0; i < mLocalProcessController->actions().size(); i++) { | 171 | for(int i = 0; i < mLocalProcessController->actions().size(); i++) { | ||
156 | actionCollection()->addAction("processAction" + QString::number(i), mLocalProcessController->actions().at(i)); | 172 | actionCollection()->addAction("processAction" + QString::number(i), mLocalProcessController->actions().at(i)); | ||
157 | } | 173 | } | ||
▲ Show 20 Lines • Show All 460 Lines • Show Last 20 Lines |
That should be sorted alphabetically.