summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-02-28 19:01:55 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-02-28 19:01:55 +0000
commit1645eee5c59ea72438d730a01add17e106b8c82f (patch)
treef3e43abe5cbd147d1f67b0ac3e1383eb8ff25868
parentf93eed5661c223b2ee5b3789bb41d4d53946d3fc (diff)
progress dialog
-rw-r--r--muse2/ChangeLog3
-rw-r--r--muse2/muse/app.cpp44
-rw-r--r--muse2/muse/app.h2
-rw-r--r--muse2/muse/mixer/astrip.cpp3
-rw-r--r--muse2/muse/songfile.cpp6
5 files changed, 55 insertions, 3 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 5f252f51..db63a184 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,6 @@
+28.02.2011:
+ - Added progress dialog for loading projects (rj)
+ - Aligned meters on mixer strip (rj)
27.02.2011:
- Fixed piano roll controller graph text drawing (finally!). (Tim)
- Fixed crashes in drag & drop for plugins and drag presets from outside muse into a plugin (rj)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index c483fcb5..a2b5102a 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -13,6 +13,7 @@
#include <QTimer>
#include <QWhatsThis>
#include <QSettings>
+#include <QProgressDialog>
#include "app.h"
#include "master/lmaster.h"
@@ -791,6 +792,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
watchdogThread = 0;
editInstrument = 0;
routingPopupMenu = 0;
+ progress = 0;
//routingPopupView = 0;
appName = QString("MusE");
@@ -1646,9 +1648,38 @@ void MusE::loadProjectFile(const QString& name)
void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll)
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+
+ if(!progress)
+ progress = new QProgressDialog();
+ QString label = "loading project "+QFileInfo(name).fileName();
+ if (!songTemplate) {
+ switch (random()%10) {
+ case 0:
+ label.append("\nThe best song in the world?");
+ break;
+ case 1:
+ label.append("\nAwesome stuff!");
+ break;
+ case 2:
+ label.append("\nCool rhythms!");
+ break;
+ case 3:
+ label.append("\nA truly lovely song");
+ break;
+ default:
+ break;
+ }
+ }
+ progress->setLabelText(label);
+ progress->setWindowModality(Qt::WindowModal);
+ progress->setCancelButton(0);
+ if (!songTemplate)
+ progress->setMinimumDuration(0); // if we are loading a template it will probably be fast and we can wait before showing the dialog
+ //progress->show();
//
// stop audio threads if running
//
+ progress->setValue(0);
bool restartSequencer = audio->isRunning();
if (restartSequencer) {
if (audio->isPlaying()) {
@@ -1659,13 +1690,18 @@ void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll)
seqStop();
}
microSleep(100000);
+ progress->setValue(10);
loadProjectFile1(name, songTemplate, loadAll);
microSleep(100000);
+ progress->setValue(90);
if (restartSequencer)
seqStart();
if (song->getSongInfo().length()>0)
startSongInfo(false);
+ progress->setValue(100);
+ delete progress;
+ progress=0;
QApplication::restoreOverrideCursor();
}
@@ -1690,6 +1726,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
//if (clearSong())
if (clearSong(loadAll)) // Allow not touching things like midi ports. p4.0.17 TESTING: Maybe some problems...
return;
+ progress->setValue(20);
QFileInfo fi(name);
if (songTemplate) {
@@ -1716,7 +1753,6 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
if((mex == "gz") || (mex == "bz2"))
mex = ex.section('.', -2, -2);
- //if (ex.isEmpty() || ex == "med.") {
if (ex.isEmpty() || mex == "med") {
//
// read *.med file
@@ -1760,6 +1796,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
setWindowTitle(QString("MusE: Song: ") + project.completeBaseName());
}
song->dirty = false;
+ progress->setValue(30);
viewTransportAction->setChecked(config.transportVisible);
viewBigtimeAction->setChecked(config.bigTimeVisible);
@@ -1801,6 +1838,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
transport->move(config.geometryTransport.topLeft());
showTransport(config.transportVisible);
}
+ progress->setValue(40);
transport->setMasterFlag(song->masterFlag());
punchinAction->setChecked(song->punchin());
@@ -1810,7 +1848,8 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
song->updatePos();
clipboardChanged(); // enable/disable "Paste"
selectionChanged(); // enable/disable "Copy" & "Paste"
-
+ progress->setValue(50);
+
// p3.3.53 Try this AFTER the song update above which does a mixer update... Tested OK - mixers resize properly now.
if (loadAll)
{
@@ -2024,6 +2063,7 @@ void MusE::quitDoc()
void MusE::closeEvent(QCloseEvent* event)
{
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
song->setStop(true);
//
// wait for sequencer
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index f3a3dc4c..9d758fc2 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -26,6 +26,7 @@ class QSignalMapper;
class QString;
class QToolBar;
class QToolButton;
+class QProgressDialog;
class Part;
class PartList;
@@ -343,6 +344,7 @@ class MusE : public QMainWindow
~MusE();
Arranger* arranger;
QRect configGeometryMain;
+ QProgressDialog *progress;
bool importMidi(const QString name, bool merge);
void kbAccel(int);
void changeConfig(bool writeFlag);
diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp
index 4e3fbe26..b5ab3aee 100644
--- a/muse2/muse/mixer/astrip.cpp
+++ b/muse2/muse/mixer/astrip.cpp
@@ -584,7 +584,7 @@ void AudioStrip::updateChannels()
meter[cc]->setRange(config.minMeter, 10.0);
meter[cc]->setFixedWidth(15);
connect(meter[cc], SIGNAL(mousePress()), this, SLOT(resetPeaks()));
- sliderGrid->addWidget(meter[cc], 0, cc+1, Qt::AlignHCenter);
+ sliderGrid->addWidget(meter[cc], 0, cc+1, Qt::AlignLeft);
sliderGrid->setColumnStretch(cc, 50);
meter[cc]->show();
}
@@ -806,6 +806,7 @@ AudioStrip::AudioStrip(QWidget* parent, AudioTrack* at)
sliderGrid->addWidget(meter[i], 0, i+1, Qt::AlignHCenter);
sliderGrid->setColumnStretch(i, 50);
}
+ sliderGrid->addItem(new QSpacerItem(2,0),0,3);
grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2);
sl = new DoubleLabel(0.0, config.minSlider, 10.0, this);
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
index 17de3d86..973bcc57 100644
--- a/muse2/muse/songfile.cpp
+++ b/muse2/muse/songfile.cpp
@@ -8,6 +8,7 @@
#include <assert.h>
#include <uuid/uuid.h>
+#include <QProgressDialog>
#include "app.h"
#include "song.h"
@@ -1206,6 +1207,9 @@ void Song::read(Xml& xml)
{
cloneList.clear();
for (;;) {
+ if (muse->progress)
+ muse->progress->setValue(muse->progress->value()+1);
+
Xml::Token token;
token = xml.parse();
const QString& tag = xml.s1();
@@ -1353,6 +1357,8 @@ void MusE::read(Xml& xml, bool skipConfig)
{
bool skipmode = true;
for (;;) {
+ if (progress)
+ progress->setValue(progress->value()+1);
Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token) {