Commit 39f1ce05 authored by hjk's avatar hjk
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents a8342123 8fd841c1
......@@ -2,7 +2,7 @@ unix {
QDOC = SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html $$(QTDIR)/tools/qdoc3/qdoc3
HELPGENERATOR = $$(QTDIR)/bin/qhelpgenerator
} else {
QDOC = $$(QTDIR)\tools\qdoc3\release\qdoc3.exe
QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& $$(QTDIR)\tools\qdoc3\release\qdoc3.exe
HELPGENERATOR = $$(QTDIR)\bin\qhelpgenerator.exe
}
......
......@@ -57,6 +57,7 @@
#include "AST.h"
#include "Literals.h"
#include <cstdlib>
#include <cstring>
#include <cassert>
CPLUSPLUS_BEGIN_NAMESPACE
......
......@@ -425,6 +425,12 @@ bool ResolveExpression::visit(UnaryExpressionAST *ast)
return false;
}
bool ResolveExpression::visit(CompoundLiteralAST *ast)
{
accept(ast->type_id);
return false;
}
bool ResolveExpression::visit(QualifiedNameAST *ast)
{
ResolveClass resolveClass;
......
......@@ -105,6 +105,7 @@ protected:
virtual bool visit(ThrowExpressionAST *ast);
virtual bool visit(TypeIdAST *ast);
virtual bool visit(UnaryExpressionAST *ast);
virtual bool visit(CompoundLiteralAST *ast);
//names
virtual bool visit(QualifiedNameAST *ast);
......
......@@ -54,7 +54,8 @@ public:
virtual QString trCategory() const = 0;
virtual QWidget *createPage(QWidget *parent) = 0;
virtual void finished(bool accepted) = 0;
virtual void apply() = 0;
virtual void finish() = 0;
};
} // namespace Core
......
......@@ -126,20 +126,22 @@ void SettingsDialog::pageSelected(QTreeWidgetItem *)
void SettingsDialog::accept()
{
foreach (IOptionsPage *page, m_pages)
page->finished(true);
foreach (IOptionsPage *page, m_pages) {
page->apply();
page->finish();
}
done(QDialog::Accepted);
}
void SettingsDialog::reject()
{
foreach (IOptionsPage *page, m_pages)
page->finished(false);
page->finish();
done(QDialog::Rejected);
}
void SettingsDialog::apply()
{
foreach (IOptionsPage *page, m_pages)
page->finished(true);
page->apply();
}
......@@ -120,14 +120,14 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
return w;
}
void ShortcutSettings::finished(bool accepted)
void ShortcutSettings::apply()
{
if (accepted) {
foreach (ShortcutItem *item, m_scitems) {
item->m_cmd->setKeySequence(item->m_key);
}
}
foreach (ShortcutItem *item, m_scitems)
item->m_cmd->setKeySequence(item->m_key);
}
void ShortcutSettings::finish()
{
qDeleteAll(m_scitems);
m_scitems.clear();
}
......
......@@ -77,7 +77,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish();
protected:
bool eventFilter(QObject *o, QEvent *e);
......
......@@ -81,11 +81,8 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
return w;
}
void GeneralSettings::finished(bool accepted)
void GeneralSettings::apply()
{
if (!accepted)
return;
// Apply the new base color if accepted
StyleHelper::setBaseColor(m_page->colorButton->color());
EditorManager::instance()->setExternalEditor(m_page->externalEditorEdit->text());
......
......@@ -55,7 +55,8 @@ public:
QString category() const;
QString trCategory() const;
QWidget* createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
private slots:
void resetInterfaceColor();
......
......@@ -86,11 +86,8 @@ QWidget *SettingsPage::createPage(QWidget *parent)
return w;
}
void SettingsPage::finished(bool accepted)
void SettingsPage::apply()
{
if (!accepted)
return;
m_username = m_ui.userEdit->text();
m_server = QUrl(m_ui.serverEdit->text());
m_copy = m_ui.clipboardBox->isChecked();
......
......@@ -59,7 +59,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
QString username() const;
QUrl serverUrl() const;
......
......@@ -78,11 +78,8 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent)
return w;
}
void CompletionSettingsPage::finished(bool accepted)
void CompletionSettingsPage::apply()
{
if (!accepted)
return;
m_completion->setCaseSensitivity(
m_page->caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive);
m_completion->setAutoInsertBraces(m_page->autoInsertBraces->isChecked());
......
......@@ -56,7 +56,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
private:
CppCodeCompletion *m_completion;
......
......@@ -122,11 +122,8 @@ void GdbOptionPage::onScriptFileChanged()
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
}
void GdbOptionPage::finished(bool accepted)
void GdbOptionPage::apply()
{
if (!accepted)
return;
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
m_settings->m_gdbEnv = m_ui.environmentEdit->text();
m_settings->m_autoRun = m_ui.autoStartBox->isChecked();
......
......@@ -59,7 +59,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
public slots:
void onGdbLocationChanged();
......
......@@ -39,7 +39,8 @@
using namespace Designer::Internal;
SettingsPage::SettingsPage(QDesignerOptionsPageInterface *designerPage) :
m_designerPage(designerPage)
m_designerPage(designerPage),
m_applyOnFinish(false)
{
}
......@@ -64,10 +65,17 @@ QString SettingsPage::trCategory() const
QWidget *SettingsPage::createPage(QWidget *parent)
{
m_applyOnFinish = false;
return m_designerPage->createPage(parent);
}
void SettingsPage::finished(bool accepted)
void SettingsPage::apply()
{
m_designerPage->finish(accepted);
// FIXME: Since no cleanup should be done here, we can't call finish(true)
m_applyOnFinish = true;
}
void SettingsPage::finish()
{
m_designerPage->finish(m_applyOnFinish);
}
......@@ -59,10 +59,12 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish();
private:
QDesignerOptionsPageInterface *m_designerPage;
bool m_applyOnFinish;
};
} // namespace Internal
......
......@@ -95,11 +95,10 @@ QWidget *SettingsPage::createPage(QWidget *parent)
return m_widget;
}
void SettingsPage::finished(bool accepted)
void SettingsPage::apply()
{
if (!accepted || !m_widget)
if (!m_widget)
return;
GitPlugin::instance()->setSettings(m_widget->settings());
}
......@@ -77,7 +77,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
private:
QPointer<SettingsPageWidget> m_widget;
......
......@@ -38,7 +38,7 @@
#include <QtHelp/QHelpEngine>
using namespace Help::Internal;
DocSettingsPage::DocSettingsPage(QHelpEngine *helpEngine)
: m_helpEngine(helpEngine),
m_registeredDocs(false)
......@@ -64,16 +64,16 @@ QWidget *DocSettingsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
connect(m_ui.addButton, SIGNAL(clicked()),
this, SLOT(addDocumentation()));
connect(m_ui.removeButton, SIGNAL(clicked()),
this, SLOT(removeDocumentation()));
m_ui.docsListWidget->addItems(m_helpEngine->registeredDocumentations());
m_registeredDocs = false;
m_removeDocs.clear();
return w;
}
......@@ -82,7 +82,7 @@ void DocSettingsPage::addDocumentation()
QStringList files = QFileDialog::getOpenFileNames(m_ui.addButton->parentWidget(),
tr("Add Documentation"),
QString(), tr("Qt Help Files (*.qch)"));
if (files.isEmpty())
return;
......@@ -107,23 +107,20 @@ void DocSettingsPage::removeDocumentation()
QListWidgetItem *item = m_ui.docsListWidget->currentItem();
if (!item)
return;
m_removeDocs.append(item->text());
int row = m_ui.docsListWidget->currentRow();
m_ui.docsListWidget->takeItem(row);
m_ui.docsListWidget->takeItem(row);
if (row > 0)
--row;
if (m_ui.docsListWidget->count())
m_ui.docsListWidget->setCurrentRow(row);
delete item;
delete item;
}
void DocSettingsPage::finished(bool accepted)
void DocSettingsPage::apply()
{
if (!accepted)
return;
emit dialogAccepted();
}
......
......@@ -57,7 +57,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
bool applyChanges();
......
......@@ -173,8 +173,10 @@ void FilterSettingsPage::removeFilter()
m_ui.filterWidget->setCurrentRow(0);
}
void FilterSettingsPage::finished(bool)
void FilterSettingsPage::apply()
{
// This is handled via HelpPlugin::checkForHelpChanges, which is connected
// to DocSettingsPage::apply.
}
bool FilterSettingsPage::applyChanges()
......
......@@ -56,7 +56,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
bool applyChanges();
......
......@@ -96,9 +96,9 @@ QWidget *SettingsPage::createPage(QWidget *parent)
return m_widget;
}
void SettingsPage::finished(bool accepted)
void SettingsPage::apply()
{
if (!accepted || !m_widget)
if (!m_widget)
return;
PerforcePlugin::perforcePluginInstance()->setSettings(m_widget->settings());
......
......@@ -70,7 +70,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
private:
QPointer<SettingsPageWidget> m_widget;
......
......@@ -162,11 +162,8 @@ void QtVersionManager::updateUniqueIdToIndexMap()
m_uniqueIdToIndex.insert(m_versions.at(i)->uniqueId(), i);
}
void QtVersionManager::finished(bool accepted)
void QtVersionManager::apply()
{
if (!accepted)
return;
m_widget->finish();
QList<QtVersion*> newVersions = m_widget->versions();
bool versionPathsChanged = m_versions.size() != newVersions.size();
......
......@@ -172,7 +172,8 @@ public:
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void finished(bool accepted);
void apply();
void finish() { }
void writeVersionsIntoSettings();
......
......@@ -71,7 +71,7 @@ QList<FilterEntry> QuickOpenFiltersFilter::matchesFor(const QString &entry)
{
QList<FilterEntry> entries;
if (entry.isEmpty()) {
foreach (IQuickOpenFilter *filter, m_plugin->filter()) {
foreach (IQuickOpenFilter *filter, m_plugin->filters()) {
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
FilterEntry entry(this,
filter->shortcutString(),
......
......@@ -76,8 +76,7 @@ QuickOpenPlugin::~QuickOpenPlugin()
delete m_openDocumentsFilter;
delete m_fileSystemFilter;
delete m_settingsPage;
foreach (IQuickOpenFilter *filter, m_customFilter)
delete filter;
qDeleteAll(m_customFilters);
}
bool QuickOpenPlugin::initialize(const QStringList &, QString *)
......@@ -125,8 +124,8 @@ void QuickOpenPlugin::openQuickOpen()
void QuickOpenPlugin::extensionsInitialized()
{
m_filter = ExtensionSystem::PluginManager::instance()->getObjects<IQuickOpenFilter>();
qSort(m_filter.begin(), m_filter.end(), filterLessThan);
m_filters = ExtensionSystem::PluginManager::instance()->getObjects<IQuickOpenFilter>();
qSort(m_filters.begin(), m_filters.end(), filterLessThan);
}
void QuickOpenPlugin::startSettingsLoad()
......@@ -141,7 +140,7 @@ void QuickOpenPlugin::loadSettings()
QSettings settings;
settings.beginGroup("QuickOpen");
m_refreshTimer.setInterval(settings.value("RefreshInterval", 60).toInt()*60000);
foreach (IQuickOpenFilter *filter, m_filter) {
foreach (IQuickOpenFilter *filter, m_filters) {
if (settings.contains(filter->name())) {
const QByteArray state = settings.value(filter->name()).toByteArray();
if (!state.isEmpty())
......@@ -153,10 +152,10 @@ void QuickOpenPlugin::loadSettings()
foreach (const QString &key, settings.childKeys()) {
IQuickOpenFilter *filter = new DirectoryFilter(core);
filter->restoreState(settings.value(key).toByteArray());
m_filter.append(filter);
m_filters.append(filter);
customFilters.append(filter);
}
setCustomFilter(customFilters);
setCustomFilters(customFilters);
settings.endGroup();
settings.endGroup();
}
......@@ -176,14 +175,14 @@ void QuickOpenPlugin::saveSettings()
s->beginGroup("QuickOpen");
s->setValue("Interval", m_refreshTimer.interval()/60000);
s->remove("");
foreach (IQuickOpenFilter *filter, m_filter) {
if (!m_customFilter.contains(filter)) {
foreach (IQuickOpenFilter *filter, m_filters) {
if (!m_customFilters.contains(filter)) {
s->setValue(filter->name(), filter->saveState());
}
}
s->beginGroup("CustomFilters");
int i = 0;
foreach (IQuickOpenFilter *filter, m_customFilter) {
foreach (IQuickOpenFilter *filter, m_customFilters) {
s->setValue(QString("directory%1").arg(i), filter->saveState());
++i;
}
......@@ -197,9 +196,9 @@ void QuickOpenPlugin::saveSettings()
Return all filters, including the ones created by the user.
*/
QList<IQuickOpenFilter*> QuickOpenPlugin::filter()
QList<IQuickOpenFilter*> QuickOpenPlugin::filters()
{
return m_filter;
return m_filters;
}
/*!
......@@ -208,20 +207,20 @@ QList<IQuickOpenFilter*> QuickOpenPlugin::filter()
This returns a subset of all the filters, that contains only the filters that
have been created by the user at some point (maybe in a previous session).
*/
QList<IQuickOpenFilter*> QuickOpenPlugin::customFilter()
QList<IQuickOpenFilter*> QuickOpenPlugin::customFilters()
{
return m_customFilter;
return m_customFilters;
}
void QuickOpenPlugin::setFilter(QList<IQuickOpenFilter*> f)
void QuickOpenPlugin::setFilters(QList<IQuickOpenFilter*> f)
{
m_filter = f;
m_filters = f;
m_quickOpenToolWindow->updateFilterList();
}
void QuickOpenPlugin::setCustomFilter(QList<IQuickOpenFilter *> filter)
void QuickOpenPlugin::setCustomFilters(QList<IQuickOpenFilter *> filters)
{
m_customFilter = filter;
m_customFilters = filters;
}
int QuickOpenPlugin::refreshInterval()
......@@ -243,7 +242,7 @@ void QuickOpenPlugin::setRefreshInterval(int interval)
void QuickOpenPlugin::refresh(QList<IQuickOpenFilter*> filters)
{
if (filters.isEmpty())
filters = m_filter;
filters = m_filters;
QFuture<void> task = QtConcurrent::run(&IQuickOpenFilter::refresh, filters);
Core::FutureProgress *progress = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()
->progressManager()->addTask(task, tr("Indexing"), Constants::TASK_INDEX, Core::ProgressManager::CloseOnSuccess);
......
......@@ -61,10 +61,10 @@ public:
bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized();
QList<IQuickOpenFilter*> filter();
QList<IQuickOpenFilter*> customFilter();
void setFilter(QList<IQuickOpenFilter*> f);
void setCustomFilter(QList<IQuickOpenFilter*> f);
QList<IQuickOpenFilter*> filters();
QList<IQuickOpenFilter*> customFilters();
void setFilters(QList<IQuickOpenFilter*> f);
void setCustomFilters(QList<IQuickOpenFilter*> f);
int refreshInterval();
void setRefreshInterval(int interval);
......@@ -83,8 +83,8 @@ private:
QuickOpenToolWindow *m_quickOpenToolWindow;
SettingsPage *m_settingsPage;
QList<IQuickOpenFilter*> m_filter;
QList<IQuickOpenFilter*> m_customFilter;
QList<IQuickOpenFilter*> m_filters;
QList<IQuickOpenFilter*> m_customFilters;
int m_refreshInterval;
QTimer m_refreshTimer;
OpenDocumentsFilter *m_openDocumentsFilter;
......
......@@ -313,7 +313,7 @@ bool QuickOpenToolWindow::isShowingTypeHereMessage() const
void QuickOpenToolWindow::updateFilterList()
{
m_filterMenu->clear();
foreach (IQuickOpenFilter *filter, m_quickOpenPlugin->filter()) {
foreach (IQuickOpenFilter *filter, m_quickOpenPlugin->filters()) {
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
QAction *action = m_filterMenu->addAction(filter->trName(), this, SLOT(filterSelected()));
action->setData(qVariantFromValue(filter));
......@@ -379,7 +379,7 @@ void QuickOpenToolWindow::textEdited(const QString &text)
QList<IQuickOpenFilter*> QuickOpenToolWindow::filtersFor(const QString &text, QString &searchText)
{
QList<IQuickOpenFilter*> filters = m_quickOpenPlugin->filter();
QList<IQuickOpenFilter*> filters = m_quickOpenPlugin->filters();
int whiteSpace = text.indexOf(" ");
QString prefix;
if (whiteSpace >= 0)
...