65
66
m_ui->splashScreenWarningLabel->setVisible(false);
66
67
m_ui->splashScreenWarningPixmap->setVisible(false);
68
connect(m_ui->applicationName, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
69
connect(m_ui->applicationDescription, SIGNAL(textChanged()), this, SIGNAL(changed()));
71
69
connect(m_ui->iconFilePath, SIGNAL(changed(QString)), this, SLOT(handleIconChanged(QString)));
72
70
connect(m_ui->iconClearButton, SIGNAL(clicked()), this, SLOT(clearIcon()));
75
73
m_ui->splashScreensView->setModel(m_splashScreenModel);
76
74
connect(m_ui->addSplashScreen, SIGNAL(clicked()), this, SLOT(browseForSplashScreen()));
77
75
connect(m_ui->removeSplashScreen, SIGNAL(clicked()), this, SLOT(removeSelectedSplashScreen()));
78
connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
79
76
connect(m_ui->splashScreensView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSplashScreenSelectionChanged(QItemSelection,QItemSelection)));
78
addSignalMapping(BarDescriptorDocument::name, m_ui->applicationName, SIGNAL(textChanged(QString)));
79
addSignalMapping(BarDescriptorDocument::description, m_ui->applicationDescription, SIGNAL(textChanged()));
80
addSignalMapping(BarDescriptorDocument::icon, m_ui->iconFilePath, SIGNAL(changed(QString)));
81
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
82
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
83
addSignalMapping(BarDescriptorDocument::splashScreens, m_splashScreenModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
82
86
BarDescriptorEditorEntryPointWidget::~BarDescriptorEditorEntryPointWidget()
87
void BarDescriptorEditorEntryPointWidget::clear()
89
setPathChooserBlocked(m_ui->iconFilePath, QString());
90
setApplicationIconPreview(QString());
92
disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
93
m_splashScreenModel->setStringList(QStringList());
94
connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
95
setImagePreview(m_ui->splashScreenPreviewLabel, QString());
98
QString BarDescriptorEditorEntryPointWidget::applicationName() const
100
return m_ui->applicationName->text();
103
void BarDescriptorEditorEntryPointWidget::setApplicationName(const QString &applicationName)
105
setLineEditBlocked(m_ui->applicationName, applicationName);
108
QString BarDescriptorEditorEntryPointWidget::applicationDescription() const
110
return m_ui->applicationDescription->toPlainText();
113
void BarDescriptorEditorEntryPointWidget::setApplicationDescription(const QString &applicationDescription)
115
setTextEditBlocked(m_ui->applicationDescription, applicationDescription);
118
QString BarDescriptorEditorEntryPointWidget::applicationIconFileName() const
120
return QFileInfo(m_ui->iconFilePath->path()).fileName();
123
void BarDescriptorEditorEntryPointWidget::setApplicationIcon(const QString &iconPath)
125
// During file loading, the assets might not have been read yet
126
QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, iconPath));
129
QStringList BarDescriptorEditorEntryPointWidget::splashScreens() const
133
foreach (const QString &splashScreen, m_splashScreenModel->stringList())
134
result << QFileInfo(splashScreen).fileName();
139
void BarDescriptorEditorEntryPointWidget::appendSplashScreen(const QString &splashScreenPath)
141
QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreenPath));
144
91
void BarDescriptorEditorEntryPointWidget::setAssetsModel(QStandardItemModel *assetsModel)
146
93
m_assetsModel = QWeakPointer<QStandardItemModel>(assetsModel);
96
void BarDescriptorEditorEntryPointWidget::updateWidgetValue(BarDescriptorDocument::Tag tag, const QVariant &value)
98
// During file loading, the assets might not have been read yet
99
if (tag == BarDescriptorDocument::icon) {
100
QMetaObject::invokeMethod(this, "setApplicationIconDelayed", Qt::QueuedConnection, Q_ARG(QString, value.toString()));
101
} else if (tag == BarDescriptorDocument::splashScreens) {
102
QStringList splashScreens = value.toStringList();
103
foreach (const QString &splashScreen, splashScreens)
104
QMetaObject::invokeMethod(this, "appendSplashScreenDelayed", Qt::QueuedConnection, Q_ARG(QString, splashScreen));
106
BarDescriptorEditorAbstractPanelWidget::updateWidgetValue(tag, value);
110
void BarDescriptorEditorEntryPointWidget::emitChanged(BarDescriptorDocument::Tag tag)
112
if (tag == BarDescriptorDocument::icon) {
113
emit changed(tag, QFileInfo(m_ui->iconFilePath->path()).fileName());
114
} else if (tag == BarDescriptorDocument::splashScreens) {
116
foreach (const QString &splashScreen, m_splashScreenModel->stringList())
117
list << QFileInfo(splashScreen).fileName();
119
emit changed(tag, list);
121
BarDescriptorEditorAbstractPanelWidget::emitChanged(tag);
149
125
void BarDescriptorEditorEntryPointWidget::setApplicationIconPreview(const QString &path)
151
127
setImagePreview(m_ui->iconPreviewLabel, path);
230
207
if (fullSplashScreenPath.isEmpty())
233
disconnect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
210
blockSignalMapping(BarDescriptorDocument::splashScreens);
234
211
int rowCount = m_splashScreenModel->rowCount();
235
212
m_splashScreenModel->insertRow(rowCount);
236
213
m_splashScreenModel->setData(m_splashScreenModel->index(rowCount), fullSplashScreenPath);
237
connect(m_splashScreenModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(changed()));
214
unblockSignalMapping(BarDescriptorDocument::splashScreens);
240
217
void BarDescriptorEditorEntryPointWidget::setImagePreview(QLabel *previewLabel, const QString &path)