forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -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) {
|
||||
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;
|
||||
|
||||
@@ -119,11 +119,8 @@ void DocSettingsPage::removeDocumentation()
|
||||
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)
|
||||
@@ -460,7 +460,7 @@ void QuickOpenToolWindow::filterSelected()
|
||||
// add shortcut string at front or replace existing shortcut string
|
||||
if (!currentText.isEmpty()) {
|
||||
searchText = currentText;
|
||||
foreach (IQuickOpenFilter *otherfilter, m_quickOpenPlugin->filter()) {
|
||||
foreach (IQuickOpenFilter *otherfilter, m_quickOpenPlugin->filters()) {
|
||||
if (currentText.startsWith(otherfilter->shortcutString() + " ")) {
|
||||
searchText = currentText.mid(otherfilter->shortcutString().length()+1);
|
||||
break;
|
||||
|
||||
@@ -67,30 +67,41 @@ QWidget *SettingsPage::createPage(QWidget *parent)
|
||||
this, SLOT(removeCustomFilter()));
|
||||
}
|
||||
m_ui.refreshInterval->setValue(m_plugin->refreshInterval());
|
||||
m_filters = m_plugin->filter();
|
||||
m_customFilters = m_plugin->customFilter();
|
||||
m_filters = m_plugin->filters();
|
||||
m_customFilters = m_plugin->customFilters();
|
||||
saveFilterStates();
|
||||
updateFilterList();
|
||||
return m_page;
|
||||
}
|
||||
|
||||
void SettingsPage::finished(bool accepted)
|
||||
void SettingsPage::apply()
|
||||
{
|
||||
if (!accepted) {
|
||||
restoreFilterStates();
|
||||
foreach (IQuickOpenFilter *filter, m_addedFilters)
|
||||
delete filter;
|
||||
} else {
|
||||
foreach (IQuickOpenFilter *filter, m_removedFilters)
|
||||
delete filter;
|
||||
m_plugin->setFilter(m_filters);
|
||||
m_plugin->setCustomFilter(m_customFilters);
|
||||
// Delete removed filters and clear added filters
|
||||
qDeleteAll(m_removedFilters);
|
||||
m_removedFilters.clear();
|
||||
m_addedFilters.clear();
|
||||
|
||||
// Pass the new configuration on to the plugin
|
||||
m_plugin->setFilters(m_filters);
|
||||
m_plugin->setCustomFilters(m_customFilters);
|
||||
m_plugin->setRefreshInterval(m_ui.refreshInterval->value());
|
||||
requestRefresh();
|
||||
m_plugin->saveSettings();
|
||||
saveFilterStates();
|
||||
}
|
||||
|
||||
void SettingsPage::finish()
|
||||
{
|
||||
// If settings were applied, this shouldn't change anything. Otherwise it
|
||||
// makes sure the filter states aren't changed permanently.
|
||||
restoreFilterStates();
|
||||
|
||||
// Delete added filters and clear removed filters
|
||||
qDeleteAll(m_addedFilters);
|
||||
m_addedFilters.clear();
|
||||
m_removedFilters.clear();
|
||||
|
||||
// Further cleanup
|
||||
m_filters.clear();
|
||||
m_customFilters.clear();
|
||||
m_refreshFilters.clear();
|
||||
|
||||
@@ -66,7 +66,8 @@ public:
|
||||
QString trCategory() const { return tr(Constants::QUICKOPEN_CATEGORY); }
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void finished(bool accepted);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
private slots:
|
||||
void updateButtonStates();
|
||||
|
||||
@@ -100,9 +100,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;
|
||||
SubversionPlugin::subversionPluginInstance()->setSettings(m_widget->settings());
|
||||
}
|
||||
|
||||
@@ -76,7 +76,8 @@ public:
|
||||
QString trCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void finished(bool accepted);
|
||||
void apply();
|
||||
void finish() { }
|
||||
|
||||
private:
|
||||
QPointer<SettingsPageWidget> m_widget;
|
||||
|
||||
@@ -435,13 +435,8 @@ void FontSettingsPage::delayedChange()
|
||||
emit changed(d_ptr->m_value);
|
||||
}
|
||||
|
||||
void FontSettingsPage::finished(bool accepted)
|
||||
void FontSettingsPage::apply()
|
||||
{
|
||||
if (!accepted) {
|
||||
d_ptr->m_value = d_ptr->m_lastValue;
|
||||
return;
|
||||
}
|
||||
|
||||
d_ptr->m_value.setFamily(d_ptr->ui.familyComboBox->currentText());
|
||||
|
||||
bool ok = true;
|
||||
@@ -460,6 +455,12 @@ void FontSettingsPage::finished(bool accepted)
|
||||
}
|
||||
}
|
||||
|
||||
void FontSettingsPage::finish()
|
||||
{
|
||||
// If changes were applied, these are equal. Otherwise restores last value.
|
||||
d_ptr->m_value = d_ptr->m_lastValue;
|
||||
}
|
||||
|
||||
const FontSettings &FontSettingsPage::fontSettings() const
|
||||
{
|
||||
return d_ptr->m_value;
|
||||
|
||||
@@ -99,7 +99,8 @@ public:
|
||||
QString trCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void finished(bool accepted);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
const FontSettings &fontSettings() const;
|
||||
|
||||
|
||||
@@ -105,14 +105,12 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
|
||||
return w;
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::finished(bool accepted)
|
||||
void GeneralSettingsPage::apply()
|
||||
{
|
||||
if (!accepted)
|
||||
return;
|
||||
|
||||
TabSettings newTabSettings;
|
||||
StorageSettings newStorageSettings;
|
||||
DisplaySettings newDisplaySettings;
|
||||
|
||||
settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings);
|
||||
|
||||
if (newTabSettings != m_d->m_tabSettings) {
|
||||
|
||||
@@ -72,7 +72,8 @@ public:
|
||||
QString trCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void finished(bool accepted);
|
||||
void apply();
|
||||
void finish() { }
|
||||
|
||||
TabSettings tabSettings() const;
|
||||
StorageSettings storageSettings() const;
|
||||
|
||||
Reference in New Issue
Block a user