Commit 80705c16 authored by con's avatar con

Find examples also with shadow built Qt developer build.

Reviewed-by: Daniel Molkentin
parent dd408d10
......@@ -121,11 +121,6 @@ QtVersionManager::QtVersionManager()
writeVersionsIntoSettings();
if (Welcome::WelcomeMode *welcomeMode = qobject_cast<Welcome::WelcomeMode*>
(Core::ICore::instance()->modeManager()->mode(Core::Constants::MODE_WELCOME))) {
connect(this, SIGNAL(updatedExamples(QString, QString)),
welcomeMode, SIGNAL(updatedExamples(QString, QString)));
}
updateDocumentation();
updateExamples();
}
......@@ -190,7 +185,9 @@ void QtVersionManager::updateExamples()
if (version->hasDemos())
demosPath = version->demosPath();
if (!examplesPath.isEmpty() && !demosPath.isEmpty()) {
emit updatedExamples(examplesPath, demosPath);
if (Welcome::WelcomeMode *welcomeMode = qobject_cast<Welcome::WelcomeMode*>
(Core::ICore::instance()->modeManager()->mode(Core::Constants::MODE_WELCOME)))
welcomeMode->updateExamples(examplesPath, demosPath, version->sourcePath());
return;
}
}
......
......@@ -201,7 +201,6 @@ public:
signals:
void defaultQtVersionChanged();
void qtVersionsChanged();
void updatedExamples(const QString& examplesPath, const QString& demosPath);
private:
static QString findQMakeLine(const QString &directory);
static QString trimLine(const QString line);
......
......@@ -169,9 +169,6 @@ WelcomeMode::WelcomeMode() :
connect(m_d->ui.openExampleButton, SIGNAL(clicked()), SLOT(slotOpenExample()));
connect(m_d->ui.examplesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotEnableExampleButton(int)));
connect(this, SIGNAL(updatedExamples(QString, QString)),
this, SLOT(slotUpdateExamples(QString, QString)));
connect(m_d->rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)),
m_d->ui.newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString)));
......@@ -315,11 +312,14 @@ void WelcomeMode::slotUrlClicked(const QString &data)
QDesktopServices::openUrl(QUrl(data));
}
void WelcomeMode::slotUpdateExamples(const QString& examplePath, const QString& demosPath)
void WelcomeMode::updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath)
{
QString demoxml = demosPath + "/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml))
return;
if (!QFile::exists(demoxml)) {
demoxml = sourcePath + "/demos/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml))
return;
}
QFile description(demoxml);
if (!description.open(QFile::ReadOnly))
......@@ -353,7 +353,10 @@ void WelcomeMode::slotUpdateExamples(const QString& examplePath, const QString&
if (inExamples && reader.name() == "example") {
QString name = reader.attributes().value(QLatin1String("name")).toString();
QString fn = reader.attributes().value(QLatin1String("filename")).toString();
QString fileName = examplePath + '/' + dirName + '/' + fn + '/' + fn + ".pro";
QString relativeProPath = '/' + dirName + '/' + fn + '/' + fn + ".pro";
QString fileName = examplePath + relativeProPath;
if (!QFile::exists(fileName))
fileName = sourcePath + "/examples" + relativeProPath;
QString helpPath = "qthelp://com.trolltech.qt/qdoc/" + dirName.replace("/", "-") + "-" + fn + ".html";
m_d->ui.examplesComboBox->addItem(" " + name, fileName);
......
......@@ -76,20 +76,20 @@ public:
void activated();
QString contextHelpId() const { return QLatin1String("Qt Creator"); }
void updateExamples(const QString& examplePath, const QString& demosPath, const QString &demosPath);
signals:
void requestProject(const QString &project);
void requestSession(const QString &session);
void openHelpPage(const QString& url);
void openContextHelpPage(const QString& url);
void manageSessions();
void updatedExamples(const QString& examplePath, const QString& demosPath);
private slots:
void slotFeedback();
void slotSessionClicked(const QString &data);
void slotProjectClicked(const QString &data);
void slotUrlClicked(const QString &data);
void slotUpdateExamples(const QString& examplePath, const QString& demosPath);
void slotEnableExampleButton(int);
void slotOpenExample();
void slotCreateNewProject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment