mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Show progress bar works when preloading sessions
This commit is contained in:
parent
a09308db2c
commit
fc78ebfc16
@ -499,7 +499,10 @@ void Machine::setInfo(MachineInfo inf)
|
||||
|
||||
const QString Machine::getDataPath()
|
||||
{
|
||||
return p_profile->Get("{" + STR_GEN_DataFolder + "}/" + info.loadername + "_" + (info.serial.isEmpty() ? hexid() : info.serial)) + "/";
|
||||
if (m_dataPath.isEmpty()) {
|
||||
m_dataPath = p_profile->Get("{" + STR_GEN_DataFolder + "}/" + info.loadername + "_" + (info.serial.isEmpty() ? hexid() : info.serial)) + "/";
|
||||
}
|
||||
return m_dataPath;
|
||||
}
|
||||
const QString Machine::getSummariesPath()
|
||||
{
|
||||
@ -535,7 +538,7 @@ bool Machine::Load()
|
||||
|
||||
QProgressBar * progress = popup->progress;
|
||||
|
||||
if (!LoadSummary()) {
|
||||
if (!LoadSummary(progress)) {
|
||||
// No XML index file, so assume upgrading, or it simply just got screwed up or deleted...
|
||||
QTime time;
|
||||
time.start();
|
||||
@ -844,7 +847,7 @@ bool Machine::hasModifiedSessions()
|
||||
|
||||
const QString summaryFileName = "Summaries.xml";
|
||||
|
||||
bool Machine::LoadSummary()
|
||||
bool Machine::LoadSummary(QProgressBar * progress)
|
||||
{
|
||||
QTime time;
|
||||
time.start();
|
||||
@ -911,7 +914,12 @@ bool Machine::LoadSummary()
|
||||
int cnt = 0;
|
||||
bool loadSummaries = p_profile->session->preloadSummaries();
|
||||
|
||||
progress->setMaximum(sess_order.size());
|
||||
for (it = sess_order.begin(); it != it_end; ++it, ++cnt) {
|
||||
if ((cnt % 100) == 0) {
|
||||
progress->setValue(cnt);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
Session * sess = it.value();
|
||||
if (!AddSession(sess)) {
|
||||
delete sess;
|
||||
@ -919,6 +927,8 @@ bool Machine::LoadSummary()
|
||||
if (loadSummaries) sess->LoadSummary();
|
||||
}
|
||||
}
|
||||
progress->setValue(sess_order.size());
|
||||
QApplication::processEvents();
|
||||
|
||||
qDebug() << "Loaded" << info.series << info.model << "data in" << time.elapsed() << "ms";
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QSemaphore>
|
||||
#include <QProgressBar>
|
||||
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
@ -87,7 +88,7 @@ class Machine
|
||||
|
||||
//! \brief Load all Machine summary data
|
||||
bool Load();
|
||||
bool LoadSummary();
|
||||
bool LoadSummary(QProgressBar * progress);
|
||||
|
||||
//! \brief Save all Sessions where changed bit is set.
|
||||
bool Save();
|
||||
@ -246,6 +247,10 @@ class Machine
|
||||
QList<ImportTask *> m_tasklist;
|
||||
|
||||
QHash<ChannelID, bool> m_availableChannels;
|
||||
|
||||
QString m_summaryPath;
|
||||
QString m_eventsPath;
|
||||
QString m_dataPath;
|
||||
};
|
||||
|
||||
|
||||
|
@ -374,7 +374,7 @@ bool Session::LoadSummary()
|
||||
}
|
||||
|
||||
|
||||
qDebug() << "Loading" << s_machine->loaderName() << "Summary" << filename << sumcnt++;
|
||||
// qDebug() << "Loading" << s_machine->loaderName() << "Summary" << filename << sumcnt++;
|
||||
|
||||
QDataStream in(&file);
|
||||
in.setVersion(QDataStream::Qt_4_6);
|
||||
|
Loading…
Reference in New Issue
Block a user