18 #include "ui_BlueBerryExampleLauncherDialog.h"
20 #include <QCoreApplication>
23 #include <QPushButton>
30 connect(
this, SIGNAL(accepted()),
this, SLOT(configurationSelected()));
31 connect(
this, SIGNAL(rejected()),
this, SLOT(dialogCanceled()));
32 connect(ui->appList, SIGNAL(currentRowChanged(
int)),
this, SLOT(selectionChanged(
int)));
35 QDir appDir(QApplication::applicationDirPath());
40 provisioningFiles = appDir.entryList(
41 QStringList(QApplication::applicationName() +
"_*.provisioning"), QDir::Files | QDir::Readable, QDir::Name);
55 if (provisioningFiles.empty())
60 provisioningFiles = appDir.entryList(
61 QStringList(QApplication::applicationName() +
"_*.provisioning"), QDir::Files | QDir::Readable, QDir::Name);
65 foreach (QString provFile, provisioningFiles)
67 int startIndex = provFile.indexOf(
'_');
68 int endIndex = provFile.lastIndexOf(
'.');
69 ui->appList->addItem(provFile.mid(startIndex + 1, endIndex - startIndex - 1));
71 descriptions.push_back(QString());
72 QString descriptionFileName = provFile.left(provFile.lastIndexOf(
'.')) +
".txt";
73 QFile descriptionFile(appDir.filePath(descriptionFileName));
75 if (descriptionFile.exists())
77 if (descriptionFile.open(QIODevice::ReadOnly))
79 descriptions.back() = descriptionFile.readAll();
84 if (ui->appList->currentRow() == -1)
85 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
false);
97 if (eventLoop.exec() == 0)
99 QDir appDir = QCoreApplication::applicationDirPath();
116 QFileInfo filePath(appDir.filePath(provisioningFiles[ui->appList->currentRow()]));
118 if (!filePath.exists())
126 return appDir.filePath(provisioningFiles[ui->appList->currentRow()]);
132 void BlueBerryExampleLauncherDialog::configurationSelected()
137 void BlueBerryExampleLauncherDialog::dialogCanceled()
142 void BlueBerryExampleLauncherDialog::selectionChanged(
int row)
146 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
true);
147 ui->description->setHtml(this->descriptions[row]);
151 ui->description->clear();
BlueBerryExampleLauncherDialog(QWidget *parent=nullptr)
~BlueBerryExampleLauncherDialog()
QString getDemoConfiguration()