Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9454fe56
Commit
9454fe56
authored
Apr 12, 2010
by
Thorbjørn Lindeijer
Browse files
Create a single parent options page for the Text Editor category
Trying to clean up a little.
parent
872a75ef
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/completionsettingspage.cpp
View file @
9454fe56
...
...
@@ -31,7 +31,6 @@
#include "ui_completionsettingspage.h"
#include <coreplugin/icore.h>
#include <texteditor/texteditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QTextStream>
...
...
@@ -60,21 +59,6 @@ QString CompletionSettingsPage::displayName() const
return
tr
(
"Completion"
);
}
QString
CompletionSettingsPage
::
category
()
const
{
return
QLatin1String
(
TextEditor
::
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY
);
}
QString
CompletionSettingsPage
::
displayCategory
()
const
{
return
QCoreApplication
::
translate
(
"Text Editor"
,
TextEditor
::
Constants
::
TEXT_EDITOR_SETTINGS_TR_CATEGORY
);
}
QIcon
CompletionSettingsPage
::
categoryIcon
()
const
{
return
QIcon
(
QLatin1String
(
TextEditor
::
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY_ICON
));
}
QWidget
*
CompletionSettingsPage
::
createPage
(
QWidget
*
parent
)
{
QWidget
*
w
=
new
QWidget
(
parent
);
...
...
src/plugins/cpptools/completionsettingspage.h
View file @
9454fe56
...
...
@@ -30,7 +30,7 @@
#ifndef COMPLETIONSETTINGSPAGE_H
#define COMPLETIONSETTINGSPAGE_H
#include <
coreplugin/dialogs/i
optionspage.h>
#include <
texteditor/texteditor
optionspage.h>
#include "cppcodecompletion.h"
...
...
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
namespace
CppTools
{
namespace
Internal
{
class
CompletionSettingsPage
:
public
C
or
e
::
I
OptionsPage
class
CompletionSettingsPage
:
public
TextEdit
or
::
TextEditor
OptionsPage
{
Q_OBJECT
...
...
@@ -51,9 +51,6 @@ public:
QString
id
()
const
;
QString
displayName
()
const
;
QString
category
()
const
;
QString
displayCategory
()
const
;
QIcon
categoryIcon
()
const
;
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
();
...
...
src/plugins/texteditor/behaviorsettingspage.cpp
View file @
9454fe56
...
...
@@ -68,7 +68,7 @@ BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate
BehaviorSettingsPage
::
BehaviorSettingsPage
(
const
BehaviorSettingsPageParameters
&
p
,
QObject
*
parent
)
:
Core
::
I
OptionsPage
(
parent
),
:
TextEditor
OptionsPage
(
parent
),
m_d
(
new
BehaviorSettingsPagePrivate
(
p
))
{
}
...
...
@@ -88,21 +88,6 @@ QString BehaviorSettingsPage::displayName() const
return
m_d
->
m_parameters
.
displayName
;
}
QString
BehaviorSettingsPage
::
category
()
const
{
return
m_d
->
m_parameters
.
category
;
}
QString
BehaviorSettingsPage
::
displayCategory
()
const
{
return
m_d
->
m_parameters
.
displayCategory
;
}
QIcon
BehaviorSettingsPage
::
categoryIcon
()
const
{
return
m_d
->
m_parameters
.
categoryIcon
;
}
QWidget
*
BehaviorSettingsPage
::
createPage
(
QWidget
*
parent
)
{
QWidget
*
w
=
new
QWidget
(
parent
);
...
...
src/plugins/texteditor/behaviorsettingspage.h
View file @
9454fe56
...
...
@@ -32,9 +32,7 @@
#include "texteditor_global.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QObject>
#include "texteditoroptionspage.h"
namespace
TextEditor
{
...
...
@@ -46,13 +44,10 @@ struct BehaviorSettingsPageParameters
{
QString
id
;
QString
displayName
;
QString
category
;
QString
displayCategory
;
QIcon
categoryIcon
;
QString
settingsPrefix
;
};
class
BehaviorSettingsPage
:
public
Core
::
I
OptionsPage
class
BehaviorSettingsPage
:
public
TextEditor
OptionsPage
{
Q_OBJECT
...
...
@@ -63,20 +58,16 @@ public:
// IOptionsPage
QString
id
()
const
;
QString
displayName
()
const
;
QString
category
()
const
;
QString
displayCategory
()
const
;
QIcon
categoryIcon
()
const
;
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
();
void
finish
()
{
}
bool
matches
(
const
QString
&
s
)
const
;
const
TabSettings
&
tabSettings
()
const
;
const
StorageSettings
&
storageSettings
()
const
;
const
BehaviorSettings
&
behaviorSettings
()
const
;
virtual
bool
matches
(
const
QString
&
s
)
const
;
signals:
void
tabSettingsChanged
(
const
TextEditor
::
TabSettings
&
);
void
storageSettingsChanged
(
const
TextEditor
::
StorageSettings
&
);
...
...
src/plugins/texteditor/displaysettingspage.cpp
View file @
9454fe56
...
...
@@ -59,7 +59,7 @@ DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate
DisplaySettingsPage
::
DisplaySettingsPage
(
const
DisplaySettingsPageParameters
&
p
,
QObject
*
parent
)
:
Core
::
I
OptionsPage
(
parent
),
:
TextEditor
OptionsPage
(
parent
),
m_d
(
new
DisplaySettingsPagePrivate
(
p
))
{
}
...
...
@@ -79,21 +79,6 @@ QString DisplaySettingsPage::displayName() const
return
m_d
->
m_parameters
.
displayName
;
}
QString
DisplaySettingsPage
::
category
()
const
{
return
m_d
->
m_parameters
.
category
;
}
QString
DisplaySettingsPage
::
displayCategory
()
const
{
return
m_d
->
m_parameters
.
displayCategory
;
}
QIcon
DisplaySettingsPage
::
categoryIcon
()
const
{
return
m_d
->
m_parameters
.
categoryIcon
;
}
QWidget
*
DisplaySettingsPage
::
createPage
(
QWidget
*
parent
)
{
QWidget
*
w
=
new
QWidget
(
parent
);
...
...
src/plugins/texteditor/displaysettingspage.h
View file @
9454fe56
...
...
@@ -32,9 +32,7 @@
#include "texteditor_global.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QObject>
#include "texteditoroptionspage.h"
namespace
TextEditor
{
...
...
@@ -44,13 +42,10 @@ struct DisplaySettingsPageParameters
{
QString
id
;
QString
displayName
;
QString
category
;
QString
displayCategory
;
QIcon
categoryIcon
;
QString
settingsPrefix
;
};
class
DisplaySettingsPage
:
public
Core
::
I
OptionsPage
class
DisplaySettingsPage
:
public
TextEditor
OptionsPage
{
Q_OBJECT
...
...
@@ -61,9 +56,6 @@ public:
// IOptionsPage
QString
id
()
const
;
QString
displayName
()
const
;
QString
category
()
const
;
QString
displayCategory
()
const
;
QIcon
categoryIcon
()
const
;
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
();
...
...
src/plugins/texteditor/fontsettingspage.cpp
View file @
9454fe56
...
...
@@ -117,17 +117,14 @@ class FontSettingsPagePrivate
public:
FontSettingsPagePrivate
(
const
TextEditor
::
FormatDescriptions
&
fd
,
const
QString
&
id
,
const
QString
&
name
,
const
QString
&
category
,
const
QString
&
trCategory
);
const
QString
&
displayName
,
const
QString
&
category
);
~
FontSettingsPagePrivate
();
public:
const
QString
m_id
;
const
QString
m_displayName
;
const
QString
m_settingsGroup
;
const
QString
m_category
;
const
QString
m_displayCategory
;
TextEditor
::
FormatDescriptions
m_descriptions
;
FontSettings
m_value
;
...
...
@@ -178,13 +175,10 @@ static QString createColorSchemeFileName(const QString &pattern)
FontSettingsPagePrivate
::
FontSettingsPagePrivate
(
const
TextEditor
::
FormatDescriptions
&
fd
,
const
QString
&
id
,
const
QString
&
displayName
,
const
QString
&
category
,
const
QString
&
trCategory
)
:
const
QString
&
category
)
:
m_id
(
id
),
m_displayName
(
displayName
),
m_settingsGroup
(
Utils
::
settingsKey
(
category
)),
m_category
(
category
),
m_displayCategory
(
trCategory
),
m_descriptions
(
fd
),
m_schemeListModel
(
new
SchemeListModel
),
m_refreshingSchemeList
(
false
)
...
...
@@ -313,11 +307,9 @@ QColor FormatDescription::background() const
// ------------ FontSettingsPage
FontSettingsPage
::
FontSettingsPage
(
const
FormatDescriptions
&
fd
,
const
QString
&
id
,
const
QString
&
category
,
const
QString
&
trCategory
,
QObject
*
parent
)
:
Core
::
I
OptionsPage
(
parent
),
d_ptr
(
new
FontSettingsPagePrivate
(
fd
,
id
,
tr
(
"Font && Colors"
),
category
,
trCategory
))
TextEditor
OptionsPage
(
parent
),
d_ptr
(
new
FontSettingsPagePrivate
(
fd
,
id
,
tr
(
"Font && Colors"
),
category
()
))
{
}
...
...
@@ -336,21 +328,6 @@ QString FontSettingsPage::displayName() const
return
d_ptr
->
m_displayName
;
}
QString
FontSettingsPage
::
category
()
const
{
return
d_ptr
->
m_category
;
}
QString
FontSettingsPage
::
displayCategory
()
const
{
return
d_ptr
->
m_displayCategory
;
}
QIcon
FontSettingsPage
::
categoryIcon
()
const
{
return
QIcon
(
QLatin1String
(
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY_ICON
));
}
QWidget
*
FontSettingsPage
::
createPage
(
QWidget
*
parent
)
{
QWidget
*
w
=
new
QWidget
(
parent
);
...
...
src/plugins/texteditor/fontsettingspage.h
View file @
9454fe56
...
...
@@ -34,7 +34,7 @@
#include "fontsettings.h"
#include
<coreplugin/dialogs/i
optionspage.h
>
#include
"texteditor
optionspage.h
"
#include <QtCore/QString>
...
...
@@ -77,24 +77,19 @@ private:
typedef
QList
<
FormatDescription
>
FormatDescriptions
;
class
TEXTEDITOR_EXPORT
FontSettingsPage
:
public
Core
::
I
OptionsPage
class
TEXTEDITOR_EXPORT
FontSettingsPage
:
public
TextEditor
OptionsPage
{
Q_OBJECT
public:
FontSettingsPage
(
const
FormatDescriptions
&
fd
,
const
QString
&
id
,
const
QString
&
category
,
const
QString
&
trCategory
,
QObject
*
parent
=
0
);
~
FontSettingsPage
();
QString
id
()
const
;
QString
displayName
()
const
;
QString
category
()
const
;
QString
displayCategory
()
const
;
QIcon
categoryIcon
()
const
;
QWidget
*
createPage
(
QWidget
*
parent
);
void
apply
();
...
...
src/plugins/texteditor/texteditor.pro
View file @
9454fe56
...
...
@@ -32,7 +32,8 @@ SOURCES += texteditorplugin.cpp \
colorscheme
.
cpp
\
colorschemeedit
.
cpp
\
itexteditor
.
cpp
\
texteditoroverlay
.
cpp
texteditoroverlay
.
cpp
\
texteditoroptionspage
.
cpp
HEADERS
+=
texteditorplugin
.
h
\
textfilewizard
.
h
\
...
...
@@ -67,7 +68,8 @@ HEADERS += texteditorplugin.h \
findincurrentfile
.
h
\
colorscheme
.
h
\
colorschemeedit
.
h
\
texteditoroverlay
.
h
texteditoroverlay
.
h
\
texteditoroptionspage
.
h
FORMS
+=
behaviorsettingspage
.
ui
\
...
...
src/plugins/texteditor/texteditoroptionspage.cpp
0 → 100644
View file @
9454fe56
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "texteditoroptionspage.h"
#include "texteditorconstants.h"
#include <QCoreApplication>
using
namespace
TextEditor
;
TextEditorOptionsPage
::
TextEditorOptionsPage
(
QObject
*
parent
)
:
Core
::
IOptionsPage
(
parent
)
{
}
QString
TextEditorOptionsPage
::
category
()
const
{
return
QLatin1String
(
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY
);
}
QString
TextEditorOptionsPage
::
displayCategory
()
const
{
return
QCoreApplication
::
translate
(
"TextEditor"
,
Constants
::
TEXT_EDITOR_SETTINGS_TR_CATEGORY
);
}
QIcon
TextEditorOptionsPage
::
categoryIcon
()
const
{
return
QIcon
(
QLatin1String
(
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY_ICON
));
}
src/plugins/texteditor/texteditoroptionspage.h
0 → 100644
View file @
9454fe56
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef TEXTEDITOROPTIONSPAGE_H
#define TEXTEDITOROPTIONSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include "texteditor_global.h"
namespace
TextEditor
{
/**
* An abstract options page in the Text Editor category.
*/
class
TEXTEDITOR_EXPORT
TextEditorOptionsPage
:
public
Core
::
IOptionsPage
{
Q_OBJECT
public:
explicit
TextEditorOptionsPage
(
QObject
*
parent
=
0
);
// IOptionsPage
QString
category
()
const
;
QString
displayCategory
()
const
;
QIcon
categoryIcon
()
const
;
};
}
// namespace TextEditor
#endif // TEXTEDITOROPTIONSPAGE_H
src/plugins/texteditor/texteditorsettings.cpp
View file @
9454fe56
...
...
@@ -102,22 +102,15 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_DIFF_FILE
),
tr
(
"Diff File"
),
Qt
::
darkBlue
));
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_DIFF_LOCATION
),
tr
(
"Diff Location"
),
Qt
::
blue
));
const
QString
category
=
QLatin1String
(
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY
);
const
QString
displayCategory
=
QCoreApplication
::
translate
(
"TextEditor"
,
Constants
::
TEXT_EDITOR_SETTINGS_TR_CATEGORY
);
const
QIcon
categoryIcon
=
QIcon
(
QLatin1String
(
Constants
::
TEXT_EDITOR_SETTINGS_CATEGORY_ICON
));
m_fontSettingsPage
=
new
FontSettingsPage
(
formatDescriptions
,
QLatin1String
(
"A.FontSettings"
),
category
,
displayCategory
,
this
);
this
);
pm
->
addObject
(
m_fontSettingsPage
);
// Add the GUI used to configure the tab, storage and interaction settings
TextEditor
::
BehaviorSettingsPageParameters
behaviorSettingsPageParameters
;
behaviorSettingsPageParameters
.
id
=
QLatin1String
(
"B.BehaviourSettings"
);
behaviorSettingsPageParameters
.
displayName
=
tr
(
"Behavior"
);
behaviorSettingsPageParameters
.
category
=
category
;
behaviorSettingsPageParameters
.
displayCategory
=
displayCategory
;
behaviorSettingsPageParameters
.
categoryIcon
=
categoryIcon
;
behaviorSettingsPageParameters
.
settingsPrefix
=
QLatin1String
(
"text"
);
m_behaviorSettingsPage
=
new
BehaviorSettingsPage
(
behaviorSettingsPageParameters
,
this
);
pm
->
addObject
(
m_behaviorSettingsPage
);
...
...
@@ -125,9 +118,6 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
TextEditor
::
DisplaySettingsPageParameters
displaySettingsPageParameters
;
displaySettingsPageParameters
.
id
=
QLatin1String
(
"D.DisplaySettings"
),
displaySettingsPageParameters
.
displayName
=
tr
(
"Display"
);
displaySettingsPageParameters
.
category
=
category
;
displaySettingsPageParameters
.
displayCategory
=
displayCategory
;
displaySettingsPageParameters
.
categoryIcon
=
categoryIcon
;
displaySettingsPageParameters
.
settingsPrefix
=
QLatin1String
(
"text"
);
m_displaySettingsPage
=
new
DisplaySettingsPage
(
displaySettingsPageParameters
,
this
);
pm
->
addObject
(
m_displaySettingsPage
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment