1 |
doktor5000 |
816434 |
Index: lxqt-panel-0.8.0/panel/lxqtpanel.cpp |
2 |
|
|
=================================================================== |
3 |
|
|
--- lxqt-panel-0.8.0/panel/lxqtpanel.cpp |
4 |
|
|
+++ lxqt-panel-0.8.0/panel/lxqtpanel.cpp 2015-01-12 13:16:16.042896979 +0100 |
5 |
|
|
@@ -62,6 +62,8 @@ |
6 |
|
|
#define CFG_KEY_LINECNT "lineCount" |
7 |
|
|
#define CFG_KEY_LENGTH "width" |
8 |
|
|
#define CFG_KEY_PERCENT "width-percent" |
9 |
|
|
+#define CFG_KEY_BACKGROUNDCOLOR "background-color" |
10 |
|
|
+#define CFG_KEY_BACKGROUNDIMAGE "background-image" |
11 |
|
|
#define CFG_KEY_ALIGNMENT "alignment" |
12 |
|
|
#define CFG_KEY_PLUGINS "plugins" |
13 |
|
|
|
14 |
|
|
@@ -171,17 +173,28 @@ |
15 |
|
|
mSettings->beginGroup(mConfigGroup); |
16 |
|
|
|
17 |
|
|
// By default we are using size & count from theme. |
18 |
|
|
- setPanelSize(mSettings->value(CFG_KEY_PANELSIZE, PANEL_DEFAULT_SIZE).toInt()); |
19 |
|
|
- setIconSize(mSettings->value(CFG_KEY_ICONSIZE, PANEL_DEFAULT_ICON_SIZE).toInt()); |
20 |
|
|
- setLineCount(mSettings->value(CFG_KEY_LINECNT, PANEL_DEFAULT_LINE_COUNT).toInt()); |
21 |
|
|
+ setPanelSize(mSettings->value(CFG_KEY_PANELSIZE, PANEL_DEFAULT_SIZE).toInt(), false); |
22 |
|
|
+ setIconSize(mSettings->value(CFG_KEY_ICONSIZE, PANEL_DEFAULT_ICON_SIZE).toInt(), false); |
23 |
|
|
+ setLineCount(mSettings->value(CFG_KEY_LINECNT, PANEL_DEFAULT_LINE_COUNT).toInt(), false); |
24 |
|
|
|
25 |
|
|
setLength(mSettings->value(CFG_KEY_LENGTH, 100).toInt(), |
26 |
|
|
- mSettings->value(CFG_KEY_PERCENT, true).toBool()); |
27 |
|
|
+ mSettings->value(CFG_KEY_PERCENT, true).toBool(), |
28 |
|
|
+ false); |
29 |
|
|
|
30 |
|
|
setPosition(mSettings->value(CFG_KEY_SCREENNUM, QApplication::desktop()->primaryScreen()).toInt(), |
31 |
|
|
- strToPosition(mSettings->value(CFG_KEY_POSITION).toString(), PositionBottom)); |
32 |
|
|
+ strToPosition(mSettings->value(CFG_KEY_POSITION).toString(), PositionBottom), |
33 |
|
|
+ false); |
34 |
|
|
+ |
35 |
|
|
+ setAlignment(Alignment(mSettings->value(CFG_KEY_ALIGNMENT, mAlignment).toInt()), false); |
36 |
|
|
+ |
37 |
|
|
+ QColor color = mSettings->value(CFG_KEY_BACKGROUNDCOLOR, "").value<QColor>(); |
38 |
|
|
+ if (color.isValid()) |
39 |
|
|
+ setBackgroundColor(color, true); |
40 |
|
|
+ |
41 |
|
|
+ QString image = mSettings->value(CFG_KEY_BACKGROUNDIMAGE, "").toString(); |
42 |
|
|
+ if (!image.isEmpty()) |
43 |
|
|
+ setBackgroundImage(image, false); |
44 |
|
|
|
45 |
|
|
- setAlignment(LxQtPanel::Alignment(mSettings->value(CFG_KEY_ALIGNMENT, mAlignment).toInt())); |
46 |
|
|
mSettings->endGroup(); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
@@ -228,6 +241,9 @@ |
50 |
|
|
|
51 |
|
|
mSettings->setValue(CFG_KEY_ALIGNMENT, mAlignment); |
52 |
|
|
|
53 |
|
|
+ mSettings->setValue(CFG_KEY_BACKGROUNDCOLOR, mBackgroundColor.isValid() ? mBackgroundColor : QColor()); |
54 |
|
|
+ mSettings->setValue(CFG_KEY_BACKGROUNDIMAGE, QFileInfo(mBackgroundImage).exists() ? mBackgroundImage : QString()); |
55 |
|
|
+ |
56 |
|
|
mSettings->endGroup(); |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
@@ -238,7 +254,8 @@ |
60 |
|
|
void LxQtPanel::ensureVisible() |
61 |
|
|
{ |
62 |
|
|
if (! canPlacedOn(mScreenNum, mPosition)) |
63 |
|
|
- setPosition(findAvailableScreen(mPosition), mPosition); |
64 |
|
|
+ setPosition(findAvailableScreen(mPosition), mPosition, true); |
65 |
|
|
+ |
66 |
|
|
// the screen size might be changed, let's update the reserved screen space. |
67 |
|
|
updateWmStrut(); |
68 |
|
|
} |
69 |
|
|
@@ -639,6 +656,21 @@ |
70 |
|
|
sheet << QString("Plugin > * { qproperty-iconSize: %1px %1px; }").arg(mIconSize); |
71 |
|
|
sheet << QString("Plugin > * > * { qproperty-iconSize: %1px %1px; }").arg(mIconSize); |
72 |
|
|
|
73 |
|
|
+ QString object = LxQtPanelWidget->objectName(); |
74 |
|
|
+ if (mBackgroundColor.isValid()) |
75 |
|
|
+ { |
76 |
|
|
+ QString color = QString("%1, %2, %3, %5") |
77 |
|
|
+ .arg(mBackgroundColor.red()) |
78 |
|
|
+ .arg(mBackgroundColor.green()) |
79 |
|
|
+ .arg(mBackgroundColor.blue()) |
80 |
|
|
+ .arg((float) mBackgroundColor.alpha() / 255); |
81 |
|
|
+ |
82 |
|
|
+ sheet << QString("LxQtPanel #" + object + " { background-color: rgba(" + color + "); }"); |
83 |
|
|
+ } |
84 |
|
|
+ |
85 |
|
|
+ if (QFileInfo(mBackgroundImage).exists()) |
86 |
|
|
+ sheet << QString("LxQtPanel #" + object + " { background-image: url('" + mBackgroundImage + "');}"); |
87 |
|
|
+ |
88 |
|
|
setStyleSheet(sheet.join("\n")); |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
@@ -647,14 +679,16 @@ |
92 |
|
|
/************************************************ |
93 |
|
|
|
94 |
|
|
************************************************/ |
95 |
|
|
-void LxQtPanel::setPanelSize(int value) |
96 |
|
|
+void LxQtPanel::setPanelSize(int value, bool save) |
97 |
|
|
{ |
98 |
|
|
if (mPanelSize != value) |
99 |
|
|
{ |
100 |
|
|
mPanelSize = value; |
101 |
|
|
realign(); |
102 |
|
|
emit realigned(); |
103 |
|
|
- saveSettings(true); |
104 |
|
|
+ |
105 |
|
|
+ if (save) |
106 |
|
|
+ saveSettings(true); |
107 |
|
|
} |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
@@ -663,14 +697,16 @@ |
111 |
|
|
/************************************************ |
112 |
|
|
|
113 |
|
|
************************************************/ |
114 |
|
|
-void LxQtPanel::setIconSize(int value) |
115 |
|
|
+void LxQtPanel::setIconSize(int value, bool save) |
116 |
|
|
{ |
117 |
|
|
if (mIconSize != value) |
118 |
|
|
{ |
119 |
|
|
mIconSize = value; |
120 |
|
|
updateStyleSheet(); |
121 |
|
|
mLayout->setLineSize(mIconSize); |
122 |
|
|
- saveSettings(true); |
123 |
|
|
+ |
124 |
|
|
+ if (save) |
125 |
|
|
+ saveSettings(true); |
126 |
|
|
|
127 |
|
|
realign(); |
128 |
|
|
emit realigned(); |
129 |
|
|
@@ -681,7 +717,7 @@ |
130 |
|
|
/************************************************ |
131 |
|
|
|
132 |
|
|
************************************************/ |
133 |
|
|
-void LxQtPanel::setLineCount(int value) |
134 |
|
|
+void LxQtPanel::setLineCount(int value, bool save) |
135 |
|
|
{ |
136 |
|
|
if (mLineCount != value) |
137 |
|
|
{ |
138 |
|
|
@@ -689,7 +725,9 @@ |
139 |
|
|
mLayout->setEnabled(false); |
140 |
|
|
mLayout->setLineCount(mLineCount); |
141 |
|
|
mLayout->setEnabled(true); |
142 |
|
|
- saveSettings(true); |
143 |
|
|
+ |
144 |
|
|
+ if (save) |
145 |
|
|
+ saveSettings(true); |
146 |
|
|
|
147 |
|
|
realign(); |
148 |
|
|
emit realigned(); |
149 |
|
|
@@ -700,7 +738,7 @@ |
150 |
|
|
/************************************************ |
151 |
|
|
|
152 |
|
|
************************************************/ |
153 |
|
|
-void LxQtPanel::setLength(int length, bool inPercents) |
154 |
|
|
+void LxQtPanel::setLength(int length, bool inPercents, bool save) |
155 |
|
|
{ |
156 |
|
|
if (mLength == length && |
157 |
|
|
mLengthInPercents == inPercents) |
158 |
|
|
@@ -708,7 +746,9 @@ |
159 |
|
|
|
160 |
|
|
mLength = length; |
161 |
|
|
mLengthInPercents = inPercents; |
162 |
|
|
- saveSettings(true); |
163 |
|
|
+ |
164 |
|
|
+ if (save) |
165 |
|
|
+ saveSettings(true); |
166 |
|
|
|
167 |
|
|
realign(); |
168 |
|
|
emit realigned(); |
169 |
|
|
@@ -718,7 +758,7 @@ |
170 |
|
|
/************************************************ |
171 |
|
|
|
172 |
|
|
************************************************/ |
173 |
|
|
-void LxQtPanel::setPosition(int screen, ILxQtPanel::Position position) |
174 |
|
|
+void LxQtPanel::setPosition(int screen, ILxQtPanel::Position position, bool save) |
175 |
|
|
{ |
176 |
|
|
if (mScreenNum == screen && |
177 |
|
|
mPosition == position) |
178 |
|
|
@@ -727,7 +767,9 @@ |
179 |
|
|
mScreenNum = screen; |
180 |
|
|
mPosition = position; |
181 |
|
|
mLayout->setPosition(mPosition); |
182 |
|
|
- saveSettings(true); |
183 |
|
|
+ |
184 |
|
|
+ if (save) |
185 |
|
|
+ saveSettings(true); |
186 |
|
|
|
187 |
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
188 |
|
|
// Qt 5 adds a new class QScreen and add API for setting the screen of a QWindow. |
189 |
|
|
@@ -757,17 +799,42 @@ |
190 |
|
|
emit realigned(); |
191 |
|
|
} |
192 |
|
|
|
193 |
|
|
+/************************************************ |
194 |
|
|
+ |
195 |
|
|
+ ************************************************/ |
196 |
|
|
+void LxQtPanel::setBackgroundColor(QColor color, bool save) |
197 |
|
|
+{ |
198 |
|
|
+ mBackgroundColor = color; |
199 |
|
|
+ updateStyleSheet(); |
200 |
|
|
+ |
201 |
|
|
+ if (save) |
202 |
|
|
+ saveSettings(true); |
203 |
|
|
+} |
204 |
|
|
|
205 |
|
|
/************************************************ |
206 |
|
|
|
207 |
|
|
************************************************/ |
208 |
|
|
-void LxQtPanel::setAlignment(LxQtPanel::Alignment value) |
209 |
|
|
+void LxQtPanel::setBackgroundImage(QString path, bool save) |
210 |
|
|
+{ |
211 |
|
|
+ mBackgroundImage = path; |
212 |
|
|
+ updateStyleSheet(); |
213 |
|
|
+ |
214 |
|
|
+ if (save) |
215 |
|
|
+ saveSettings(true); |
216 |
|
|
+} |
217 |
|
|
+ |
218 |
|
|
+/************************************************ |
219 |
|
|
+ |
220 |
|
|
+ ************************************************/ |
221 |
|
|
+void LxQtPanel::setAlignment(Alignment value, bool save) |
222 |
|
|
{ |
223 |
|
|
if (mAlignment == value) |
224 |
|
|
return; |
225 |
|
|
|
226 |
|
|
mAlignment = value; |
227 |
|
|
- saveSettings(true); |
228 |
|
|
+ |
229 |
|
|
+ if (save) |
230 |
|
|
+ saveSettings(true); |
231 |
|
|
|
232 |
|
|
realign(); |
233 |
|
|
emit realigned(); |
234 |
|
|
Index: lxqt-panel-0.8.0/panel/lxqtpanel.h |
235 |
|
|
=================================================================== |
236 |
|
|
--- lxqt-panel-0.8.0/panel/lxqtpanel.h |
237 |
|
|
+++ lxqt-panel-0.8.0/panel/lxqtpanel.h 2015-01-12 13:14:01.973301570 +0100 |
238 |
|
|
@@ -81,7 +81,6 @@ |
239 |
|
|
static QString positionToStr(ILxQtPanel::Position position); |
240 |
|
|
static ILxQtPanel::Position strToPosition(const QString &str, ILxQtPanel::Position defaultValue); |
241 |
|
|
|
242 |
|
|
- |
243 |
|
|
// Settings |
244 |
|
|
int panelSize() const { return mPanelSize; } |
245 |
|
|
int iconSize() const { return mIconSize; } |
246 |
|
|
@@ -90,6 +89,8 @@ |
247 |
|
|
bool lengthInPercents() const { return mLengthInPercents; } |
248 |
|
|
LxQtPanel::Alignment alignment() const { return mAlignment; } |
249 |
|
|
int screenNum() const { return mScreenNum; } |
250 |
|
|
+ QColor backgroundColor() const { return mBackgroundColor; }; |
251 |
|
|
+ QString backgroundImage() const { return mBackgroundImage; }; |
252 |
|
|
|
253 |
|
|
LxQt::Settings *settings() const { return mSettings; } |
254 |
|
|
|
255 |
|
|
@@ -97,12 +98,14 @@ |
256 |
|
|
void show(); |
257 |
|
|
|
258 |
|
|
// Settings |
259 |
|
|
- void setPanelSize(int value); |
260 |
|
|
- void setIconSize(int value); |
261 |
|
|
- void setLineCount(int value); |
262 |
|
|
- void setLength(int length, bool inPercents); |
263 |
|
|
- void setPosition(int screen, ILxQtPanel::Position position); |
264 |
|
|
- void setAlignment(LxQtPanel::Alignment value); |
265 |
|
|
+ void setPanelSize(int value, bool save); |
266 |
|
|
+ void setIconSize(int value, bool save); |
267 |
|
|
+ void setLineCount(int value, bool save); |
268 |
|
|
+ void setLength(int length, bool inPercents, bool save); |
269 |
|
|
+ void setPosition(int screen, ILxQtPanel::Position position, bool save); |
270 |
|
|
+ void setBackgroundColor(QColor color, bool save); |
271 |
|
|
+ void setBackgroundImage(QString path, bool save); |
272 |
|
|
+ void setAlignment(LxQtPanel::Alignment value, bool save); |
273 |
|
|
|
274 |
|
|
void saveSettings(bool later=false); |
275 |
|
|
void ensureVisible(); |
276 |
|
|
@@ -150,12 +153,15 @@ |
277 |
|
|
int mLength; |
278 |
|
|
bool mLengthInPercents; |
279 |
|
|
|
280 |
|
|
- LxQtPanel::Alignment mAlignment; |
281 |
|
|
+ Alignment mAlignment; |
282 |
|
|
|
283 |
|
|
ILxQtPanel::Position mPosition; |
284 |
|
|
int mScreenNum; |
285 |
|
|
QTimer mDelaySave; |
286 |
|
|
|
287 |
|
|
+ QColor mBackgroundColor; |
288 |
|
|
+ QString mBackgroundImage; |
289 |
|
|
+ |
290 |
|
|
void updateStyleSheet(); |
291 |
|
|
}; |
292 |
|
|
|
293 |
|
|
Index: lxqt-panel-0.8.0/panel/lxqtpanellimits.h |
294 |
|
|
=================================================================== |
295 |
|
|
--- lxqt-panel-0.8.0/panel/lxqtpanellimits.h |
296 |
|
|
+++ lxqt-panel-0.8.0/panel/lxqtpanellimits.h 2015-01-12 13:14:01.973301570 +0100 |
297 |
|
|
@@ -35,5 +35,7 @@ |
298 |
|
|
#define PANEL_DEFAULT_ICON_SIZE 22 |
299 |
|
|
#define PANEL_DEFAULT_LINE_COUNT 1 |
300 |
|
|
|
301 |
|
|
+#define PANEL_DEFAULT_BACKGROUND_COLOR "#CCCCCC" |
302 |
|
|
+ |
303 |
|
|
#define SETTINGS_SAVE_DELAY 3000 |
304 |
|
|
#endif // LXQTPANELLIMITS_H |
305 |
|
|
Index: lxqt-panel-0.8.0/panel/config/configpaneldialog.cpp |
306 |
|
|
=================================================================== |
307 |
|
|
--- lxqt-panel-0.8.0/panel/config/configpaneldialog.cpp |
308 |
|
|
+++ lxqt-panel-0.8.0/panel/config/configpaneldialog.cpp 2015-01-12 13:14:01.972301583 +0100 |
309 |
|
|
@@ -34,6 +34,9 @@ |
310 |
|
|
#include <QDesktopWidget> |
311 |
|
|
|
312 |
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
313 |
|
|
+#include <QColorDialog> |
314 |
|
|
+#include <QFileDialog> |
315 |
|
|
+#include <QStandardPaths> |
316 |
|
|
#include <QWindow> |
317 |
|
|
#endif |
318 |
|
|
|
319 |
|
|
@@ -102,12 +105,13 @@ |
320 |
|
|
mPanel(panel) |
321 |
|
|
{ |
322 |
|
|
ui->setupUi(this); |
323 |
|
|
+ |
324 |
|
|
fillComboBox_position(); |
325 |
|
|
fillComboBox_alignment(); |
326 |
|
|
|
327 |
|
|
mOldPanelSize = mPanel->panelSize(); |
328 |
|
|
- mOldIconSize = mPanel->iconSize(); |
329 |
|
|
- mOldLineCount = mPanel->lineCount(); |
330 |
|
|
+ mOldIconSize = mPanel->iconSize(); |
331 |
|
|
+ mOldLineCount = mPanel->lineCount(); |
332 |
|
|
|
333 |
|
|
mOldLength = mPanel->length(); |
334 |
|
|
mOldLengthInPercents = mPanel->lengthInPercents(); |
335 |
|
|
@@ -123,17 +127,28 @@ |
336 |
|
|
ui->spinBox_panelSize->setMinimum(PANEL_MINIMUM_SIZE); |
337 |
|
|
ui->spinBox_panelSize->setMaximum(PANEL_MAXIMUM_SIZE); |
338 |
|
|
|
339 |
|
|
- reset(); |
340 |
|
|
- |
341 |
|
|
- connect(ui->spinBox_panelSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
342 |
|
|
- connect(ui->spinBox_iconSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
343 |
|
|
- connect(ui->spinBox_lineCount, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
344 |
|
|
+ mOldBackgroundColor = mPanel->backgroundColor(); |
345 |
|
|
+ mOldBackgroundImage = mPanel->backgroundImage(); |
346 |
|
|
|
347 |
|
|
- connect(ui->spinBox_length, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
348 |
|
|
- connect(ui->comboBox_lenghtType, SIGNAL(activated(int)), this, SLOT(widthTypeChanged())); |
349 |
|
|
+ reset(); |
350 |
|
|
|
351 |
|
|
- connect(ui->comboBox_alignment, SIGNAL(activated(int)), this, SLOT(editChanged())); |
352 |
|
|
- connect(ui->comboBox_position, SIGNAL(activated(int)), this, SLOT(positionChanged())); |
353 |
|
|
+ connect(ui->spinBox_panelSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
354 |
|
|
+ connect(ui->spinBox_iconSize, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
355 |
|
|
+ connect(ui->spinBox_lineCount, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
356 |
|
|
+ |
357 |
|
|
+ connect(ui->spinBox_length, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
358 |
|
|
+ connect(ui->comboBox_lenghtType, SIGNAL(activated(int)), this, SLOT(widthTypeChanged())); |
359 |
|
|
+ |
360 |
|
|
+ connect(ui->comboBox_alignment, SIGNAL(activated(int)), this, SLOT(editChanged())); |
361 |
|
|
+ connect(ui->comboBox_position, SIGNAL(activated(int)), this, SLOT(positionChanged())); |
362 |
|
|
+ |
363 |
|
|
+ connect(ui->checkBox_customColor, SIGNAL(toggled(bool)), this, SLOT(editChanged())); |
364 |
|
|
+ connect(ui->pushButton_customColor, SIGNAL(clicked(bool)), this, SLOT(pickBackgroundColor())); |
365 |
|
|
+ connect(ui->lineEdit_customColor, SIGNAL(textChanged(QString)), this, SLOT(editChanged())); |
366 |
|
|
+ connect(ui->slider_opacity, SIGNAL(valueChanged(int)), this, SLOT(editChanged())); |
367 |
|
|
+ connect(ui->checkBox_customImage, SIGNAL(toggled(bool)), this, SLOT(editChanged())); |
368 |
|
|
+ connect(ui->lineEdit_customImage, SIGNAL(textChanged(QString)), this, SLOT(editChanged())); |
369 |
|
|
+ connect(ui->pushButton_customImage, SIGNAL(clicked(bool)), this, SLOT(pickBackgroundImage())); |
370 |
|
|
} |
371 |
|
|
|
372 |
|
|
|
373 |
|
|
@@ -155,6 +170,13 @@ |
374 |
|
|
widthTypeChanged(); |
375 |
|
|
ui->spinBox_length->setValue(mOldLength); |
376 |
|
|
|
377 |
|
|
+ ui->slider_opacity->setValue(mOldBackgroundColor.alpha() * 100 / 255); |
378 |
|
|
+ ui->lineEdit_customColor->setText(mOldBackgroundColor.name().toUpper()); |
379 |
|
|
+ ui->lineEdit_customImage->setText(mOldBackgroundImage); |
380 |
|
|
+ |
381 |
|
|
+ ui->checkBox_customColor->setChecked(mOldBackgroundColor.isValid()); |
382 |
|
|
+ ui->checkBox_customImage->setChecked(QFileInfo(mOldBackgroundImage).exists()); |
383 |
|
|
+ |
384 |
|
|
// update position |
385 |
|
|
positionChanged(); |
386 |
|
|
} |
387 |
|
|
@@ -254,21 +276,33 @@ |
388 |
|
|
************************************************/ |
389 |
|
|
void ConfigPanelWidget::editChanged() |
390 |
|
|
{ |
391 |
|
|
- mPanel->setPanelSize(ui->spinBox_panelSize->value()); |
392 |
|
|
- mPanel->setIconSize(ui->spinBox_iconSize->value()); |
393 |
|
|
- mPanel->setLineCount(ui->spinBox_lineCount->value()); |
394 |
|
|
+ mPanel->setPanelSize(ui->spinBox_panelSize->value(), true); |
395 |
|
|
+ mPanel->setIconSize(ui->spinBox_iconSize->value(), true); |
396 |
|
|
+ mPanel->setLineCount(ui->spinBox_lineCount->value(), true); |
397 |
|
|
|
398 |
|
|
mPanel->setLength(ui->spinBox_length->value(), |
399 |
|
|
- ui->comboBox_lenghtType->currentIndex() == 0); |
400 |
|
|
+ ui->comboBox_lenghtType->currentIndex() == 0, |
401 |
|
|
+ true); |
402 |
|
|
|
403 |
|
|
LxQtPanel::Alignment align = LxQtPanel::Alignment( |
404 |
|
|
ui->comboBox_alignment->itemData( |
405 |
|
|
ui->comboBox_alignment->currentIndex() |
406 |
|
|
).toInt()); |
407 |
|
|
|
408 |
|
|
- mPanel->setAlignment(align); |
409 |
|
|
+ mPanel->setAlignment(align, true); |
410 |
|
|
+ mPanel->setPosition(mScreenNum, mPosition, true); |
411 |
|
|
|
412 |
|
|
- mPanel->setPosition(mScreenNum, mPosition); |
413 |
|
|
+ if (ui->checkBox_customColor->isChecked()) |
414 |
|
|
+ { |
415 |
|
|
+ QColor color = QColor(ui->lineEdit_customColor->text()); |
416 |
|
|
+ color.setAlpha(ui->slider_opacity->value() * 255 / 100); |
417 |
|
|
+ mPanel->setBackgroundColor(color, true); |
418 |
|
|
+ } |
419 |
|
|
+ else |
420 |
|
|
+ mPanel->setBackgroundColor(QColor(), true); |
421 |
|
|
+ |
422 |
|
|
+ mPanel->setBackgroundImage(ui->checkBox_customImage->isChecked() ? ui->lineEdit_customImage->text() : QString(), |
423 |
|
|
+ true); |
424 |
|
|
} |
425 |
|
|
|
426 |
|
|
|
427 |
|
|
@@ -347,3 +381,28 @@ |
428 |
|
|
|
429 |
|
|
editChanged(); |
430 |
|
|
} |
431 |
|
|
+ |
432 |
|
|
+/************************************************ |
433 |
|
|
+ |
434 |
|
|
+ ************************************************/ |
435 |
|
|
+void ConfigPanelWidget::pickBackgroundColor() |
436 |
|
|
+{ |
437 |
|
|
+ QColor newColor = QColorDialog::getColor(QColor(ui->lineEdit_customColor->text()), this, tr("Pick color")); |
438 |
|
|
+ if (newColor.isValid()) |
439 |
|
|
+ ui->lineEdit_customColor->setText(newColor.name()); |
440 |
|
|
+} |
441 |
|
|
+ |
442 |
|
|
+/************************************************ |
443 |
|
|
+ |
444 |
|
|
+ ************************************************/ |
445 |
|
|
+void ConfigPanelWidget::pickBackgroundImage() |
446 |
|
|
+{ |
447 |
|
|
+ QString picturesLocation; |
448 |
|
|
+ picturesLocation = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation); |
449 |
|
|
+ |
450 |
|
|
+ QString file = QFileDialog::getOpenFileName(this, |
451 |
|
|
+ "Pick image", |
452 |
|
|
+ picturesLocation, |
453 |
|
|
+ tr("Images (*.png *.gif *.jpg)")); |
454 |
|
|
+ ui->lineEdit_customImage->setText(file); |
455 |
|
|
+} |
456 |
|
|
Index: lxqt-panel-0.8.0/panel/config/configpaneldialog.h |
457 |
|
|
=================================================================== |
458 |
|
|
--- lxqt-panel-0.8.0/panel/config/configpaneldialog.h |
459 |
|
|
+++ lxqt-panel-0.8.0/panel/config/configpaneldialog.h 2015-01-12 13:14:01.972301583 +0100 |
460 |
|
|
@@ -67,11 +67,12 @@ |
461 |
|
|
public slots: |
462 |
|
|
void reset(); |
463 |
|
|
|
464 |
|
|
- |
465 |
|
|
private slots: |
466 |
|
|
void editChanged(); |
467 |
|
|
void widthTypeChanged(); |
468 |
|
|
void positionChanged(); |
469 |
|
|
+ void pickBackgroundColor(); |
470 |
|
|
+ void pickBackgroundImage(); |
471 |
|
|
|
472 |
|
|
private: |
473 |
|
|
Ui::ConfigPanelWidget *ui; |
474 |
|
|
@@ -94,6 +95,8 @@ |
475 |
|
|
LxQtPanel::Alignment mOldAlignment; |
476 |
|
|
ILxQtPanel::Position mOldPosition; |
477 |
|
|
int mOldScreenNum; |
478 |
|
|
+ QColor mOldBackgroundColor; |
479 |
|
|
+ QString mOldBackgroundImage; |
480 |
|
|
}; |
481 |
|
|
|
482 |
|
|
#endif // CONFIGPANELDIALOG_H |
483 |
|
|
Index: lxqt-panel-0.8.0/panel/config/configpaneldialog.ui |
484 |
|
|
=================================================================== |
485 |
|
|
--- lxqt-panel-0.8.0/panel/config/configpaneldialog.ui |
486 |
|
|
+++ lxqt-panel-0.8.0/panel/config/configpaneldialog.ui 2015-01-12 13:14:01.972301583 +0100 |
487 |
|
|
@@ -6,16 +6,28 @@ |
488 |
|
|
<rect> |
489 |
|
|
<x>0</x> |
490 |
|
|
<y>0</y> |
491 |
|
|
- <width>300</width> |
492 |
|
|
- <height>309</height> |
493 |
|
|
+ <width>317</width> |
494 |
|
|
+ <height>509</height> |
495 |
|
|
</rect> |
496 |
|
|
</property> |
497 |
|
|
+ <property name="sizePolicy"> |
498 |
|
|
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> |
499 |
|
|
+ <horstretch>0</horstretch> |
500 |
|
|
+ <verstretch>0</verstretch> |
501 |
|
|
+ </sizepolicy> |
502 |
|
|
+ </property> |
503 |
|
|
<property name="windowTitle"> |
504 |
|
|
<string>Configure panel</string> |
505 |
|
|
</property> |
506 |
|
|
<layout class="QVBoxLayout" name="verticalLayout"> |
507 |
|
|
<item> |
508 |
|
|
<widget class="QGroupBox" name="groupBox_size"> |
509 |
|
|
+ <property name="sizePolicy"> |
510 |
|
|
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> |
511 |
|
|
+ <horstretch>0</horstretch> |
512 |
|
|
+ <verstretch>0</verstretch> |
513 |
|
|
+ </sizepolicy> |
514 |
|
|
+ </property> |
515 |
|
|
<property name="title"> |
516 |
|
|
<string>Panel size</string> |
517 |
|
|
</property> |
518 |
|
|
@@ -96,6 +108,12 @@ |
519 |
|
|
</item> |
520 |
|
|
<item> |
521 |
|
|
<widget class="QGroupBox" name="groupBox"> |
522 |
|
|
+ <property name="sizePolicy"> |
523 |
|
|
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> |
524 |
|
|
+ <horstretch>0</horstretch> |
525 |
|
|
+ <verstretch>0</verstretch> |
526 |
|
|
+ </sizepolicy> |
527 |
|
|
+ </property> |
528 |
|
|
<property name="title"> |
529 |
|
|
<string>Panel length && position</string> |
530 |
|
|
</property> |
531 |
|
|
@@ -163,6 +181,9 @@ |
532 |
|
|
</property> |
533 |
|
|
</widget> |
534 |
|
|
</item> |
535 |
|
|
+ <item row="2" column="1" colspan="3"> |
536 |
|
|
+ <widget class="QComboBox" name="comboBox_position"/> |
537 |
|
|
+ </item> |
538 |
|
|
<item row="2" column="0"> |
539 |
|
|
<widget class="QLabel" name="label_position"> |
540 |
|
|
<property name="text"> |
541 |
|
|
@@ -170,27 +191,212 @@ |
542 |
|
|
</property> |
543 |
|
|
</widget> |
544 |
|
|
</item> |
545 |
|
|
- <item row="2" column="1" colspan="3"> |
546 |
|
|
- <widget class="QComboBox" name="comboBox_position"/> |
547 |
|
|
- </item> |
548 |
|
|
</layout> |
549 |
|
|
</widget> |
550 |
|
|
</item> |
551 |
|
|
<item> |
552 |
|
|
- <spacer name="verticalSpacer"> |
553 |
|
|
- <property name="orientation"> |
554 |
|
|
- <enum>Qt::Vertical</enum> |
555 |
|
|
- </property> |
556 |
|
|
- <property name="sizeHint" stdset="0"> |
557 |
|
|
- <size> |
558 |
|
|
- <width>20</width> |
559 |
|
|
- <height>40</height> |
560 |
|
|
- </size> |
561 |
|
|
+ <widget class="QGroupBox" name="groupBox_2"> |
562 |
|
|
+ <property name="sizePolicy"> |
563 |
|
|
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> |
564 |
|
|
+ <horstretch>0</horstretch> |
565 |
|
|
+ <verstretch>0</verstretch> |
566 |
|
|
+ </sizepolicy> |
567 |
|
|
+ </property> |
568 |
|
|
+ <property name="title"> |
569 |
|
|
+ <string>Styling</string> |
570 |
|
|
</property> |
571 |
|
|
- </spacer> |
572 |
|
|
+ <layout class="QGridLayout" name="gridLayout_3"> |
573 |
|
|
+ <item row="0" column="0"> |
574 |
|
|
+ <widget class="QCheckBox" name="checkBox_customColor"> |
575 |
|
|
+ <property name="text"> |
576 |
|
|
+ <string>Custom background color</string> |
577 |
|
|
+ </property> |
578 |
|
|
+ </widget> |
579 |
|
|
+ </item> |
580 |
|
|
+ <item row="3" column="0"> |
581 |
|
|
+ <widget class="QCheckBox" name="checkBox_customImage"> |
582 |
|
|
+ <property name="text"> |
583 |
|
|
+ <string>Custom background image</string> |
584 |
|
|
+ </property> |
585 |
|
|
+ </widget> |
586 |
|
|
+ </item> |
587 |
|
|
+ <item row="4" column="0" colspan="2"> |
588 |
|
|
+ <widget class="QLineEdit" name="lineEdit_customImage"> |
589 |
|
|
+ <property name="enabled"> |
590 |
|
|
+ <bool>false</bool> |
591 |
|
|
+ </property> |
592 |
|
|
+ </widget> |
593 |
|
|
+ </item> |
594 |
|
|
+ <item row="2" column="0" colspan="3"> |
595 |
|
|
+ <widget class="QWidget" name="widget" native="true"> |
596 |
|
|
+ <layout class="QHBoxLayout" name="horizontalLayout"> |
597 |
|
|
+ <property name="leftMargin"> |
598 |
|
|
+ <number>0</number> |
599 |
|
|
+ </property> |
600 |
|
|
+ <property name="topMargin"> |
601 |
|
|
+ <number>0</number> |
602 |
|
|
+ </property> |
603 |
|
|
+ <property name="rightMargin"> |
604 |
|
|
+ <number>0</number> |
605 |
|
|
+ </property> |
606 |
|
|
+ <property name="bottomMargin"> |
607 |
|
|
+ <number>0</number> |
608 |
|
|
+ </property> |
609 |
|
|
+ <item> |
610 |
|
|
+ <widget class="QLabel" name="label_4"> |
611 |
|
|
+ <property name="enabled"> |
612 |
|
|
+ <bool>false</bool> |
613 |
|
|
+ </property> |
614 |
|
|
+ <property name="text"> |
615 |
|
|
+ <string>Opacity:</string> |
616 |
|
|
+ </property> |
617 |
|
|
+ </widget> |
618 |
|
|
+ </item> |
619 |
|
|
+ <item> |
620 |
|
|
+ <widget class="QSlider" name="slider_opacity"> |
621 |
|
|
+ <property name="enabled"> |
622 |
|
|
+ <bool>false</bool> |
623 |
|
|
+ </property> |
624 |
|
|
+ <property name="maximum"> |
625 |
|
|
+ <number>100</number> |
626 |
|
|
+ </property> |
627 |
|
|
+ <property name="orientation"> |
628 |
|
|
+ <enum>Qt::Horizontal</enum> |
629 |
|
|
+ </property> |
630 |
|
|
+ </widget> |
631 |
|
|
+ </item> |
632 |
|
|
+ </layout> |
633 |
|
|
+ </widget> |
634 |
|
|
+ </item> |
635 |
|
|
+ <item row="1" column="2"> |
636 |
|
|
+ <widget class="QPushButton" name="pushButton_customColor"> |
637 |
|
|
+ <property name="enabled"> |
638 |
|
|
+ <bool>false</bool> |
639 |
|
|
+ </property> |
640 |
|
|
+ <property name="text"> |
641 |
|
|
+ <string>Pick</string> |
642 |
|
|
+ </property> |
643 |
|
|
+ </widget> |
644 |
|
|
+ </item> |
645 |
|
|
+ <item row="4" column="2"> |
646 |
|
|
+ <widget class="QPushButton" name="pushButton_customImage"> |
647 |
|
|
+ <property name="enabled"> |
648 |
|
|
+ <bool>false</bool> |
649 |
|
|
+ </property> |
650 |
|
|
+ <property name="text"> |
651 |
|
|
+ <string>Browse</string> |
652 |
|
|
+ </property> |
653 |
|
|
+ </widget> |
654 |
|
|
+ </item> |
655 |
|
|
+ <item row="1" column="0" colspan="2"> |
656 |
|
|
+ <widget class="QLineEdit" name="lineEdit_customColor"> |
657 |
|
|
+ <property name="enabled"> |
658 |
|
|
+ <bool>false</bool> |
659 |
|
|
+ </property> |
660 |
|
|
+ </widget> |
661 |
|
|
+ </item> |
662 |
|
|
+ </layout> |
663 |
|
|
+ </widget> |
664 |
|
|
</item> |
665 |
|
|
</layout> |
666 |
|
|
</widget> |
667 |
|
|
<resources/> |
668 |
|
|
- <connections/> |
669 |
|
|
+ <connections> |
670 |
|
|
+ <connection> |
671 |
|
|
+ <sender>checkBox_customColor</sender> |
672 |
|
|
+ <signal>toggled(bool)</signal> |
673 |
|
|
+ <receiver>lineEdit_customColor</receiver> |
674 |
|
|
+ <slot>setEnabled(bool)</slot> |
675 |
|
|
+ <hints> |
676 |
|
|
+ <hint type="sourcelabel"> |
677 |
|
|
+ <x>68</x> |
678 |
|
|
+ <y>354</y> |
679 |
|
|
+ </hint> |
680 |
|
|
+ <hint type="destinationlabel"> |
681 |
|
|
+ <x>71</x> |
682 |
|
|
+ <y>377</y> |
683 |
|
|
+ </hint> |
684 |
|
|
+ </hints> |
685 |
|
|
+ </connection> |
686 |
|
|
+ <connection> |
687 |
|
|
+ <sender>checkBox_customColor</sender> |
688 |
|
|
+ <signal>toggled(bool)</signal> |
689 |
|
|
+ <receiver>pushButton_customColor</receiver> |
690 |
|
|
+ <slot>setEnabled(bool)</slot> |
691 |
|
|
+ <hints> |
692 |
|
|
+ <hint type="sourcelabel"> |
693 |
|
|
+ <x>116</x> |
694 |
|
|
+ <y>353</y> |
695 |
|
|
+ </hint> |
696 |
|
|
+ <hint type="destinationlabel"> |
697 |
|
|
+ <x>266</x> |
698 |
|
|
+ <y>386</y> |
699 |
|
|
+ </hint> |
700 |
|
|
+ </hints> |
701 |
|
|
+ </connection> |
702 |
|
|
+ <connection> |
703 |
|
|
+ <sender>checkBox_customImage</sender> |
704 |
|
|
+ <signal>toggled(bool)</signal> |
705 |
|
|
+ <receiver>lineEdit_customImage</receiver> |
706 |
|
|
+ <slot>setEnabled(bool)</slot> |
707 |
|
|
+ <hints> |
708 |
|
|
+ <hint type="sourcelabel"> |
709 |
|
|
+ <x>95</x> |
710 |
|
|
+ <y>447</y> |
711 |
|
|
+ </hint> |
712 |
|
|
+ <hint type="destinationlabel"> |
713 |
|
|
+ <x>107</x> |
714 |
|
|
+ <y>473</y> |
715 |
|
|
+ </hint> |
716 |
|
|
+ </hints> |
717 |
|
|
+ </connection> |
718 |
|
|
+ <connection> |
719 |
|
|
+ <sender>checkBox_customImage</sender> |
720 |
|
|
+ <signal>toggled(bool)</signal> |
721 |
|
|
+ <receiver>pushButton_customImage</receiver> |
722 |
|
|
+ <slot>setEnabled(bool)</slot> |
723 |
|
|
+ <hints> |
724 |
|
|
+ <hint type="sourcelabel"> |
725 |
|
|
+ <x>83</x> |
726 |
|
|
+ <y>442</y> |
727 |
|
|
+ </hint> |
728 |
|
|
+ <hint type="destinationlabel"> |
729 |
|
|
+ <x>240</x> |
730 |
|
|
+ <y>464</y> |
731 |
|
|
+ </hint> |
732 |
|
|
+ </hints> |
733 |
|
|
+ </connection> |
734 |
|
|
+ <connection> |
735 |
|
|
+ <sender>checkBox_customColor</sender> |
736 |
|
|
+ <signal>toggled(bool)</signal> |
737 |
|
|
+ <receiver>slider_opacity</receiver> |
738 |
|
|
+ <slot>setEnabled(bool)</slot> |
739 |
|
|
+ <hints> |
740 |
|
|
+ <hint type="sourcelabel"> |
741 |
|
|
+ <x>25</x> |
742 |
|
|
+ <y>356</y> |
743 |
|
|
+ </hint> |
744 |
|
|
+ <hint type="destinationlabel"> |
745 |
|
|
+ <x>150</x> |
746 |
|
|
+ <y>412</y> |
747 |
|
|
+ </hint> |
748 |
|
|
+ </hints> |
749 |
|
|
+ </connection> |
750 |
|
|
+ <connection> |
751 |
|
|
+ <sender>checkBox_customColor</sender> |
752 |
|
|
+ <signal>toggled(bool)</signal> |
753 |
|
|
+ <receiver>label_4</receiver> |
754 |
|
|
+ <slot>setEnabled(bool)</slot> |
755 |
|
|
+ <hints> |
756 |
|
|
+ <hint type="sourcelabel"> |
757 |
|
|
+ <x>26</x> |
758 |
|
|
+ <y>355</y> |
759 |
|
|
+ </hint> |
760 |
|
|
+ <hint type="destinationlabel"> |
761 |
|
|
+ <x>33</x> |
762 |
|
|
+ <y>414</y> |
763 |
|
|
+ </hint> |
764 |
|
|
+ </hints> |
765 |
|
|
+ </connection> |
766 |
|
|
+ </connections> |
767 |
|
|
</ui> |