2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "fontsettingspage.h"
|
2009-06-18 17:35:46 +02:00
|
|
|
|
2009-07-17 17:24:32 +02:00
|
|
|
#include "colorschemeedit.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "fontsettings.h"
|
|
|
|
|
#include "texteditorconstants.h"
|
|
|
|
|
#include "ui_fontsettingspage.h"
|
|
|
|
|
|
2009-01-20 15:31:33 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2009-11-25 12:34:56 +01:00
|
|
|
#include <utils/stringutils.h>
|
2009-07-22 14:16:21 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QFontDatabase>
|
|
|
|
|
#include <QInputDialog>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QPalette>
|
|
|
|
|
#include <QTextCharFormat>
|
|
|
|
|
#include <QTextEdit>
|
|
|
|
|
#include <QToolButton>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace TextEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2009-07-16 17:16:55 +02:00
|
|
|
struct ColorSchemeEntry
|
|
|
|
|
{
|
|
|
|
|
ColorSchemeEntry(const QString &fileName,
|
|
|
|
|
bool readOnly):
|
|
|
|
|
fileName(fileName),
|
|
|
|
|
name(ColorScheme::readNameOfScheme(fileName)),
|
|
|
|
|
readOnly(readOnly)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
QString fileName;
|
|
|
|
|
QString name;
|
2009-11-27 16:12:12 +01:00
|
|
|
QString id;
|
2009-07-16 17:16:55 +02:00
|
|
|
bool readOnly;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SchemeListModel : public QAbstractListModel
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SchemeListModel(QObject *parent = 0):
|
|
|
|
|
QAbstractListModel(parent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent) const
|
|
|
|
|
{ return parent.isValid() ? 0 : m_colorSchemes.size(); }
|
|
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const
|
|
|
|
|
{
|
|
|
|
|
if (role == Qt::DisplayRole)
|
|
|
|
|
return m_colorSchemes.at(index.row()).name;
|
|
|
|
|
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void removeColorScheme(int index)
|
|
|
|
|
{
|
|
|
|
|
beginRemoveRows(QModelIndex(), index, index);
|
|
|
|
|
m_colorSchemes.removeAt(index);
|
|
|
|
|
endRemoveRows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setColorSchemes(const QList<ColorSchemeEntry> &colorSchemes)
|
|
|
|
|
{
|
|
|
|
|
m_colorSchemes = colorSchemes;
|
|
|
|
|
reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ColorSchemeEntry &colorSchemeAt(int index) const
|
|
|
|
|
{ return m_colorSchemes.at(index); }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QList<ColorSchemeEntry> m_colorSchemes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
class FontSettingsPagePrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FontSettingsPagePrivate(const TextEditor::FormatDescriptions &fd,
|
2009-11-27 16:12:12 +01:00
|
|
|
const QString &id,
|
2010-04-12 15:53:17 +02:00
|
|
|
const QString &displayName,
|
|
|
|
|
const QString &category);
|
2009-07-16 17:16:55 +02:00
|
|
|
~FontSettingsPagePrivate();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-01-20 15:31:33 +01:00
|
|
|
public:
|
2009-11-27 16:12:12 +01:00
|
|
|
const QString m_id;
|
2010-01-07 18:17:24 +01:00
|
|
|
const QString m_displayName;
|
2008-12-02 12:01:29 +01:00
|
|
|
const QString m_settingsGroup;
|
|
|
|
|
|
|
|
|
|
TextEditor::FormatDescriptions m_descriptions;
|
|
|
|
|
FontSettings m_value;
|
|
|
|
|
FontSettings m_lastValue;
|
2010-12-02 18:28:16 +01:00
|
|
|
Ui::FontSettingsPage *m_ui;
|
2009-07-16 17:16:55 +02:00
|
|
|
SchemeListModel *m_schemeListModel;
|
2009-07-17 17:24:32 +02:00
|
|
|
bool m_refreshingSchemeList;
|
2009-11-24 15:05:02 +01:00
|
|
|
QString m_searchKeywords;
|
2009-07-13 14:08:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace TextEditor
|
|
|
|
|
|
|
|
|
|
using namespace TextEditor;
|
|
|
|
|
using namespace TextEditor::Internal;
|
|
|
|
|
|
2009-07-15 12:27:02 +02:00
|
|
|
static QString customStylesPath()
|
|
|
|
|
{
|
2012-01-24 15:36:40 +01:00
|
|
|
QString path = Core::ICore::userResourcePath();
|
2010-08-25 18:16:04 +02:00
|
|
|
path.append(QLatin1String("/styles/"));
|
2009-07-15 12:27:02 +02:00
|
|
|
return path;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-15 15:39:35 +02:00
|
|
|
static QString createColorSchemeFileName(const QString &pattern)
|
|
|
|
|
{
|
|
|
|
|
const QString stylesPath = customStylesPath();
|
|
|
|
|
QString baseFileName = stylesPath;
|
|
|
|
|
baseFileName += pattern;
|
|
|
|
|
|
|
|
|
|
// Find an available file name
|
|
|
|
|
int i = 1;
|
|
|
|
|
QString fileName;
|
|
|
|
|
do {
|
|
|
|
|
fileName = baseFileName.arg((i == 1) ? QString() : QString::number(i));
|
|
|
|
|
++i;
|
|
|
|
|
} while (QFile::exists(fileName));
|
|
|
|
|
|
|
|
|
|
// Create the base directory when it doesn't exist
|
|
|
|
|
if (!QFile::exists(stylesPath) && !QDir().mkpath(stylesPath)) {
|
|
|
|
|
qWarning() << "Failed to create color scheme directory:" << stylesPath;
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fileName;
|
|
|
|
|
}
|
2009-07-13 14:08:14 +02:00
|
|
|
|
|
|
|
|
// ------- FontSettingsPagePrivate
|
2008-12-02 12:01:29 +01:00
|
|
|
FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescriptions &fd,
|
2009-11-27 16:12:12 +01:00
|
|
|
const QString &id,
|
2010-01-07 18:17:24 +01:00
|
|
|
const QString &displayName,
|
2010-04-12 15:53:17 +02:00
|
|
|
const QString &category) :
|
2009-11-27 16:12:12 +01:00
|
|
|
m_id(id),
|
2010-01-07 18:17:24 +01:00
|
|
|
m_displayName(displayName),
|
2009-10-05 11:06:05 +02:00
|
|
|
m_settingsGroup(Utils::settingsKey(category)),
|
2009-07-16 17:16:55 +02:00
|
|
|
m_descriptions(fd),
|
2010-12-02 18:28:16 +01:00
|
|
|
m_ui(0),
|
2009-07-17 17:24:32 +02:00
|
|
|
m_schemeListModel(new SchemeListModel),
|
|
|
|
|
m_refreshingSchemeList(false)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
bool settingsFound = false;
|
2012-01-24 15:36:40 +01:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2009-07-15 12:27:02 +02:00
|
|
|
if (settings)
|
2009-01-20 15:31:33 +01:00
|
|
|
settingsFound = m_value.fromSettings(m_settingsGroup, m_descriptions, settings);
|
2009-07-15 12:27:02 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
if (!settingsFound) { // Apply defaults
|
|
|
|
|
foreach (const FormatDescription &f, m_descriptions) {
|
2012-04-26 14:17:42 +02:00
|
|
|
Format &format = m_value.formatFor(f.id());
|
|
|
|
|
format.setForeground(f.foreground());
|
|
|
|
|
format.setBackground(f.background());
|
|
|
|
|
format.setBold(f.format().bold());
|
|
|
|
|
format.setItalic(f.format().italic());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2009-07-15 12:27:02 +02:00
|
|
|
} else if (m_value.colorSchemeFileName().isEmpty()) {
|
|
|
|
|
// No color scheme was loaded, but one might be imported from the ini file
|
|
|
|
|
ColorScheme defaultScheme;
|
|
|
|
|
foreach (const FormatDescription &f, m_descriptions) {
|
2012-04-26 14:17:42 +02:00
|
|
|
Format &format = defaultScheme.formatFor(f.id());
|
|
|
|
|
format.setForeground(f.foreground());
|
|
|
|
|
format.setBackground(f.background());
|
|
|
|
|
format.setBold(f.format().bold());
|
|
|
|
|
format.setItalic(f.format().italic());
|
2009-07-15 12:27:02 +02:00
|
|
|
}
|
|
|
|
|
if (m_value.colorScheme() != defaultScheme) {
|
|
|
|
|
// Save it as a color scheme file
|
2009-07-15 15:39:35 +02:00
|
|
|
QString schemeFileName = createColorSchemeFileName(QLatin1String("customized%1.xml"));
|
|
|
|
|
if (!schemeFileName.isEmpty()) {
|
2009-07-15 12:27:02 +02:00
|
|
|
if (m_value.saveColorScheme(schemeFileName) && settings)
|
2010-04-12 15:47:34 +02:00
|
|
|
m_value.toSettings(m_settingsGroup, settings);
|
2009-07-15 12:27:02 +02:00
|
|
|
}
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_lastValue = m_value;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-16 17:16:55 +02:00
|
|
|
FontSettingsPagePrivate::~FontSettingsPagePrivate()
|
|
|
|
|
{
|
|
|
|
|
delete m_schemeListModel;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// ------- FormatDescription
|
2012-08-27 10:55:13 +02:00
|
|
|
FormatDescription::FormatDescription(TextStyle id, const QString &displayName, const QString &tooltipText, const QColor &foreground) :
|
2010-01-07 18:17:24 +01:00
|
|
|
m_id(id),
|
2012-08-27 10:55:13 +02:00
|
|
|
m_displayName(displayName),
|
|
|
|
|
m_tooltipText(tooltipText)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2012-08-27 10:55:13 +02:00
|
|
|
m_format.setForeground(foreground);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2012-08-27 10:55:13 +02:00
|
|
|
FormatDescription::FormatDescription(TextStyle id, const QString &displayName, const QString &tooltipText, const Format &format) :
|
2011-08-16 09:47:54 +02:00
|
|
|
m_id(id),
|
|
|
|
|
m_displayName(displayName),
|
2012-08-27 10:55:13 +02:00
|
|
|
m_format(format),
|
|
|
|
|
m_tooltipText(tooltipText)
|
2011-08-16 09:47:54 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
QColor FormatDescription::foreground() const
|
|
|
|
|
{
|
2012-04-26 14:17:42 +02:00
|
|
|
if (m_id == C_LINE_NUMBER) {
|
2009-06-15 15:35:06 +02:00
|
|
|
const QColor bg = QApplication::palette().background().color();
|
|
|
|
|
if (bg.value() < 128) {
|
|
|
|
|
return QApplication::palette().foreground().color();
|
|
|
|
|
} else {
|
|
|
|
|
return QApplication::palette().dark().color();
|
|
|
|
|
}
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_CURRENT_LINE_NUMBER) {
|
2009-06-15 15:35:06 +02:00
|
|
|
const QColor bg = QApplication::palette().background().color();
|
|
|
|
|
if (bg.value() < 128) {
|
|
|
|
|
return QApplication::palette().foreground().color();
|
|
|
|
|
} else {
|
|
|
|
|
return m_format.foreground();
|
|
|
|
|
}
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_OCCURRENCES_UNUSED) {
|
2009-11-30 17:23:31 +01:00
|
|
|
return Qt::darkYellow;
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_PARENTHESES) {
|
2008-12-02 12:01:29 +01:00
|
|
|
return QColor(Qt::red);
|
2009-06-15 15:35:06 +02:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
return m_format.foreground();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QColor FormatDescription::background() const
|
|
|
|
|
{
|
2012-04-26 14:17:42 +02:00
|
|
|
if (m_id == C_TEXT)
|
2008-12-02 12:01:29 +01:00
|
|
|
return Qt::white;
|
2012-04-26 14:17:42 +02:00
|
|
|
else if (m_id == C_LINE_NUMBER)
|
2008-12-02 12:01:29 +01:00
|
|
|
return QApplication::palette().background().color();
|
2012-04-26 14:17:42 +02:00
|
|
|
else if (m_id == C_SEARCH_RESULT)
|
2008-12-02 12:01:29 +01:00
|
|
|
return QColor(0xffef0b);
|
2012-04-26 14:17:42 +02:00
|
|
|
else if (m_id == C_PARENTHESES)
|
2008-12-02 12:01:29 +01:00
|
|
|
return QColor(0xb4, 0xee, 0xb4);
|
2012-04-26 14:17:42 +02:00
|
|
|
else if (m_id == C_CURRENT_LINE || m_id == C_SEARCH_SCOPE) {
|
2008-12-02 12:01:29 +01:00
|
|
|
const QPalette palette = QApplication::palette();
|
|
|
|
|
const QColor &fg = palette.color(QPalette::Highlight);
|
|
|
|
|
const QColor &bg = palette.color(QPalette::Base);
|
|
|
|
|
|
|
|
|
|
qreal smallRatio;
|
|
|
|
|
qreal largeRatio;
|
2012-04-26 14:17:42 +02:00
|
|
|
if (m_id == C_CURRENT_LINE) {
|
2010-05-20 17:00:10 +02:00
|
|
|
smallRatio = .3;
|
|
|
|
|
largeRatio = .6;
|
2008-12-02 12:01:29 +01:00
|
|
|
} else {
|
|
|
|
|
smallRatio = .05;
|
|
|
|
|
largeRatio = .4;
|
|
|
|
|
}
|
|
|
|
|
const qreal ratio = ((palette.color(QPalette::Text).value() < 128)
|
|
|
|
|
^ (palette.color(QPalette::HighlightedText).value() < 128)) ? smallRatio : largeRatio;
|
|
|
|
|
|
|
|
|
|
const QColor &col = QColor::fromRgbF(fg.redF() * ratio + bg.redF() * (1 - ratio),
|
|
|
|
|
fg.greenF() * ratio + bg.greenF() * (1 - ratio),
|
|
|
|
|
fg.blueF() * ratio + bg.blueF() * (1 - ratio));
|
|
|
|
|
return col;
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_SELECTION) {
|
2008-12-02 12:01:29 +01:00
|
|
|
const QPalette palette = QApplication::palette();
|
|
|
|
|
return palette.color(QPalette::Highlight);
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_OCCURRENCES) {
|
2009-11-25 15:55:45 +01:00
|
|
|
return QColor(180, 180, 180);
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_OCCURRENCES_RENAME) {
|
2009-12-01 16:38:38 +01:00
|
|
|
return QColor(255, 100, 100);
|
2012-04-26 14:17:42 +02:00
|
|
|
} else if (m_id == C_DISABLED_CODE) {
|
2009-10-08 12:57:26 +02:00
|
|
|
return QColor(239, 239, 239);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
return QColor(); // invalid color
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------ FontSettingsPage
|
|
|
|
|
FontSettingsPage::FontSettingsPage(const FormatDescriptions &fd,
|
2009-11-27 16:12:12 +01:00
|
|
|
const QString &id,
|
2008-12-02 12:01:29 +01:00
|
|
|
QObject *parent) :
|
2010-04-12 15:53:17 +02:00
|
|
|
TextEditorOptionsPage(parent),
|
|
|
|
|
d_ptr(new FontSettingsPagePrivate(fd, id, tr("Font && Colors"), category()))
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2012-05-22 11:17:13 +02:00
|
|
|
setId(d_ptr->m_id);
|
|
|
|
|
setDisplayName(d_ptr->m_displayName);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FontSettingsPage::~FontSettingsPage()
|
|
|
|
|
{
|
|
|
|
|
delete d_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *FontSettingsPage::createPage(QWidget *parent)
|
|
|
|
|
{
|
|
|
|
|
QWidget *w = new QWidget(parent);
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui = new Ui::FontSettingsPage;
|
|
|
|
|
d_ptr->m_ui->setupUi(w);
|
|
|
|
|
d_ptr->m_ui->schemeComboBox->setModel(d_ptr->m_schemeListModel);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QFontDatabase db;
|
|
|
|
|
const QStringList families = db.families();
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->familyComboBox->addItems(families);
|
2008-12-02 12:01:29 +01:00
|
|
|
const int idx = families.indexOf(d_ptr->m_value.family());
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->familyComboBox->setCurrentIndex(idx);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->antialias->setChecked(d_ptr->m_value.antialias());
|
|
|
|
|
d_ptr->m_ui->zoomSpinBox->setValue(d_ptr->m_value.fontZoom());
|
2009-05-27 15:33:37 +02:00
|
|
|
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->schemeEdit->setFormatDescriptions(d_ptr->m_descriptions);
|
|
|
|
|
d_ptr->m_ui->schemeEdit->setBaseFont(d_ptr->m_value.font());
|
|
|
|
|
d_ptr->m_ui->schemeEdit->setColorScheme(d_ptr->m_value.colorScheme());
|
2009-07-17 17:24:32 +02:00
|
|
|
|
2010-12-02 18:28:16 +01:00
|
|
|
connect(d_ptr->m_ui->familyComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontFamilySelected(QString)));
|
|
|
|
|
connect(d_ptr->m_ui->sizeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontSizeSelected(QString)));
|
|
|
|
|
connect(d_ptr->m_ui->zoomSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fontZoomChanged()));
|
|
|
|
|
connect(d_ptr->m_ui->schemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colorSchemeSelected(int)));
|
|
|
|
|
connect(d_ptr->m_ui->copyButton, SIGNAL(clicked()), this, SLOT(copyColorScheme()));
|
|
|
|
|
connect(d_ptr->m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(confirmDeleteColorScheme()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-11-30 19:00:36 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
updatePointSizes();
|
2009-07-07 16:07:40 +02:00
|
|
|
refreshColorSchemeList();
|
2008-12-02 12:01:29 +01:00
|
|
|
d_ptr->m_lastValue = d_ptr->m_value;
|
2010-12-01 14:35:36 +01:00
|
|
|
if (d_ptr->m_searchKeywords.isEmpty()) {
|
|
|
|
|
QLatin1Char sep(' ');
|
|
|
|
|
d_ptr->m_searchKeywords =
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->fontGroupBox->title() + sep
|
|
|
|
|
+ d_ptr->m_ui->familyLabel->text() + sep
|
|
|
|
|
+ d_ptr->m_ui->sizeLabel->text() + sep
|
|
|
|
|
+ d_ptr->m_ui->zoomLabel->text() + sep
|
|
|
|
|
+ d_ptr->m_ui->antialias->text() + sep
|
|
|
|
|
+ d_ptr->m_ui->colorSchemeGroupBox->title();
|
2010-12-01 14:35:36 +01:00
|
|
|
d_ptr->m_searchKeywords.remove(QLatin1Char('&'));
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
return w;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-17 17:24:32 +02:00
|
|
|
void FontSettingsPage::fontFamilySelected(const QString &family)
|
|
|
|
|
{
|
2009-07-21 10:51:16 +02:00
|
|
|
d_ptr->m_value.setFamily(family);
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->schemeEdit->setBaseFont(d_ptr->m_value.font());
|
2009-07-17 17:24:32 +02:00
|
|
|
updatePointSizes();
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void FontSettingsPage::updatePointSizes()
|
|
|
|
|
{
|
2009-07-17 17:24:32 +02:00
|
|
|
// Update point sizes
|
2008-12-02 12:01:29 +01:00
|
|
|
const int oldSize = d_ptr->m_value.fontSize();
|
2011-10-20 18:54:07 +02:00
|
|
|
d_ptr->m_ui->sizeComboBox->clear();
|
2010-04-16 12:54:49 +02:00
|
|
|
const QList<int> sizeLst = pointSizesForSelectedFont();
|
2010-09-28 11:16:57 +02:00
|
|
|
int idx = -1;
|
2008-12-02 12:01:29 +01:00
|
|
|
int i = 0;
|
2009-06-18 17:35:46 +02:00
|
|
|
for (; i < sizeLst.count(); ++i) {
|
2010-09-28 11:16:57 +02:00
|
|
|
if (idx == -1 && sizeLst.at(i) >= oldSize)
|
2008-12-02 12:01:29 +01:00
|
|
|
idx = i;
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->sizeComboBox->addItem(QString::number(sizeLst.at(i)));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2010-09-28 11:16:57 +02:00
|
|
|
if (idx != -1)
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->sizeComboBox->setCurrentIndex(idx);
|
2009-06-18 17:35:46 +02:00
|
|
|
}
|
|
|
|
|
|
2010-04-16 12:54:49 +02:00
|
|
|
QList<int> FontSettingsPage::pointSizesForSelectedFont() const
|
|
|
|
|
{
|
|
|
|
|
QFontDatabase db;
|
2010-12-02 18:28:16 +01:00
|
|
|
const QString familyName = d_ptr->m_ui->familyComboBox->currentText();
|
2010-04-16 12:54:49 +02:00
|
|
|
QList<int> sizeLst = db.pointSizes(familyName);
|
|
|
|
|
if (!sizeLst.isEmpty())
|
|
|
|
|
return sizeLst;
|
|
|
|
|
|
|
|
|
|
QStringList styles = db.styles(familyName);
|
|
|
|
|
if (!styles.isEmpty())
|
|
|
|
|
sizeLst = db.pointSizes(familyName, styles.first());
|
|
|
|
|
if (sizeLst.isEmpty())
|
|
|
|
|
sizeLst = QFontDatabase::standardSizes();
|
|
|
|
|
|
|
|
|
|
return sizeLst;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-17 17:24:32 +02:00
|
|
|
void FontSettingsPage::fontSizeSelected(const QString &sizeString)
|
|
|
|
|
{
|
|
|
|
|
bool ok = true;
|
|
|
|
|
const int size = sizeString.toInt(&ok);
|
|
|
|
|
if (ok) {
|
|
|
|
|
d_ptr->m_value.setFontSize(size);
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->schemeEdit->setBaseFont(d_ptr->m_value.font());
|
2009-07-17 17:24:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-30 19:00:36 +01:00
|
|
|
void FontSettingsPage::fontZoomChanged()
|
|
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_value.setFontZoom(d_ptr->m_ui->zoomSpinBox->value());
|
2009-11-30 19:00:36 +01:00
|
|
|
}
|
|
|
|
|
|
2009-07-16 17:16:55 +02:00
|
|
|
void FontSettingsPage::colorSchemeSelected(int index)
|
2009-07-07 18:35:42 +02:00
|
|
|
{
|
2009-07-17 17:24:32 +02:00
|
|
|
bool readOnly = true;
|
2009-07-16 17:16:55 +02:00
|
|
|
if (index != -1) {
|
2009-07-17 17:24:32 +02:00
|
|
|
// Check whether we're switching away from a changed color scheme
|
|
|
|
|
if (!d_ptr->m_refreshingSchemeList)
|
|
|
|
|
maybeSaveColorScheme();
|
|
|
|
|
|
2009-07-16 17:16:55 +02:00
|
|
|
const ColorSchemeEntry &entry = d_ptr->m_schemeListModel->colorSchemeAt(index);
|
2009-07-17 17:24:32 +02:00
|
|
|
readOnly = entry.readOnly;
|
|
|
|
|
d_ptr->m_value.loadColorScheme(entry.fileName, d_ptr->m_descriptions);
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->schemeEdit->setColorScheme(d_ptr->m_value.colorScheme());
|
2009-07-13 14:08:14 +02:00
|
|
|
}
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->copyButton->setEnabled(index != -1);
|
|
|
|
|
d_ptr->m_ui->deleteButton->setEnabled(!readOnly);
|
|
|
|
|
d_ptr->m_ui->schemeEdit->setReadOnly(readOnly);
|
2009-07-07 18:35:42 +02:00
|
|
|
}
|
|
|
|
|
|
2009-07-17 17:24:32 +02:00
|
|
|
void FontSettingsPage::copyColorScheme()
|
2009-07-20 16:58:53 +02:00
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
QInputDialog *dialog = new QInputDialog(d_ptr->m_ui->copyButton->window());
|
2009-07-20 16:58:53 +02:00
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
dialog->setInputMode(QInputDialog::TextInput);
|
|
|
|
|
dialog->setWindowTitle(tr("Copy Color Scheme"));
|
2010-05-14 15:45:43 +02:00
|
|
|
dialog->setLabelText(tr("Color scheme name:"));
|
2010-01-07 18:17:24 +01:00
|
|
|
dialog->setTextValue(tr("%1 (copy)").arg(d_ptr->m_value.colorScheme().displayName()));
|
2009-07-20 16:58:53 +02:00
|
|
|
|
|
|
|
|
connect(dialog, SIGNAL(textValueSelected(QString)), this, SLOT(copyColorScheme(QString)));
|
|
|
|
|
dialog->open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FontSettingsPage::copyColorScheme(const QString &name)
|
2009-07-07 16:07:40 +02:00
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
int index = d_ptr->m_ui->schemeComboBox->currentIndex();
|
2009-07-16 17:16:55 +02:00
|
|
|
if (index == -1)
|
2009-07-13 14:08:14 +02:00
|
|
|
return;
|
|
|
|
|
|
2009-07-16 17:16:55 +02:00
|
|
|
const ColorSchemeEntry &entry = d_ptr->m_schemeListModel->colorSchemeAt(index);
|
2009-07-13 14:08:14 +02:00
|
|
|
|
2009-07-15 15:39:35 +02:00
|
|
|
QString baseFileName = QFileInfo(entry.fileName).completeBaseName();
|
|
|
|
|
baseFileName += QLatin1String("_copy%1.xml");
|
|
|
|
|
QString fileName = createColorSchemeFileName(baseFileName);
|
2009-07-13 14:08:14 +02:00
|
|
|
|
2009-07-15 15:39:35 +02:00
|
|
|
if (!fileName.isEmpty()) {
|
2009-07-17 17:24:32 +02:00
|
|
|
// Ask about saving any existing modifactions
|
|
|
|
|
maybeSaveColorScheme();
|
|
|
|
|
|
|
|
|
|
// Make sure we're copying the current version
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_value.setColorScheme(d_ptr->m_ui->schemeEdit->colorScheme());
|
2009-07-17 17:24:32 +02:00
|
|
|
|
2009-07-15 15:39:35 +02:00
|
|
|
ColorScheme scheme = d_ptr->m_value.colorScheme();
|
2010-01-07 18:17:24 +01:00
|
|
|
scheme.setDisplayName(name);
|
2012-01-24 15:36:40 +01:00
|
|
|
if (scheme.save(fileName, Core::ICore::mainWindow()))
|
2011-03-30 15:15:15 +02:00
|
|
|
d_ptr->m_value.setColorSchemeFileName(fileName);
|
2009-07-13 14:08:14 +02:00
|
|
|
|
2009-07-15 15:39:35 +02:00
|
|
|
refreshColorSchemeList();
|
2009-07-13 14:08:14 +02:00
|
|
|
}
|
2009-07-07 16:07:40 +02:00
|
|
|
}
|
|
|
|
|
|
2009-07-22 14:16:21 +02:00
|
|
|
void FontSettingsPage::confirmDeleteColorScheme()
|
2009-07-07 16:07:40 +02:00
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
const int index = d_ptr->m_ui->schemeComboBox->currentIndex();
|
2009-07-16 17:16:55 +02:00
|
|
|
if (index == -1)
|
2009-07-13 14:08:14 +02:00
|
|
|
return;
|
|
|
|
|
|
2009-07-16 17:16:55 +02:00
|
|
|
const ColorSchemeEntry &entry = d_ptr->m_schemeListModel->colorSchemeAt(index);
|
2009-07-22 14:16:21 +02:00
|
|
|
if (entry.readOnly)
|
|
|
|
|
return;
|
2009-07-16 17:16:55 +02:00
|
|
|
|
2009-07-22 14:16:21 +02:00
|
|
|
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning,
|
|
|
|
|
tr("Delete Color Scheme"),
|
|
|
|
|
tr("Are you sure you want to delete this color scheme permanently?"),
|
|
|
|
|
QMessageBox::Discard | QMessageBox::Cancel,
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->deleteButton->window());
|
2009-07-22 14:16:21 +02:00
|
|
|
|
|
|
|
|
// Change the text and role of the discard button
|
|
|
|
|
QPushButton *deleteButton = static_cast<QPushButton*>(messageBox->button(QMessageBox::Discard));
|
|
|
|
|
deleteButton->setText(tr("Delete"));
|
|
|
|
|
messageBox->addButton(deleteButton, QMessageBox::AcceptRole);
|
|
|
|
|
messageBox->setDefaultButton(deleteButton);
|
|
|
|
|
|
|
|
|
|
connect(deleteButton, SIGNAL(clicked()), messageBox, SLOT(accept()));
|
|
|
|
|
connect(messageBox, SIGNAL(accepted()), this, SLOT(deleteColorScheme()));
|
|
|
|
|
messageBox->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
messageBox->open();
|
|
|
|
|
}
|
2009-07-13 14:08:14 +02:00
|
|
|
|
2009-07-22 14:16:21 +02:00
|
|
|
void FontSettingsPage::deleteColorScheme()
|
|
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
const int index = d_ptr->m_ui->schemeComboBox->currentIndex();
|
2012-04-17 08:01:25 +02:00
|
|
|
QTC_ASSERT(index != -1, return);
|
2009-07-22 14:16:21 +02:00
|
|
|
|
|
|
|
|
const ColorSchemeEntry &entry = d_ptr->m_schemeListModel->colorSchemeAt(index);
|
2012-04-17 08:01:25 +02:00
|
|
|
QTC_ASSERT(!entry.readOnly, return);
|
2009-07-22 14:16:21 +02:00
|
|
|
|
|
|
|
|
if (QFile::remove(entry.fileName))
|
|
|
|
|
d_ptr->m_schemeListModel->removeColorScheme(index);
|
2009-07-07 16:07:40 +02:00
|
|
|
}
|
|
|
|
|
|
2009-07-17 17:24:32 +02:00
|
|
|
void FontSettingsPage::maybeSaveColorScheme()
|
2009-06-18 17:35:46 +02:00
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
if (d_ptr->m_value.colorScheme() == d_ptr->m_ui->schemeEdit->colorScheme())
|
2009-07-13 14:08:14 +02:00
|
|
|
return;
|
|
|
|
|
|
2009-07-23 09:57:02 +02:00
|
|
|
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning,
|
|
|
|
|
tr("Color Scheme Changed"),
|
|
|
|
|
tr("The color scheme \"%1\" was modified, do you want to save the changes?")
|
2010-12-02 18:28:16 +01:00
|
|
|
.arg(d_ptr->m_ui->schemeEdit->colorScheme().displayName()),
|
2009-07-23 09:57:02 +02:00
|
|
|
QMessageBox::Discard | QMessageBox::Save,
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->schemeComboBox->window());
|
2009-07-23 09:57:02 +02:00
|
|
|
|
|
|
|
|
// Change the text of the discard button
|
|
|
|
|
QPushButton *discardButton = static_cast<QPushButton*>(messageBox->button(QMessageBox::Discard));
|
|
|
|
|
discardButton->setText(tr("Discard"));
|
|
|
|
|
messageBox->addButton(discardButton, QMessageBox::DestructiveRole);
|
|
|
|
|
messageBox->setDefaultButton(QMessageBox::Save);
|
|
|
|
|
|
|
|
|
|
if (messageBox->exec() == QMessageBox::Save) {
|
2010-12-02 18:28:16 +01:00
|
|
|
const ColorScheme &scheme = d_ptr->m_ui->schemeEdit->colorScheme();
|
2012-01-24 15:36:40 +01:00
|
|
|
scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::mainWindow());
|
2009-07-13 14:08:14 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-07 16:07:40 +02:00
|
|
|
void FontSettingsPage::refreshColorSchemeList()
|
|
|
|
|
{
|
2009-07-16 17:16:55 +02:00
|
|
|
QList<ColorSchemeEntry> colorSchemes;
|
2009-07-07 16:07:40 +02:00
|
|
|
|
2012-01-24 15:36:40 +01:00
|
|
|
QString resourcePath = Core::ICore::resourcePath();
|
2009-07-07 16:07:40 +02:00
|
|
|
QDir styleDir(resourcePath + QLatin1String("/styles"));
|
|
|
|
|
styleDir.setNameFilters(QStringList() << QLatin1String("*.xml"));
|
|
|
|
|
styleDir.setFilter(QDir::Files);
|
|
|
|
|
|
2009-07-07 18:35:42 +02:00
|
|
|
int selected = 0;
|
|
|
|
|
|
2010-03-22 12:41:04 +01:00
|
|
|
QStringList schemeList = styleDir.entryList();
|
|
|
|
|
QString defaultScheme = QFileInfo(FontSettings::defaultSchemeFileName()).fileName();
|
|
|
|
|
if (schemeList.removeAll(defaultScheme))
|
|
|
|
|
schemeList.prepend(defaultScheme);
|
|
|
|
|
foreach (const QString &file, schemeList) {
|
2009-07-13 14:08:14 +02:00
|
|
|
const QString fileName = styleDir.absoluteFilePath(file);
|
|
|
|
|
if (d_ptr->m_value.colorSchemeFileName() == fileName)
|
2009-07-16 17:16:55 +02:00
|
|
|
selected = colorSchemes.size();
|
|
|
|
|
colorSchemes.append(ColorSchemeEntry(fileName, true));
|
2009-07-13 14:08:14 +02:00
|
|
|
}
|
|
|
|
|
|
2009-09-02 17:17:13 +02:00
|
|
|
if (colorSchemes.isEmpty())
|
|
|
|
|
qWarning() << "Warning: no color schemes found in path:" << styleDir.path();
|
|
|
|
|
|
2009-07-13 14:08:14 +02:00
|
|
|
styleDir.setPath(customStylesPath());
|
|
|
|
|
|
|
|
|
|
foreach (const QString &file, styleDir.entryList()) {
|
|
|
|
|
const QString fileName = styleDir.absoluteFilePath(file);
|
|
|
|
|
if (d_ptr->m_value.colorSchemeFileName() == fileName)
|
2009-07-16 17:16:55 +02:00
|
|
|
selected = colorSchemes.size();
|
|
|
|
|
colorSchemes.append(ColorSchemeEntry(fileName, false));
|
2009-07-07 16:07:40 +02:00
|
|
|
}
|
2009-07-07 18:35:42 +02:00
|
|
|
|
2009-07-17 17:24:32 +02:00
|
|
|
d_ptr->m_refreshingSchemeList = true;
|
2009-07-16 17:16:55 +02:00
|
|
|
d_ptr->m_schemeListModel->setColorSchemes(colorSchemes);
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_ui->schemeComboBox->setCurrentIndex(selected);
|
2009-07-17 17:24:32 +02:00
|
|
|
d_ptr->m_refreshingSchemeList = false;
|
2009-07-07 16:07:40 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void FontSettingsPage::delayedChange()
|
|
|
|
|
{
|
|
|
|
|
emit changed(d_ptr->m_value);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-13 15:41:33 +01:00
|
|
|
void FontSettingsPage::apply()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
if (!d_ptr->m_ui) // page was never shown
|
|
|
|
|
return;
|
|
|
|
|
d_ptr->m_value.setAntialias(d_ptr->m_ui->antialias->isChecked());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-02 18:28:16 +01:00
|
|
|
if (d_ptr->m_value.colorScheme() != d_ptr->m_ui->schemeEdit->colorScheme()) {
|
2009-07-17 17:24:32 +02:00
|
|
|
// Update the scheme and save it under the name it already has
|
2010-12-02 18:28:16 +01:00
|
|
|
d_ptr->m_value.setColorScheme(d_ptr->m_ui->schemeEdit->colorScheme());
|
2009-07-17 17:24:32 +02:00
|
|
|
const ColorScheme &scheme = d_ptr->m_value.colorScheme();
|
2012-01-24 15:36:40 +01:00
|
|
|
scheme.save(d_ptr->m_value.colorSchemeFileName(), Core::ICore::mainWindow());
|
2009-07-17 17:24:32 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-02 18:28:16 +01:00
|
|
|
int index = d_ptr->m_ui->schemeComboBox->currentIndex();
|
2009-07-16 17:16:55 +02:00
|
|
|
if (index != -1) {
|
|
|
|
|
const ColorSchemeEntry &entry = d_ptr->m_schemeListModel->colorSchemeAt(index);
|
2009-07-13 14:08:14 +02:00
|
|
|
if (entry.fileName != d_ptr->m_value.colorSchemeFileName())
|
|
|
|
|
d_ptr->m_value.loadColorScheme(entry.fileName, d_ptr->m_descriptions);
|
2009-07-07 18:35:42 +02:00
|
|
|
}
|
|
|
|
|
|
2009-06-18 16:12:24 +02:00
|
|
|
saveSettings();
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-06-18 16:12:24 +02:00
|
|
|
void FontSettingsPage::saveSettings()
|
|
|
|
|
{
|
2008-12-02 12:01:29 +01:00
|
|
|
if (d_ptr->m_value != d_ptr->m_lastValue) {
|
2009-09-23 18:06:59 +02:00
|
|
|
d_ptr->m_lastValue = d_ptr->m_value;
|
2012-08-09 12:58:51 +03:00
|
|
|
d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, Core::ICore::settings());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-09-23 18:06:59 +02:00
|
|
|
QTimer::singleShot(0, this, SLOT(delayedChange()));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-13 15:41:33 +01:00
|
|
|
void FontSettingsPage::finish()
|
|
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
if (!d_ptr->m_ui) // page was never shown
|
|
|
|
|
return;
|
2009-01-13 15:41:33 +01:00
|
|
|
// If changes were applied, these are equal. Otherwise restores last value.
|
|
|
|
|
d_ptr->m_value = d_ptr->m_lastValue;
|
2010-12-02 18:28:16 +01:00
|
|
|
delete d_ptr->m_ui;
|
|
|
|
|
d_ptr->m_ui = 0;
|
2009-01-13 15:41:33 +01:00
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
const FontSettings &FontSettingsPage::fontSettings() const
|
|
|
|
|
{
|
|
|
|
|
return d_ptr->m_value;
|
|
|
|
|
}
|
2009-11-24 15:05:02 +01:00
|
|
|
|
|
|
|
|
bool FontSettingsPage::matches(const QString &s) const
|
|
|
|
|
{
|
|
|
|
|
return d_ptr->m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
|
|
|
|
}
|