forked from qt-creator/qt-creator
QmlDesigner: remove unused code (meego, ...)
Change-Id: I25c1bc568b2d83cc8f166a041dc56c022d5f638a Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
@@ -168,18 +168,12 @@ void ItemLibraryWidget::setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo)
|
|||||||
|
|
||||||
void ItemLibraryWidget::updateImports()
|
void ItemLibraryWidget::updateImports()
|
||||||
{
|
{
|
||||||
FilterChangeFlag filter;
|
|
||||||
filter = QtBasic;
|
|
||||||
if (m_model) {
|
if (m_model) {
|
||||||
QStringList imports;
|
QStringList imports;
|
||||||
foreach (const Import &import, m_model->imports())
|
foreach (const Import &import, m_model->imports())
|
||||||
if (import.isLibraryImport())
|
if (import.isLibraryImport())
|
||||||
imports << import.url();
|
imports << import.url();
|
||||||
if (imports.contains(QLatin1String("com.nokia.meego"), Qt::CaseInsensitive))
|
|
||||||
filter = Meego;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setImportFilter(filter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryWidget::setImportsWidget(QWidget *importsWidget)
|
void ItemLibraryWidget::setImportsWidget(QWidget *importsWidget)
|
||||||
@@ -225,30 +219,6 @@ void ItemLibraryWidget::setModel(Model *model)
|
|||||||
updateModel();
|
updateModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryWidget::emitImportChecked()
|
|
||||||
{
|
|
||||||
if (!m_model)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool qtOnlyImport = false;
|
|
||||||
bool meegoImport = false;
|
|
||||||
|
|
||||||
foreach (const Import &import, m_model->imports()) {
|
|
||||||
if (import.isLibraryImport()) {
|
|
||||||
if (import.url().contains(QLatin1String("meego"), Qt::CaseInsensitive))
|
|
||||||
meegoImport = true;
|
|
||||||
if (import.url().contains(QLatin1String("Qt"), Qt::CaseInsensitive) || import.url().contains(QLatin1String("QtQuick"), Qt::CaseInsensitive))
|
|
||||||
qtOnlyImport = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (meegoImport)
|
|
||||||
qtOnlyImport = false;
|
|
||||||
|
|
||||||
emit qtBasicOnlyChecked(qtOnlyImport);
|
|
||||||
emit meegoChecked(meegoImport);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ItemLibraryWidget::setCurrentIndexOfStackedWidget(int index)
|
void ItemLibraryWidget::setCurrentIndexOfStackedWidget(int index)
|
||||||
{
|
{
|
||||||
if (index == 2)
|
if (index == 2)
|
||||||
@@ -272,55 +242,6 @@ void ItemLibraryWidget::reloadQmlSource()
|
|||||||
m_itemViewQuickWidget->setSource(QUrl::fromLocalFile(itemLibraryQmlFilePath));
|
m_itemViewQuickWidget->setSource(QUrl::fromLocalFile(itemLibraryQmlFilePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryWidget::setImportFilter(FilterChangeFlag flag)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
|
|
||||||
static bool block = false;
|
|
||||||
if (!m_model)
|
|
||||||
return;
|
|
||||||
if (flag == m_filterFlag)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (block == true)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
FilterChangeFlag oldfilterFlag = m_filterFlag;
|
|
||||||
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
|
||||||
try {
|
|
||||||
block = true;
|
|
||||||
if (flag == QtBasic)
|
|
||||||
removeImport(QStringLiteral("com.nokia.meego"));
|
|
||||||
else if (flag == Meego)
|
|
||||||
addImport(QStringLiteral("com.nokia.meego"), QStringLiteral("1.0"));
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
block = false;
|
|
||||||
m_filterFlag = flag;
|
|
||||||
} catch (const RewritingException &) {
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
m_filterFlag = oldfilterFlag;
|
|
||||||
block = false;
|
|
||||||
// do something about it
|
|
||||||
}
|
|
||||||
|
|
||||||
emitImportChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ItemLibraryWidget::onQtBasicOnlyChecked(bool b)
|
|
||||||
{
|
|
||||||
if (b)
|
|
||||||
setImportFilter(QtBasic);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ItemLibraryWidget::onMeegoChecked(bool b)
|
|
||||||
{
|
|
||||||
if (b)
|
|
||||||
setImportFilter(Meego);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ItemLibraryWidget::updateModel()
|
void ItemLibraryWidget::updateModel()
|
||||||
{
|
{
|
||||||
m_itemLibraryModel->update(m_itemLibraryInfo.data(), m_model.data());
|
m_itemLibraryModel->update(m_itemLibraryInfo.data(), m_model.data());
|
||||||
|
|||||||
@@ -95,20 +95,12 @@ public slots:
|
|||||||
|
|
||||||
void setModel(Model *model);
|
void setModel(Model *model);
|
||||||
|
|
||||||
void setImportFilter(FilterChangeFlag flag);
|
|
||||||
|
|
||||||
void onQtBasicOnlyChecked(bool b);
|
|
||||||
void onMeegoChecked(bool b);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void removeImport(const QString &name);
|
void removeImport(const QString &name);
|
||||||
void addImport(const QString &name, const QString &version);
|
void addImport(const QString &name, const QString &version);
|
||||||
void emitImportChecked();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void itemActivated(const QString& itemName);
|
void itemActivated(const QString& itemName);
|
||||||
void qtBasicOnlyChecked(bool b);
|
|
||||||
void meegoChecked(bool b);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setCurrentIndexOfStackedWidget(int index);
|
void setCurrentIndexOfStackedWidget(int index);
|
||||||
|
|||||||
Reference in New Issue
Block a user