Skip to content

Commit 1ab888e

Browse files
committed
fixed progress bars behavior
1 parent 7a977bc commit 1ab888e

File tree

13 files changed

+219
-77
lines changed

13 files changed

+219
-77
lines changed

TODO

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66

77
- Allumer les boutons sur la vue dans tabmidi
88

9-
_ Revoir la sélection quand on déplace un send dans une autre cue
10-
119
- Vérifier... Si on édite ça fout le bordel dans les go ?
1210

13-
- les potards midi n'envoient qu'à 99%s
11+
- les potards midi n'envoient qu'à 99%
12+
13+
- Mettre un RESOLUTION_TIME dans MMC.h pour pouvoir varier le nombre de pas
14+
Pourquoi pas en mettre plusieurs... if fade > 2s passer à 200 if fade > 10s passer à 500
15+
16+
- disconnect le boutonGo quand une cue est lancée, le reconnecter ensuite
1417

18+
- les true false ne sont pas jolis, mettre des 0 1 dans data puis des checkbox dans le delegate

resources/qss/MyStyleSheet.qss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,15 @@ See QAbsractScrollArea to style scrollable backgrounds.*/
208208

209209
QProgressBar {
210210
text-align: left;
211-
background-color: #778390
211+
background-color: #778390;
212212
}
213213

214214
QProgressBar::chunk {
215215
background-color: #960710;
216216
width: 20px;
217217
}
218218

219+
QProgressBar#progressBarSend::chunk {
220+
background-color: #000000;
221+
width: 20px;
222+
}

resources/qss/progressBarSend.qss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
QProgressBar {
2+
text-align: left;
3+
background-color: #778390;
4+
}
5+
6+
QProgressBar::chunk {
7+
background-color: #308CC6;
8+
width: 20px;
9+
}

resources/resources.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<qresource prefix="/"/>
1616
<qresource prefix="/qss">
1717
<file alias="MyStyleSheet">qss/MyStyleSheet.qss</file>
18+
<file alias="BarSend">qss/progressBarSend.qss</file>
1819
</qresource>
1920
</RCC>

src/MMC.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ enum columns
4949
Fade_In, Time, Wait, Note, Count = Note + 1
5050
};
5151

52-
//QBrush salmonColor(QColor("#59271E"));
53-
//QBrush salmonColor(QColor("#725651"));
5452
#define SALMONCOLOR "#725651"
55-
//QBrush yellowColor(QColor("#B8BF7E"));
56-
//QBrush yellowColor(QColor("#818658"));
5753
#define YELLOWCOLOR "#818658"
5854

5955

src/control/osccuelist.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -435,40 +435,41 @@ void OscCueList::insertSend(OscSend *oscsend, int cueId, int sendId)
435435
endInsertRows();
436436
}
437437

438-
void OscCueList::moveSendPrev(int cueId, int sendId)
438+
bool OscCueList::moveSendPrev(int cueId, int sendId)
439439
{
440-
if (cueId < 0 || cueId >= rootSend->getSendCount()) return;
440+
if (cueId < 0 || cueId >= rootSend->getSendCount()) return false;
441441
OscSend *osccue = rootSend->getChild(cueId);
442-
if (sendId < 0 || sendId >= osccue->getSendCount()) return;
442+
if (sendId < 0 || sendId >= osccue->getSendCount()) return false;
443443
if (sendId) // Si c'est pas le 1er send de la cue
444444
{
445445
beginMoveRows(index(cueId, 0, QModelIndex()), sendId, sendId, index(cueId, 0, QModelIndex()), sendId - 1);
446446
osccue->moveChildPrev(sendId);
447447
endMoveRows();
448-
return;
448+
return false;
449449
}
450450
// C'est le 1er send
451-
if (cueId == 0) return; // y a pas de cue avant on return;
451+
if (cueId == 0) return false; // y a pas de cue avant on return;
452452
OscSend *cuePrev = rootSend->getChild(cueId - 1); // On choppe la cue d'avant
453453
OscSend *oscsend = osccue->getChild(sendId); // On choppe le send
454454
OscSend *oscsend2 = new OscSend(oscsend); // On le copie
455455
oscsend2->setParent(this); // On met le bon parent QObject sinon ça plante
456456
oscsend2->setParentSend(cuePrev); // On met la nouvelle cue comme parentsend
457457
removeSend(cueId, sendId); // on peut le détruire de l'ancienne cue
458458
addSend(oscsend2, cueId - 1); // On ajoute la copie à la bonne cue
459+
return true; //Pour dire à tabseq qu'on a changé de cue
459460
}
460461

461-
void OscCueList::moveSendNext(int cueId, int sendId)
462+
bool OscCueList::moveSendNext(int cueId, int sendId)
462463
{
463-
if (cueId < 0 || cueId >= rootSend->getSendCount()) return;
464+
if (cueId < 0 || cueId >= rootSend->getSendCount()) return false;
464465
OscSend *osccue = rootSend->getChild(cueId);
465-
if (sendId < 0 || sendId >= osccue->getSendCount()) return;
466+
if (sendId < 0 || sendId >= osccue->getSendCount()) return false;
466467
// Si c'est pas le dernier send
467468
if (sendId != osccue->getSendCount() - 1) moveSendPrev(cueId, sendId + 1);
468469
// C'est le dernier send
469470
else
470471
{
471-
if (cueId == rootSend->getSendCount() - 1) return; // C'est la dernière cue on return
472+
if (cueId == rootSend->getSendCount() - 1) return false; // C'est la dernière cue on return
472473
OscSend *cueNext = rootSend->getChild(cueId + 1); // On choppe la cue d'avant
473474
OscSend *oscsend = osccue->getChild(sendId); // On choppe le send
474475
OscSend *oscsend2 = new OscSend(oscsend); // On le copie
@@ -477,7 +478,9 @@ void OscCueList::moveSendNext(int cueId, int sendId)
477478
if (cueNext->getSendCount()) insertSend(oscsend2, cueId + 1, 0); // On ajoute la copie à la bonne cue
478479
else addSend(oscsend2, cueId + 1); // Si la cue a pas encore de send
479480
removeSend(cueId, sendId); // on peut le détruire de l'ancienne cue
481+
return true; //Pour dire à tabSeq qu'on a changé de cue
480482
}
483+
return false;
481484
}
482485

483486
void OscCueList::removeSend(int cueId, int sendId/*, bool destroy*/)
@@ -560,8 +563,6 @@ bool OscCueList::hideShowColumn(int col) const
560563
for (int j = 0; j < getSend(index(i, 0))->getSendCount(); j++)
561564
{
562565
if ((index(j, col, index(i, 0))).flags().testFlag(Qt::ItemIsEditable)) return true;
563-
// if ((index(j, col, index(i, 0))).flags().testFlag(Qt::ItemIsEnabled)) return true;
564-
565566
}
566567
}
567568
return false;

src/control/osccuelist.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class OscCueList :
5151
void addCue();
5252
void addSend(OscSend *oscsend, int cueId);
5353
void insertSend(OscSend *oscsend, int cueId, int sendId);
54-
void moveSendPrev(int cueId, int sendId);
55-
void moveSendNext(int cueId, int sendId);
54+
bool moveSendPrev(int cueId, int sendId);
55+
bool moveSendNext(int cueId, int sendId);
5656
void removeSend(int cueId, int sendId);
5757
void removeAllSend(int cueId);
5858
void insertCue(int cueId);

src/control/oscsend.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ OscSend::OscSend(OscSend *oscsend):
104104
timer = new QTimer();
105105
counter = 0;
106106
connect(timer, SIGNAL(timeout()), this, SLOT(fadeStep()));
107-
// qDebug() << m_champ;
108107
}
109108

110109

src/control/oscsend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public slots:
138138
int getSendCount() const;
139139
void insertSend(OscSend *oscsend, int position);
140140
OscSend *getParentSend();
141-
void removeSends(int position, int count = 1/*, bool destroy = true*/);
141+
void removeSends(int position, int count = 1);
142142
int getSendId() const; // donne l'id d'un enfant
143143
void moveChildPrev(int position);
144144

src/gui/mainwindow.cpp

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,30 @@ MainWindow::MainWindow() :
3737
createCentralWidget();
3838
createStatusBar();
3939

40-
progressBar->setValue(0);
40+
progressBarCue->reset();
41+
progressBarSend->reset();
4142

4243
connect(champComboBox, SIGNAL(currentIndexChanged(int)), SLOT(showWidgets(int))); // Pour afficher les widgets
4344
connect(sendPushButton, SIGNAL(clicked()), SLOT(sendFromToolBar()));
4445
connect(p_uriPushButton, SIGNAL(clicked()), SLOT(setP_UriLine()));
4546
connect(p_colorPushButton, SIGNAL(clicked()), SLOT(setP_ColorLine()));
4647
connect(addToCuePushButton, SIGNAL(clicked()), SLOT(addToCue()));
4748

48-
connect(tabseq, SIGNAL(updateProgressTime(int)), this, SLOT(timeProgressed(int)));
49-
connect(tabseq, SIGNAL(progressTimeFinished()), this, SLOT(timeFinished()));
49+
connect(tabseq, SIGNAL(updateProgressTimeCue(int)), this, SLOT(timeProgressedCue(int)));
50+
connect(tabseq, SIGNAL(progressTimeFinishedCue()), this, SLOT(timeFinishedCue()));
51+
connect(tabseq, SIGNAL(updateProgressTimeSend(int)), this, SLOT(timeProgressedSend(int)));
52+
connect(tabseq, SIGNAL(progressTimeFinishedSend()), this, SLOT(timeFinishedSend()));
53+
connect(tabseq, SIGNAL(updateProgressTimeWaitSend(int)), this, SLOT(timeProgressedSend(int)));
54+
connect(tabseq, SIGNAL(progressTimeWaitFinishedSend()), this, SLOT(timeFinishedSend()));
5055
connect(tabseq, SIGNAL(sendStringToOutputLabel(QString)), outputLabel, SLOT(setText(QString)));
5156
connect(tabmidi, SIGNAL(sendStringToOutputLabel(QString)), outputLabel, SLOT(setText(QString)));
5257

53-
5458
}
5559

5660
void MainWindow::createCentralWidget()
5761
{
5862
tabmidi = new TabMidi(midiIn1, midiIn2, midiOut1, midiOut2, this);
59-
tabseq = new TabSeq(oscCueList, treeView, midiIn1, midiIn2, midiOut1, midiOut2, /*progressBar, */this);
63+
tabseq = new TabSeq(oscCueList, treeView, midiIn1, midiIn2, midiOut1, midiOut2, /*progressBarCue, */this);
6064
tabmmstate = new TabMMState(state, this);
6165
tabwidget = new QTabWidget(this);
6266

@@ -190,28 +194,26 @@ void MainWindow::createToolBar()
190194
void MainWindow::createStatusBar()
191195
{
192196
statusBar = new QStatusBar(this);
193-
progressBar = new QProgressBar(this);
197+
progressBarCue = new QProgressBar(this);
194198
outputLabel = new QLabel(this);
195-
statusBar->insertPermanentWidget(0, progressBar, 1);
199+
outputLabel->setAlignment(Qt::AlignRight);
200+
progressBarSend = new QProgressBar(this);
201+
QFile file(":/qss/BarSend");
202+
file.open(QFile::ReadOnly);
203+
QString styleSheet = QString::fromLatin1(file.readAll());
204+
progressBarSend->setStyleSheet(styleSheet);
205+
206+
statusBar->insertPermanentWidget(0, progressBarCue, 1);
196207
statusBar->insertPermanentWidget(1, outputLabel, 1);
208+
statusBar->insertPermanentWidget(2, progressBarSend, 1);
197209
setStatusBar(statusBar);
198-
progressBar->setRange(0, 100);
199-
progressBar->setValue(80);
210+
progressBarCue->setRange(0, 100);
200211
}
201212

202213
void MainWindow::showWidgets(int index)
203214
{
204215
switch (index)
205216
{
206-
// case CUE:
207-
// p_uriLine->hide(); p_uriPushButton->hide(); p_nameLineEdit->hide(); p_colorLine->hide();
208-
// p_colorPushButton->hide(); p_ID1Label->hide(); p_ID1SpinBox->hide(); p_ID2Label->hide();
209-
// p_ID2SpinBox->hide(); p_rateLabel->hide(); p_rateSpinBox->hide(); p_opacityLabel->hide();
210-
// p_opacitySpinBox->hide(); p_volumeLabel->hide(); p_volumeSpinBox->hide(); m_nameLineEdit->hide();
211-
// m_IDLabel->hide(); m_IDSpinBox->hide(); m_opacityLabel->hide(); m_opacitySpinBox->hide();
212-
// m_visibleCheckBox->hide(); m_soloCheckBox->hide(); m_lockCheckBox->hide(); m_depthLabel->hide();
213-
// m_depthSpinBox->hide(); fadeCheckBox->hide(); p_nameLineEdit2->hide(); m_nameLineEdit2->hide();
214-
// timeLabel->hide();timeSpinBox->hide(); waitTimeSpinBox->setValue(0); break;
215217
case PLAY: case PAUSE: case REWIND: case QUIT:
216218
p_uriLine->hide(); p_uriPushButton->hide(); p_nameLineEdit->hide(); p_colorLine->hide();
217219
p_colorPushButton->hide(); p_ID1Label->hide(); p_ID1SpinBox->hide(); p_ID2Label->hide();
@@ -611,18 +613,28 @@ void MainWindow::addToCue()
611613
// c'est un send
612614
oscCueList->insertSend(oscsend, index.parent().row(), row); // Il ajoute avant le send...
613615
tabseq->hideShowColumns();
616+
}
617+
618+
void MainWindow::timeProgressedCue(int value)
619+
{
620+
if (value >= 0 && value <= 100) progressBarCue->setValue(value);
621+
return;
622+
}
614623

624+
void MainWindow::timeFinishedCue()
625+
{
626+
progressBarCue->reset();
615627
}
616628

617-
void MainWindow::timeProgressed(int value)
629+
void MainWindow::timeProgressedSend(int value)
618630
{
619-
if (value >= 0 && value <= 100) progressBar->setValue(value);
631+
if (value >= 0 && value <= 100) progressBarSend->setValue(value);
620632
return;
621633
}
622634

623-
void MainWindow::timeFinished()
635+
void MainWindow::timeFinishedSend()
624636
{
625-
progressBar->setValue(0);
637+
progressBarSend->reset();
626638
}
627639

628640
void MainWindow::closeEvent(QCloseEvent *event)

0 commit comments

Comments
 (0)