Changeset View
Changeset View
Standalone View
Standalone View
krusader/Dialogs/krspecialwidgets.cpp
Show All 24 Lines | |||||
25 | #include "krmaskchoice.h" | 25 | #include "krmaskchoice.h" | ||
26 | #include "newftpgui.h" | 26 | #include "newftpgui.h" | ||
27 | #include "../krglobal.h" | 27 | #include "../krglobal.h" | ||
28 | 28 | | |||
29 | // QtGui | 29 | // QtGui | ||
30 | #include <QPaintEvent> | 30 | #include <QPaintEvent> | ||
31 | 31 | | |||
32 | #include <KI18n/KLocalizedString> | 32 | #include <KI18n/KLocalizedString> | ||
33 | #include <utility> | ||||
33 | 34 | | |||
34 | ///////////////////////////////////////////////////////////////////////////// | 35 | ///////////////////////////////////////////////////////////////////////////// | ||
35 | /////////////////////// Pie related widgets ///////////////////////////////// | 36 | /////////////////////// Pie related widgets ///////////////////////////////// | ||
36 | ///////////////////////////////////////////////////////////////////////////// | 37 | ///////////////////////////////////////////////////////////////////////////// | ||
37 | // The pie-related widgets use hard-coded coordinates to create the look. | 38 | // The pie-related widgets use hard-coded coordinates to create the look. | ||
38 | // This is ok since the whole widget is fitted into an existing view and thus | 39 | // This is ok since the whole widget is fitted into an existing view and thus | ||
39 | // no re-alignments are needed. | 40 | // no re-alignments are needed. | ||
40 | 41 | | |||
Show All 11 Lines | 50 | QColor KRPie::colors[ 12 ] = {Qt::red, Qt::blue, Qt::green, Qt::cyan, Qt::magenta, Qt::gray, | |||
52 | }; | 53 | }; | ||
53 | 54 | | |||
54 | ////////////////////////////////////////////////////////////////////////////// | 55 | ////////////////////////////////////////////////////////////////////////////// | ||
55 | /////////////// KRFSDisplay - Filesystem / Freespace Display ///////////////// | 56 | /////////////// KRFSDisplay - Filesystem / Freespace Display ///////////////// | ||
56 | ////////////////////////////////////////////////////////////////////////////// | 57 | ////////////////////////////////////////////////////////////////////////////// | ||
57 | // This is the full constructor: use it for a mounted filesystem | 58 | // This is the full constructor: use it for a mounted filesystem | ||
58 | KRFSDisplay::KRFSDisplay(QWidget *parent, QString _alias, QString _realName, | 59 | KRFSDisplay::KRFSDisplay(QWidget *parent, QString _alias, QString _realName, | ||
59 | KIO::filesize_t _total, KIO::filesize_t _free) : QWidget(parent), totalSpace(_total), | 60 | KIO::filesize_t _total, KIO::filesize_t _free) : QWidget(parent), totalSpace(_total), | ||
60 | freeSpace(_free), alias(_alias), realName(_realName), mounted(true), | 61 | freeSpace(_free), alias(std::move(_alias)), realName(std::move(_realName)), mounted(true), | ||
61 | empty(false), supermount(false) | 62 | empty(false), supermount(false) | ||
62 | { | 63 | { | ||
63 | 64 | | |||
64 | int leftMargin, topMargin, rightMargin, bottomMargin; | 65 | int leftMargin, topMargin, rightMargin, bottomMargin; | ||
65 | getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | 66 | getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | ||
66 | resize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | 67 | resize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | ||
67 | setMinimumSize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | 68 | setMinimumSize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | ||
68 | show(); | 69 | show(); | ||
69 | } | 70 | } | ||
70 | 71 | | |||
71 | // Use this one for an unmounted filesystem | 72 | // Use this one for an unmounted filesystem | ||
72 | KRFSDisplay::KRFSDisplay(QWidget *parent, QString _alias, QString _realName, bool sm) : | 73 | KRFSDisplay::KRFSDisplay(QWidget *parent, QString _alias, QString _realName, bool sm) : | ||
73 | QWidget(parent), alias(_alias), realName(_realName), mounted(false), | 74 | QWidget(parent), alias(std::move(_alias)), realName(std::move(_realName)), mounted(false), | ||
74 | empty(false), supermount(sm) | 75 | empty(false), supermount(sm) | ||
75 | { | 76 | { | ||
76 | 77 | | |||
77 | int leftMargin, topMargin, rightMargin, bottomMargin; | 78 | int leftMargin, topMargin, rightMargin, bottomMargin; | ||
78 | getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | 79 | getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin); | ||
79 | resize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | 80 | resize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | ||
80 | setMinimumSize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | 81 | setMinimumSize(150 + leftMargin + rightMargin, 200 + topMargin + bottomMargin); | ||
81 | show(); | 82 | show(); | ||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | 173 | { | |||
207 | paint.drawArc(LEFT, BOTTOM, WIDTH, HEIGHT, STARTANGLE, 360 * 16); | 208 | paint.drawArc(LEFT, BOTTOM, WIDTH, HEIGHT, STARTANGLE, 360 * 16); | ||
208 | 209 | | |||
209 | } | 210 | } | ||
210 | 211 | | |||
211 | void KRPie::addSlice(KIO::filesize_t size, QString label) | 212 | void KRPie::addSlice(KIO::filesize_t size, QString label) | ||
212 | { | 213 | { | ||
213 | int i = (slices.count() % 12); | 214 | int i = (slices.count() % 12); | ||
214 | slices.removeLast(); | 215 | slices.removeLast(); | ||
215 | slices.push_back(KRPieSlice(size * 100 / totalSize, colors[ i ], label)); | 216 | slices.push_back(KRPieSlice(size * 100 / totalSize, colors[ i ], std::move(label))); | ||
216 | sizeLeft -= size; | 217 | sizeLeft -= size; | ||
217 | slices.push_back(KRPieSlice(sizeLeft * 100 / totalSize, Qt::yellow, "DEFAULT")); | 218 | slices.push_back(KRPieSlice(sizeLeft * 100 / totalSize, Qt::yellow, "DEFAULT")); | ||
218 | } | 219 | } |