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() ...@@ -121,11 +121,6 @@ QtVersionManager::QtVersionManager()
writeVersionsIntoSettings(); 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(); updateDocumentation();
updateExamples(); updateExamples();
} }
...@@ -190,7 +185,9 @@ void QtVersionManager::updateExamples() ...@@ -190,7 +185,9 @@ void QtVersionManager::updateExamples()
if (version->hasDemos()) if (version->hasDemos())
demosPath = version->demosPath(); demosPath = version->demosPath();
if (!examplesPath.isEmpty() && !demosPath.isEmpty()) { 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; return;
} }
} }
......
...@@ -201,7 +201,6 @@ public: ...@@ -201,7 +201,6 @@ public:
signals: signals:
void defaultQtVersionChanged(); void defaultQtVersionChanged();
void qtVersionsChanged(); void qtVersionsChanged();
void updatedExamples(const QString& examplesPath, const QString& demosPath);
private: private:
static QString findQMakeLine(const QString &directory); static QString findQMakeLine(const QString &directory);
static QString trimLine(const QString line); static QString trimLine(const QString line);
......
...@@ -169,9 +169,6 @@ WelcomeMode::WelcomeMode() : ...@@ -169,9 +169,6 @@ WelcomeMode::WelcomeMode() :
connect(m_d->ui.openExampleButton, SIGNAL(clicked()), SLOT(slotOpenExample())); connect(m_d->ui.openExampleButton, SIGNAL(clicked()), SLOT(slotOpenExample()));
connect(m_d->ui.examplesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotEnableExampleButton(int))); 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)), connect(m_d->rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)),
m_d->ui.newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString))); m_d->ui.newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString)));
...@@ -315,11 +312,14 @@ void WelcomeMode::slotUrlClicked(const QString &data) ...@@ -315,11 +312,14 @@ void WelcomeMode::slotUrlClicked(const QString &data)
QDesktopServices::openUrl(QUrl(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"; QString demoxml = demosPath + "/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml)) {
demoxml = sourcePath + "/demos/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml)) if (!QFile::exists(demoxml))
return; return;
}
QFile description(demoxml); QFile description(demoxml);
if (!description.open(QFile::ReadOnly)) if (!description.open(QFile::ReadOnly))
...@@ -353,7 +353,10 @@ void WelcomeMode::slotUpdateExamples(const QString& examplePath, const QString& ...@@ -353,7 +353,10 @@ void WelcomeMode::slotUpdateExamples(const QString& examplePath, const QString&
if (inExamples && reader.name() == "example") { if (inExamples && reader.name() == "example") {
QString name = reader.attributes().value(QLatin1String("name")).toString(); QString name = reader.attributes().value(QLatin1String("name")).toString();
QString fn = reader.attributes().value(QLatin1String("filename")).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"; QString helpPath = "qthelp://com.trolltech.qt/qdoc/" + dirName.replace("/", "-") + "-" + fn + ".html";
m_d->ui.examplesComboBox->addItem(" " + name, fileName); m_d->ui.examplesComboBox->addItem(" " + name, fileName);
......
...@@ -76,20 +76,20 @@ public: ...@@ -76,20 +76,20 @@ public:
void activated(); void activated();
QString contextHelpId() const { return QLatin1String("Qt Creator"); } QString contextHelpId() const { return QLatin1String("Qt Creator"); }
void updateExamples(const QString& examplePath, const QString& demosPath, const QString &demosPath);
signals: signals:
void requestProject(const QString &project); void requestProject(const QString &project);
void requestSession(const QString &session); void requestSession(const QString &session);
void openHelpPage(const QString& url); void openHelpPage(const QString& url);
void openContextHelpPage(const QString& url); void openContextHelpPage(const QString& url);
void manageSessions(); void manageSessions();
void updatedExamples(const QString& examplePath, const QString& demosPath);
private slots: private slots:
void slotFeedback(); void slotFeedback();
void slotSessionClicked(const QString &data); void slotSessionClicked(const QString &data);
void slotProjectClicked(const QString &data); void slotProjectClicked(const QString &data);
void slotUrlClicked(const QString &data); void slotUrlClicked(const QString &data);
void slotUpdateExamples(const QString& examplePath, const QString& demosPath);
void slotEnableExampleButton(int); void slotEnableExampleButton(int);
void slotOpenExample(); void slotOpenExample();
void slotCreateNewProject(); 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