Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit ea705a8

Browse files
committed
2 parents 5fea93a + 8e10de3 commit ea705a8

File tree

9 files changed

+193
-11
lines changed

9 files changed

+193
-11
lines changed

src/duqf-app/duui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void DuUI::replaceCSS(QWidget *w, const QString &css, const QString &where)
132132
newStyleList << css;
133133
newStyleList << "/*DuUI:End:"+where+"*/";
134134
}
135-
qDebug() << newStyleList.join("\n");
135+
136136
w->setStyleSheet(newStyleList.join("\n"));
137137
}
138138

src/rameditwidgets/statuseditwidget.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "ramabstractitem.h"
66
#include "ramses.h"
77
#include "ramworkingfolder.h"
8+
#include "ramobjectdelegate.h"
89

910
StatusEditWidget::StatusEditWidget(QWidget *parent) :
1011
ObjectEditWidget( parent)
@@ -190,6 +191,10 @@ void StatusEditWidget::reInit(RamObject *o)
190191

191192
this->setEnabled(false);
192193
}
194+
195+
196+
// Set the priority color
197+
updatePriorityColor();
193198
}
194199

195200
void StatusEditWidget::setState(RamState *state)
@@ -362,6 +367,8 @@ void StatusEditWidget::setDueDate()
362367

363368
RamUser *currentUser = Ramses::instance()->currentUser();
364369
m_status->setModifiedBy(currentUser);
370+
371+
updatePriorityColor();
365372
}
366373

367374
void StatusEditWidget::setPriority(QVariant p)
@@ -370,6 +377,8 @@ void StatusEditWidget::setPriority(QVariant p)
370377
m_status->setPriority(
371378
static_cast<RamStatus::Priority>(p.toInt())
372379
);
380+
381+
updatePriorityColor();
373382
}
374383

375384
void StatusEditWidget::mainFileSelected()
@@ -560,6 +569,27 @@ void StatusEditWidget::removeSelectedPreviewFile()
560569
refresh();
561570
}
562571

572+
void StatusEditWidget::updatePriorityColor()
573+
{
574+
if (!m_status) {
575+
DuUI::replaceCSS(ui_priorityBox, "/* Default */", "priorityColor");
576+
return;
577+
}
578+
579+
float p = m_status->lateness() + m_status->priority();
580+
QColor color = RamObjectDelegate::priorityColor(p);
581+
582+
if (color.alpha() == 0) {
583+
DuUI::replaceCSS(ui_priorityBox, "/* Default */", "priorityColor");
584+
return;
585+
}
586+
587+
QString colorStyle = "background-color: " + color.name() + "; ";
588+
if (color.lightness() > 80) colorStyle += "color: #232323; ";
589+
colorStyle = "QComboBox { " + colorStyle + "}";
590+
DuUI::replaceCSS(ui_priorityBox, colorStyle, "priorityColor");
591+
}
592+
563593
void StatusEditWidget::setupUi()
564594
{
565595
this->setMinimumWidth(300);

src/rameditwidgets/statuseditwidget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ private slots:
6464
void openPreviewFile();
6565
void removeSelectedPreviewFile();
6666

67+
void updatePriorityColor();
68+
6769
private:
6870
void setupUi();
6971
void connectEvents();
72+
7073
RamStateBox *ui_stateBox;
7174
DuQFSpinBox *ui_completionBox;
7275
AutoSelectSpinBox *ui_versionBox;

src/rammanagerwidgets/itemmanagerwidget.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,21 @@ void ItemManagerWidget::setCompletion()
469469
}
470470
}
471471

472+
void ItemManagerWidget::setPriority()
473+
{
474+
QAction* action = qobject_cast<QAction*>( sender() );
475+
auto priority = static_cast<RamStatus::Priority>( action->data().toInt() );
476+
QVector<RamStatus*> status = beginEditSelectedStatus();
477+
478+
RamUser *currentUser = Ramses::instance()->currentUser();
479+
480+
for (int i = 0; i < status.count(); i++)
481+
{
482+
status.at(i)->setPriority( priority );
483+
status.at(i)->setModifiedBy(currentUser);
484+
}
485+
}
486+
472487
void ItemManagerWidget::copyComment()
473488
{
474489
QModelIndex currentIndex = ui_table->selectionModel()->currentIndex();
@@ -844,6 +859,21 @@ void ItemManagerWidget::setupUi()
844859
completionMenu->addAction(ui_completion100);
845860
statusMenu->addMenu(completionMenu);
846861

862+
DuMenu *priorityMenu = new DuMenu("Set priority", this);
863+
ui_priorityNone = new QAction("None",this);
864+
ui_priorityLow = new QAction("Low",this);
865+
ui_priorityMedium = new QAction("Medium",this);
866+
ui_priorityHigh = new QAction("High",this);
867+
ui_priorityNone->setData(RamStatus::NoPriority);
868+
ui_priorityLow->setData(RamStatus::LowPriority);
869+
ui_priorityMedium->setData(RamStatus::MediumPriority);
870+
ui_priorityHigh->setData(RamStatus::HighPriority);
871+
priorityMenu->addAction(ui_priorityNone );
872+
priorityMenu->addAction(ui_priorityLow );
873+
priorityMenu->addAction(ui_priorityMedium );
874+
priorityMenu->addAction(ui_priorityHigh );
875+
statusMenu->addMenu(priorityMenu);
876+
847877

848878
QToolButton *statusButton = new QToolButton(this);
849879
statusButton->setText(" Status");
@@ -911,6 +941,13 @@ void ItemManagerWidget::setupUi()
911941
completionContextMenu->addAction(ui_completion100);
912942
ui_contextMenu->addMenu(completionContextMenu);
913943

944+
DuMenu *priorityContextMenu = new DuMenu("Set priority", this);
945+
priorityContextMenu->addAction(ui_priorityNone );
946+
priorityContextMenu->addAction(ui_priorityLow );
947+
priorityContextMenu->addAction(ui_priorityMedium );
948+
priorityContextMenu->addAction(ui_priorityHigh );
949+
ui_contextMenu->addMenu(priorityContextMenu);
950+
914951
ui_contextMenu->addSeparator();
915952

916953
ui_actionCopyFileName = new QAction(tr("Copy file name"));
@@ -952,6 +989,10 @@ void ItemManagerWidget::connectEvents()
952989
connect(ui_completion75 , SIGNAL(triggered()), this, SLOT( setCompletion() ) );
953990
connect(ui_completion90 , SIGNAL(triggered()), this, SLOT( setCompletion() ) );
954991
connect(ui_completion100, SIGNAL(triggered()), this, SLOT( setCompletion() ) );
992+
connect(ui_priorityNone, SIGNAL(triggered()), this, SLOT( setPriority() ) );
993+
connect(ui_priorityLow, SIGNAL(triggered()), this, SLOT( setPriority() ) );
994+
connect(ui_priorityMedium, SIGNAL(triggered()), this, SLOT( setPriority() ) );
995+
connect(ui_priorityHigh, SIGNAL(triggered()), this, SLOT( setPriority() ) );
955996
connect(ui_table, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
956997
// view actions
957998
//connect(ui_actionTimeTracking, SIGNAL(toggled(bool)), ui_table, SLOT(setTimeTracking(bool)));

src/rammanagerwidgets/itemmanagerwidget.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ private slots:
8383
void setVeryHard();
8484
void setDiffculty(RamStatus::Difficulty difficulty);
8585
void setCompletion();
86+
void setPriority();
8687
void copyComment();
8788
void cutComment();
8889
void pasteComment();
@@ -152,6 +153,10 @@ private slots:
152153
QAction *ui_completion75;
153154
QAction *ui_completion90;
154155
QAction *ui_completion100;
156+
QAction *ui_priorityNone;
157+
QAction *ui_priorityLow;
158+
QAction *ui_priorityMedium;
159+
QAction *ui_priorityHigh;
155160
DuMenu *ui_contextMenu;
156161
QAction *ui_copyComment;
157162
QAction *ui_cutComment;

src/ramobjectdelegates/ramobjectdelegate.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,36 +254,36 @@ void RamObjectDelegate::paintProgress(const QModelIndex &index, QPainter *painte
254254
}
255255
}
256256

257-
QColor RamObjectDelegate::priorityColor(qreal priority) const
257+
QColor RamObjectDelegate::priorityColor(qreal priority)
258258
{
259259
if (priority < .75) {
260260
qreal v = Interpolations::linear(priority, .5, .75, 0, 1);
261-
QColor c(88, 95, 191);
261+
QColor c(250, 237, 95);
262262
c.setAlpha(v*256);
263263
return c;
264264
}
265265
else if (priority < 1) {
266266
qreal v = Interpolations::linear(priority, .75, 1, 0, 1);
267267

268268
return ColorUtils::interpolateRGB(
269-
QColor(88, 95, 191),
270-
QColor(195, 121, 69),
269+
QColor(250, 237, 95),
270+
QColor(250, 160, 36),
271271
v );
272272
}
273273
else if (priority < 2) {
274274
qreal v = Interpolations::linear(priority, 1, 2, 0, 1);
275275

276276
return ColorUtils::interpolateRGB(
277-
QColor(195, 121, 69),
278-
QColor(154, 25, 45),
277+
QColor(250, 160, 36),
278+
QColor(250, 20, 20),
279279
v );
280280
}
281281
else {
282282
qreal v = Interpolations::linear(priority, 2, 3, 0, 1);
283283

284284
return ColorUtils::interpolateRGB(
285-
QColor(154, 25, 45),
286-
QColor(127, 52, 157),
285+
QColor(250, 20, 20),
286+
QColor(250, 20, 230),
287287
v );
288288
}
289289
return QColor();

src/ramobjectdelegates/ramobjectdelegate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class RamObjectDelegate : public QStyledItemDelegate
2626
{
2727
Q_OBJECT
2828
public:
29+
static QColor priorityColor(qreal priority);
30+
2931
RamObjectDelegate(QObject *parent = nullptr);
3032

3133
void paint(QPainter *painter, const QStyleOptionViewItem &option,
@@ -88,7 +90,6 @@ public slots:
8890
void paintButtons(QPainter *painter, PaintParameters *params, const QModelIndex &index) const;
8991
void paintDetails(const QModelIndex &index, QPainter *painter, PaintParameters *params) const;
9092
void paintProgress(const QModelIndex &index, QPainter *painter, PaintParameters *params) const;
91-
QColor priorityColor(qreal priority) const;
9293

9394
// Settings
9495
bool m_editable = false;

src/resources/styles/duDock.css

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,31 @@
77
}
88

99
.duDock QWidget {
10-
background-color: rgba(0,0,0,0);
10+
background-color: transparent;
11+
}
12+
13+
/* CALENDAR POPUP */
14+
/* normal days */
15+
.duDock QCalendarWidget QAbstractItemView:enabled
16+
{
17+
background-color: @color-less-dark-grey;
18+
color: @color-light-grey;
19+
}
20+
21+
/* header row */
22+
.duDock QCalendarWidget QWidget {
23+
alternate-background-color: @color-dark-grey;
1124
}
1225

26+
/* navigation bar */
27+
.duDock QCalendarWidget QWidget#qt_calendar_navigationbar
28+
{
29+
background-color: @color-less-dark-grey;
30+
}
31+
32+
33+
/* OTHER */
34+
1335
/* Sub Blocks */
1436
.duDock .duBlock {
1537
background-color: @color-very-dark-grey;

src/resources/styles/style.css

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,86 @@ QDateTimeEdit::down-arrow:disabled {
197197
image: none;
198198
}
199199

200+
/* CALENDAR */
201+
202+
/* normal days */
203+
QCalendarWidget QAbstractItemView:enabled
204+
{
205+
background-color: @color-less-dark-grey;
206+
color: @color-light-grey;
207+
}
208+
209+
/* header row */
210+
QCalendarWidget QWidget {
211+
alternate-background-color: @color-dark-grey;
212+
}
213+
214+
/* navigation bar */
215+
QCalendarWidget QWidget#qt_calendar_navigationbar
216+
{
217+
background-color: @color-less-dark-grey;
218+
}
219+
220+
/*QCalendarWidget QToolButton {
221+
height: 60px;
222+
width: 150px;
223+
color: white;
224+
font-size: 24px;
225+
icon-size: 56px, 56px;
226+
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #cccccc, stop: 1 #333333);
227+
}
228+
229+
QCalendarWidget QMenu {
230+
width: 150px;
231+
left: 20px;
232+
color: white;
233+
font-size: 18px;
234+
background-color: rgb(100, 100, 100);
235+
}
236+
237+
QCalendarWidget QSpinBox {
238+
width: 150px;
239+
font-size:24px;
240+
color: white;
241+
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #cccccc, stop: 1 #333333);
242+
selection-background-color: rgb(136, 136, 136);
243+
selection-color: rgb(255, 255, 255);
244+
}
245+
246+
QCalendarWidget QSpinBox::up-button { subcontrol-origin: border; subcontrol-position: top right; width:65px; }
247+
248+
QCalendarWidget QSpinBox::down-button {subcontrol-origin: border; subcontrol-position: bottom right; width:65px;}
249+
250+
QCalendarWidget QSpinBox::up-arrow { width:56px; height:56px; }
251+
252+
QCalendarWidget QSpinBox::down-arrow { width:56px; height:56px; }*/
253+
254+
/* header row */
255+
/*QCalendarWidget QWidget { alternate-background-color: rgb(128, 128, 128); }*/
256+
257+
/* normal days */
258+
/*QCalendarWidget QAbstractItemView:enabled
259+
{
260+
background-color: blue;
261+
}
262+
263+
QCalendarWidget
264+
{
265+
background-color: red;
266+
}*/
267+
268+
/* days in other months */
269+
/* navigation bar */
270+
/*QCalendarWidget QWidget#qt_calendar_navigationbar
271+
{
272+
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #cccccc, stop: 1 #333333);
273+
}*/
274+
275+
/*QCalendarWidget QAbstractItemView:disabled
276+
{
277+
color: rgb(64, 64, 64);
278+
}*/
279+
200280
/* EDIT TEXTS */
201281

202282
QTextEdit,

0 commit comments

Comments
 (0)