Commit cc3a57a9 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

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

parents f8453428 692c0fbb
This diff is collapsed.
......@@ -243,8 +243,13 @@ void SavedAction::readSettings(QSettings *settings)
if (m_settingsGroup.isEmpty() || m_settingsKey.isEmpty())
return;
settings->beginGroup(m_settingsGroup);
setValue(settings->value(m_settingsKey, m_defaultValue), false);
//qDebug() << "READING: " << m_settingsKey << " -> " << m_value;
QVariant var = settings->value(m_settingsKey, m_defaultValue);
// work around old ini files containing @Invalid() entries
if (isCheckable() && !var.isValid())
var = false;
setValue(var);
//qDebug() << "READING: " << var.isValid() << m_settingsKey << " -> " << m_value
// << " (default: " << m_defaultValue << ")" << var;
settings->endGroup();
}
......
......@@ -64,7 +64,10 @@ DebuggerSettings::~DebuggerSettings()
void DebuggerSettings::insertItem(int code, SavedAction *item)
{
QTC_ASSERT(!m_items.contains(code), qDebug() << code << item->toString(); return);
QTC_ASSERT(!m_items.contains(code),
qDebug() << code << item->toString(); return);
QTC_ASSERT(item->settingsKey().isEmpty() || item->defaultValue().isValid(),
qDebug() << "NO DEFAULT VALUE FOR " << item->settingsKey());
m_items[code] = item;
}
......@@ -90,9 +93,13 @@ QString DebuggerSettings::dump() const
{
QString out;
QTextStream ts(&out);
ts << "Debugger settings: ";
foreach (SavedAction *item, m_items)
ts << '\n' << item->value().toString();
ts << "Debugger settings: ";
foreach (SavedAction *item, m_items) {
QString key = item->settingsKey();
if (!key.isEmpty())
ts << '\n' << key << ": " << item->value().toString()
<< " (default: " << item->defaultValue().toString() << ")";
}
return out;
}
......@@ -169,18 +176,22 @@ DebuggerSettings *DebuggerSettings::instance()
instance->insertItem(UseDebuggingHelpers, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation"));
instance->insertItem(UseCustomDebuggingHelperLocation, item);
item->setSettingsKey(debugModeGroup, QLatin1String("UseCustomDebuggingHelperLocation"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseCustomDebuggingHelperLocation, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("CustomDebuggingHelperLocation"));
item->setCheckable(true);
item->setDefaultValue(QString());
instance->insertItem(CustomDebuggingHelperLocation, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("DebugDebuggingHelpers"));
item->setText(tr("Debug debugging helper"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(DebugDebuggingHelpers, item);
......@@ -208,6 +219,7 @@ DebuggerSettings *DebuggerSettings::instance()
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatHexadecimal"));
item->setChecked(true);
item->setDefaultValue(false);
item->setData(FormatHexadecimal);
instance->insertItem(FormatHexadecimal, item);
instance->m_registerFormatGroup->addAction(item);
......@@ -216,6 +228,7 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Decimal"));
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatDecimal"));
item->setDefaultValue(false);
item->setData(FormatDecimal);
instance->insertItem(FormatDecimal, item);
instance->m_registerFormatGroup->addAction(item);
......@@ -224,6 +237,7 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Octal"));
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatOctal"));
item->setDefaultValue(false);
item->setData(FormatOctal);
instance->insertItem(FormatOctal, item);
instance->m_registerFormatGroup->addAction(item);
......@@ -232,6 +246,7 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Binary"));
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatBinary"));
item->setDefaultValue(false);
item->setData(FormatBinary);
instance->insertItem(FormatBinary, item);
instance->m_registerFormatGroup->addAction(item);
......@@ -240,6 +255,7 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Raw"));
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatRaw"));
item->setDefaultValue(false);
item->setData(FormatRaw);
instance->insertItem(FormatRaw, item);
instance->m_registerFormatGroup->addAction(item);
......@@ -248,6 +264,7 @@ DebuggerSettings *DebuggerSettings::instance()
item->setText(tr("Natural"));
item->setCheckable(true);
item->setSettingsKey(debugModeGroup, QLatin1String("FormatNatural"));
item->setDefaultValue(true);
item->setData(FormatNatural);
instance->insertItem(FormatNatural, item);
instance->m_registerFormatGroup->addAction(item);
......@@ -262,40 +279,47 @@ DebuggerSettings *DebuggerSettings::instance()
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("Environment"));
item->setDefaultValue(QString());
instance->insertItem(GdbEnvironment, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("ScriptFile"));
item->setDefaultValue(QString());
instance->insertItem(GdbScriptFile, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("AutoQuit"));
item->setText(tr("Automatically quit debugger"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(AutoQuit, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTips"));
item->setText(tr("Use tooltips when debugging"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(UseToolTips, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("ListSourceFiles"));
item->setText(tr("List source files"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(ListSourceFiles, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("SkipKnownFrames"));
item->setText(tr("Skip known frames"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(SkipKnownFrames, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("EnableReverseDebugging"));
item->setText(tr("Enable reverse debugging"));
item->setCheckable(true);
item->setDefaultValue(false);
instance->insertItem(EnableReverseDebugging, item);
item = new SavedAction(instance);
......@@ -305,14 +329,17 @@ DebuggerSettings *DebuggerSettings::instance()
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("SelectedPluginBreakpoints"));
item->setDefaultValue(false);
instance->insertItem(SelectedPluginBreakpoints, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("NoPluginBreakpoints"));
item->setDefaultValue(false);
instance->insertItem(NoPluginBreakpoints, item);
item = new SavedAction(instance);
item->setSettingsKey(debugModeGroup, QLatin1String("SelectedPluginBreakpointsPattern"));
item->setDefaultValue(QString(".*"));
instance->insertItem(SelectedPluginBreakpointsPattern, item);
item = new SavedAction(instance);
......
......@@ -239,18 +239,20 @@ void CentralWidget::setLastShownPages()
QString()).toString();
const QStringList lastShownPageList = value.split(QLatin1Char('|'),
QString::SkipEmptyParts);
const int pageCount = lastShownPageList.count();
if (pageCount <= 0) {
QUrl url = helpEngine->findFile(QString::fromLatin1("qthelp://com."
"trolltech.qt.440/qdoc/index.html"));
if (!url.isValid()) {
url.setUrl(QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").
arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
url.setUrl(QString::fromLatin1("qthelp://com.nokia.qtcreator.%1%2/"
"doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
QString homePage = helpEngine->customValue(QLatin1String("DefaultHomePage"),
QLatin1String("about:blank")).toString();
int option = helpEngine->customValue(QLatin1String("StartOption"), 2).toInt();
if (option == 0 || option == 1 || pageCount <= 0) {
if (option == 0) {
homePage = helpEngine->customValue(QLatin1String("HomePage"),
homePage).toString();
} else if (option == 1) {
homePage = QLatin1String("about:blank");
}
setSource(url);
setSource(homePage);
return;
}
......
......@@ -29,7 +29,8 @@
#include "generalsettingspage.h"
#include <QtHelp/QHelpEngine>
#include "centralwidget.h"
#include "helpviewer.h"
#if defined(QT_NO_WEBKIT)
#include <QtGui/QApplication>
......@@ -37,11 +38,17 @@
#include <QtWebKit/QWebSettings>
#endif
#include <QtHelp/QHelpEngine>
#include <coreplugin/coreconstants.h>
using namespace Help::Internal;
GeneralSettingsPage::GeneralSettingsPage(QHelpEngine *helpEngine)
GeneralSettingsPage::GeneralSettingsPage(QHelpEngine *helpEngine,
CentralWidget *centralWidget)
: m_currentPage(0)
, m_helpEngine(helpEngine)
, m_centralWidget(centralWidget)
{
#if !defined(QT_NO_WEBKIT)
QWebSettings* webSettings = QWebSettings::globalSettings();
......@@ -87,6 +94,26 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
updateFontStyle();
updateFontFamily();
QString homePage = m_helpEngine->customValue(QLatin1String("HomePage"),
QString()).toString();
if (homePage.isEmpty()) {
homePage = m_helpEngine->customValue(QLatin1String("DefaultHomePage"),
QLatin1String("about:blank")).toString();
}
m_ui.homePageLineEdit->setText(homePage);
int index = m_helpEngine->customValue(QLatin1String("StartOption"), 2).toInt();
m_ui.helpStartComboBox->setCurrentIndex(index);
connect(m_ui.currentPageButton, SIGNAL(clicked()), this, SLOT(setCurrentPage()));
connect(m_ui.blankPageButton, SIGNAL(clicked()), this, SLOT(setBlankPage()));
connect(m_ui.defaultPageButton, SIGNAL(clicked()), this, SLOT(setDefaultPage()));
HelpViewer *viewer = m_centralWidget->currentHelpViewer();
if (viewer == 0)
m_ui.currentPageButton->setEnabled(false);
return m_currentPage;
}
......@@ -121,6 +148,14 @@ void GeneralSettingsPage::apply()
#else
emit fontChanged();
#endif
QString homePage = m_ui.homePageLineEdit->text();
if (homePage.isEmpty())
homePage = QLatin1String("about:blank");
m_helpEngine->setCustomValue(QLatin1String("HomePage"), homePage);
int startOption = m_ui.helpStartComboBox->currentIndex();
m_helpEngine->setCustomValue(QLatin1String("StartOption"), startOption);
}
void GeneralSettingsPage::finish()
......@@ -128,6 +163,26 @@ void GeneralSettingsPage::finish()
// Hmm, what to do here?
}
void GeneralSettingsPage::setCurrentPage()
{
HelpViewer *viewer = m_centralWidget->currentHelpViewer();
if (viewer)
m_ui.homePageLineEdit->setText(viewer->source().toString());
}
void GeneralSettingsPage::setBlankPage()
{
m_ui.homePageLineEdit->setText(QLatin1String("about:blank"));
}
void GeneralSettingsPage::setDefaultPage()
{
const QString &homePage =
m_helpEngine->customValue(QLatin1String("DefaultHomePage"),
QString()).toString();
m_ui.homePageLineEdit->setText(homePage);
}
void GeneralSettingsPage::updateFontSize()
{
const QString &family = font.family();
......
......@@ -43,12 +43,14 @@ QT_FORWARD_DECLARE_CLASS(QHelpEngine)
namespace Help {
namespace Internal {
class CentralWidget;
class GeneralSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GeneralSettingsPage(QHelpEngine *helpEngine);
GeneralSettingsPage(QHelpEngine *helpEngine, CentralWidget *centralWidget);
QString id() const;
virtual QString trName() const;
......@@ -62,6 +64,11 @@ public:
signals:
void fontChanged();
private slots:
void setCurrentPage();
void setBlankPage();
void setDefaultPage();
private:
void updateFontSize();
void updateFontStyle();
......@@ -71,6 +78,7 @@ private:
private:
QWidget *m_currentPage;
QHelpEngine *m_helpEngine;
CentralWidget *m_centralWidget;
QFont font;
QFontDatabase fontDatabase;
......
......@@ -133,7 +133,7 @@
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="title">
<string>Startup</string>
......@@ -155,7 +155,7 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<widget class="QComboBox" name="helpStartComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -209,7 +209,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
......@@ -224,22 +224,25 @@
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="currentPageButton">
<property name="text">
<string>Current Page</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="restoreDefaultHomePageButton">
<property name="text">
<string>Restore to default</string>
</property>
</widget>
</item>
</layout>
<widget class="QPushButton" name="currentPageButton">
<property name="text">
<string>Use &amp;Current Page</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="blankPageButton">
<property name="text">
<string>Use &amp;Blank Page</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="defaultPageButton">
<property name="text">
<string>Restore to Default</string>
</property>
</widget>
</item>
</layout>
</item>
......
......@@ -188,10 +188,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
connect(m_docSettingsPage, SIGNAL(dialogAccepted()), this,
SLOT(checkForHelpChanges()));
GeneralSettingsPage *generalSettings = new GeneralSettingsPage(m_helpEngine);
addAutoReleasedObject(generalSettings);
connect(generalSettings, SIGNAL(fontChanged()), this, SLOT(fontChanged()));
m_contentWidget = new ContentWindow(m_helpEngine);
m_contentWidget->setWindowTitle(tr("Contents"));
m_indexWidget = new IndexWindow(m_helpEngine);
......@@ -421,6 +417,11 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
}
GeneralSettingsPage *generalSettings =
new GeneralSettingsPage(m_helpEngine, m_centralWidget);
addAutoReleasedObject(generalSettings);
connect(generalSettings, SIGNAL(fontChanged()), this, SLOT(fontChanged()));
return true;
}
......@@ -628,6 +629,14 @@ void HelpPlugin::extensionsInitialized()
webSettings->setFontFamily(QWebSettings::StandardFont, font.family());
webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
#endif
QUrl url = m_helpEngine->findFile(QString::fromLatin1("qthelp://com."
"trolltech.qt.440/qdoc/index.html"));
if (!url.isValid()) {
url.setUrl(QString::fromLatin1("qthelp://com.nokia.qtcreator.%1%2/doc/"
"index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
}
m_helpEngine->setCustomValue(QLatin1String("DefaultHomePage"), url.toString());
}
void HelpPlugin::shutdown()
......
......@@ -64,6 +64,9 @@
</item>
<item>
<widget class="QToolButton" name="buildStepRemoveToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>-</string>
</property>
......@@ -74,6 +77,9 @@
</item>
<item>
<widget class="QToolButton" name="buildStepUpToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>^</string>
</property>
......@@ -81,6 +87,9 @@
</item>
<item>
<widget class="QToolButton" name="buildStepDownToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>v</string>
</property>
......
......@@ -178,7 +178,11 @@ void ProjectTreeWidget::foldersAboutToBeRemoved(FolderNode *, const QList<Folder
while(n) {
if (FolderNode *fn = qobject_cast<FolderNode *>(n)) {
if (list.contains(fn)) {
m_explorer->setCurrentNode(n->projectNode());
ProjectNode *pn = n->projectNode();
// Make sure the node we are switching too isn't going to be removed also
while (list.contains(pn))
pn = pn->parentFolderNode()->projectNode();
m_explorer->setCurrentNode(pn);
break;
}
}
......
......@@ -122,7 +122,6 @@ void ProjectLoadWizard::addBuildConfiguration(QString name, QtVersion *qtversion
m_project->setQtVersion(name, 0);
else
m_project->setQtVersion(name, qtversion->uniqueId());
}
void ProjectLoadWizard::done(int result)
......
......@@ -400,12 +400,14 @@ ProjectExplorer::ToolChain *Qt4Project::toolChain(const QString &buildConfigurat
QString Qt4Project::makeCommand(const QString &buildConfiguration) const
{
return toolChain(buildConfiguration)->makeCommand();
ToolChain *tc = toolChain(buildConfiguration);
return tc ? tc->makeCommand() : "make";
}
QString Qt4Project::defaultMakeTarget(const QString &buildConfiguration) const
{
return toolChain(buildConfiguration)->defaultMakeTarget();
ToolChain *tc = toolChain(buildConfiguration);
return tc ? toolChain(buildConfiguration)->defaultMakeTarget() : "";
}
void Qt4Project::updateCodeModel()
......@@ -450,9 +452,12 @@ void Qt4Project::updateCodeModel()
predefinedIncludePaths.append(newQtIncludePath);
QDir dir(newQtIncludePath);
foreach (QFileInfo info, dir.entryInfoList(QDir::Dirs)) {
if (! info.fileName().startsWith(QLatin1String("Qt")))
continue;
predefinedIncludePaths.append(info.absoluteFilePath());
const QString path = info.fileName();
if (path == QLatin1String("Qt"))
continue; // skip $QT_INSTALL_HEADERS/Qt. There's no need to include it.
else if (path.startsWith(QLatin1String("Qt")) || path == QLatin1String("phonon"))
predefinedIncludePaths.append(info.absoluteFilePath());
}
FindQt4ProFiles findQt4ProFiles;
......@@ -740,7 +745,9 @@ ProjectExplorer::Environment Qt4Project::baseEnvironment(const QString &buildCon
{
Environment env = useSystemEnvironment(buildConfiguration) ? Environment::systemEnvironment() : Environment();
qtVersion(buildConfiguration)->addToEnvironment(env);
toolChain(buildConfiguration)->addToEnvironment(env);
ToolChain *tc = toolChain(buildConfiguration);
if (tc)
tc->addToEnvironment(env);
return env;
}
......
......@@ -295,8 +295,15 @@ int HelpViewer::zoom() const
void HelpViewer::home()
{
if (homeUrl.isValid())
setSource(homeUrl);
QString homepage = helpEngine->customValue(QLatin1String("HomePage"),
QLatin1String("")).toString();
if (homepage.isEmpty()) {
homepage = helpEngine->customValue(QLatin1String("DefaultHomePage"),
QLatin1String("about:blank")).toString();
}
setSource(homepage);
}
void HelpViewer::wheelEvent(QWheelEvent *e)
......@@ -552,8 +559,15 @@ void HelpViewer::keyPressEvent(QKeyEvent *e)
void HelpViewer::home()
{
if (homeUrl.isValid())
setSource(homeUrl);
QString homepage = helpEngine->customValue(QLatin1String("HomePage"),
QLatin1String("")).toString();
if (homepage.isEmpty()) {
homepage = helpEngine->customValue(QLatin1String("DefaultHomePage"),
QLatin1String("about:blank")).toString();
}
setSource(homepage);
}
void HelpViewer::wheelEvent(QWheelEvent *e)
......
Supports Markdown
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