forked from qt-creator/qt-creator
Moved editing of the color scheme into a separate dialog
In preparation of being able to select from multiple color schemes.
This commit is contained in:
@@ -81,6 +81,9 @@ class ColorScheme
|
|||||||
public:
|
public:
|
||||||
ColorScheme();
|
ColorScheme();
|
||||||
|
|
||||||
|
inline bool isEmpty() const
|
||||||
|
{ return m_formats.isEmpty(); }
|
||||||
|
|
||||||
bool contains(const QString &category) const;
|
bool contains(const QString &category) const;
|
||||||
|
|
||||||
Format &formatFor(const QString &category);
|
Format &formatFor(const QString &category);
|
||||||
|
|||||||
215
src/plugins/texteditor/editcolorschemedialog.cpp
Normal file
215
src/plugins/texteditor/editcolorschemedialog.cpp
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2009 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://www.qtsoftware.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "editcolorschemedialog.h"
|
||||||
|
#include "ui_editcolorschemedialog.h"
|
||||||
|
|
||||||
|
#include <QtGui/QColorDialog>
|
||||||
|
|
||||||
|
using namespace TextEditor::Internal;
|
||||||
|
|
||||||
|
static inline QString colorButtonStyleSheet(const QColor &bgColor)
|
||||||
|
{
|
||||||
|
if (bgColor.isValid()) {
|
||||||
|
QString rc = QLatin1String("border: 2px solid black; border-radius: 2px; background:");
|
||||||
|
rc += bgColor.name();
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
return QLatin1String("border: 2px dotted black; border-radius: 2px;");
|
||||||
|
}
|
||||||
|
|
||||||
|
EditColorSchemeDialog::EditColorSchemeDialog(const FormatDescriptions &fd,
|
||||||
|
const FontSettings &fontSettings,
|
||||||
|
const ColorScheme &scheme,
|
||||||
|
QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
m_descriptions(fd),
|
||||||
|
m_fontSettings(fontSettings),
|
||||||
|
m_scheme(scheme),
|
||||||
|
m_curItem(-1),
|
||||||
|
m_ui(new Ui::EditColorSchemeDialog)
|
||||||
|
{
|
||||||
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
foreach (const FormatDescription &d, fd)
|
||||||
|
m_ui->itemListWidget->addItem(d.trName());
|
||||||
|
|
||||||
|
connect(m_ui->itemListWidget, SIGNAL(itemSelectionChanged()), SLOT(itemChanged()));
|
||||||
|
connect(m_ui->foregroundToolButton, SIGNAL(clicked()), SLOT(changeForeColor()));
|
||||||
|
connect(m_ui->backgroundToolButton, SIGNAL(clicked()), SLOT(changeBackColor()));
|
||||||
|
connect(m_ui->eraseBackgroundToolButton, SIGNAL(clicked()), SLOT(eraseBackColor()));
|
||||||
|
connect(m_ui->boldCheckBox, SIGNAL(toggled(bool)), SLOT(checkCheckBoxes()));
|
||||||
|
connect(m_ui->italicCheckBox, SIGNAL(toggled(bool)), SLOT(checkCheckBoxes()));
|
||||||
|
|
||||||
|
if (!m_descriptions.empty())
|
||||||
|
m_ui->itemListWidget->setCurrentRow(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditColorSchemeDialog::~EditColorSchemeDialog()
|
||||||
|
{
|
||||||
|
delete m_ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditColorSchemeDialog::itemChanged()
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = m_ui->itemListWidget->currentItem();
|
||||||
|
if (!item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const int numFormats = m_descriptions.size();
|
||||||
|
for (int i = 0; i < numFormats; i++) {
|
||||||
|
if (m_descriptions[i].trName() == item->text()) {
|
||||||
|
m_curItem = i;
|
||||||
|
const Format &format = m_scheme.formatFor(m_descriptions[i].name());
|
||||||
|
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(format.foreground()));
|
||||||
|
m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(format.background()));
|
||||||
|
|
||||||
|
m_ui->eraseBackgroundToolButton->setEnabled(i > 0 && format.background().isValid());
|
||||||
|
|
||||||
|
const bool boldBlocked = m_ui->boldCheckBox->blockSignals(true);
|
||||||
|
m_ui->boldCheckBox->setChecked(format.bold());
|
||||||
|
m_ui->boldCheckBox->blockSignals(boldBlocked);
|
||||||
|
const bool italicBlocked = m_ui->italicCheckBox->blockSignals(true);
|
||||||
|
m_ui->italicCheckBox->setChecked(format.italic());
|
||||||
|
m_ui->italicCheckBox->blockSignals(italicBlocked);
|
||||||
|
updatePreview();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditColorSchemeDialog::changeForeColor()
|
||||||
|
{
|
||||||
|
if (m_curItem == -1)
|
||||||
|
return;
|
||||||
|
QColor color = m_scheme.formatFor(m_descriptions[m_curItem].name()).foreground();
|
||||||
|
const QColor newColor = QColorDialog::getColor(color, m_ui->boldCheckBox->window());
|
||||||
|
if (!newColor.isValid())
|
||||||
|
return;
|
||||||
|
QPalette p = m_ui->foregroundToolButton->palette();
|
||||||
|
p.setColor(QPalette::Active, QPalette::Button, newColor);
|
||||||
|
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
|
|
||||||
|
const int numFormats = m_descriptions.size();
|
||||||
|
for (int i = 0; i < numFormats; i++) {
|
||||||
|
QList<QListWidgetItem*> items = m_ui->itemListWidget->findItems(m_descriptions[i].trName(), Qt::MatchExactly);
|
||||||
|
if (!items.isEmpty() && items.first()->isSelected())
|
||||||
|
m_scheme.formatFor(m_descriptions[i].name()).setForeground(newColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditColorSchemeDialog::changeBackColor()
|
||||||
|
{
|
||||||
|
if (m_curItem == -1)
|
||||||
|
return;
|
||||||
|
QColor color = m_scheme.formatFor(m_descriptions[m_curItem].name()).background();
|
||||||
|
const QColor newColor = QColorDialog::getColor(color, m_ui->boldCheckBox->window());
|
||||||
|
if (!newColor.isValid())
|
||||||
|
return;
|
||||||
|
m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
|
m_ui->eraseBackgroundToolButton->setEnabled(true);
|
||||||
|
|
||||||
|
const int numFormats = m_descriptions.size();
|
||||||
|
for (int i = 0; i < numFormats; i++) {
|
||||||
|
QList<QListWidgetItem*> items = m_ui->itemListWidget->findItems(m_descriptions[i].trName(), Qt::MatchExactly);
|
||||||
|
if (!items.isEmpty() && items.first()->isSelected())
|
||||||
|
m_scheme.formatFor(m_descriptions[i].name()).setBackground(newColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditColorSchemeDialog::eraseBackColor()
|
||||||
|
{
|
||||||
|
if (m_curItem == -1)
|
||||||
|
return;
|
||||||
|
QColor newColor;
|
||||||
|
m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
|
|
||||||
|
const int numFormats = m_descriptions.size();
|
||||||
|
for (int i = 0; i < numFormats; i++) {
|
||||||
|
QList<QListWidgetItem*> items = m_ui->itemListWidget->findItems(m_descriptions[i].trName(), Qt::MatchExactly);
|
||||||
|
if (!items.isEmpty() && items.first()->isSelected())
|
||||||
|
m_scheme.formatFor(m_descriptions[i].name()).setBackground(newColor);
|
||||||
|
}
|
||||||
|
m_ui->eraseBackgroundToolButton->setEnabled(false);
|
||||||
|
|
||||||
|
updatePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditColorSchemeDialog::checkCheckBoxes()
|
||||||
|
{
|
||||||
|
if (m_curItem == -1)
|
||||||
|
return;
|
||||||
|
const int numFormats = m_descriptions.size();
|
||||||
|
for (int i = 0; i < numFormats; i++) {
|
||||||
|
QList<QListWidgetItem*> items = m_ui->itemListWidget->findItems(m_descriptions[i].trName(), Qt::MatchExactly);
|
||||||
|
if (!items.isEmpty() && items.first()->isSelected()) {
|
||||||
|
m_scheme.formatFor(m_descriptions[i].name()).setBold(m_ui->boldCheckBox->isChecked());
|
||||||
|
m_scheme.formatFor(m_descriptions[i].name()).setItalic(m_ui->italicCheckBox->isChecked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updatePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditColorSchemeDialog::updatePreview()
|
||||||
|
{
|
||||||
|
if (m_curItem == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const Format ¤tFormat = m_scheme.formatFor(m_descriptions[m_curItem].name());
|
||||||
|
const Format &baseFormat = m_scheme.formatFor(QLatin1String("Text"));
|
||||||
|
|
||||||
|
QPalette pal = QApplication::palette();
|
||||||
|
if (baseFormat.foreground().isValid()) {
|
||||||
|
pal.setColor(QPalette::Text, baseFormat.foreground());
|
||||||
|
pal.setColor(QPalette::Foreground, baseFormat.foreground());
|
||||||
|
}
|
||||||
|
if (baseFormat.background().isValid())
|
||||||
|
pal.setColor(QPalette::Base, baseFormat.background());
|
||||||
|
|
||||||
|
m_ui->previewTextEdit->setPalette(pal);
|
||||||
|
|
||||||
|
QTextCharFormat format;
|
||||||
|
if (currentFormat.foreground().isValid())
|
||||||
|
format.setForeground(QBrush(currentFormat.foreground()));
|
||||||
|
if (currentFormat.background().isValid())
|
||||||
|
format.setBackground(QBrush(currentFormat.background()));
|
||||||
|
format.setFontFamily(m_fontSettings.family());
|
||||||
|
format.setFontStyleStrategy(m_fontSettings.antialias() ? QFont::PreferAntialias : QFont::NoAntialias);
|
||||||
|
format.setFontPointSize(m_fontSettings.fontSize());
|
||||||
|
format.setFontItalic(currentFormat.italic());
|
||||||
|
if (currentFormat.bold())
|
||||||
|
format.setFontWeight(QFont::Bold);
|
||||||
|
m_ui->previewTextEdit->setCurrentCharFormat(format);
|
||||||
|
|
||||||
|
m_ui->previewTextEdit->setPlainText(tr("\n\tThis is only an example."));
|
||||||
|
}
|
||||||
81
src/plugins/texteditor/editcolorschemedialog.h
Normal file
81
src/plugins/texteditor/editcolorschemedialog.h
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2009 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://www.qtsoftware.com/contact.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef EDITCOLORSCHEMEDIALOG_H
|
||||||
|
#define EDITCOLORSCHEMEDIALOG_H
|
||||||
|
|
||||||
|
#include "colorscheme.h"
|
||||||
|
#include "fontsettingspage.h"
|
||||||
|
|
||||||
|
#include <QtGui/QDialog>
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class EditColorSchemeDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EditColorSchemeDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
EditColorSchemeDialog(const FormatDescriptions &fd,
|
||||||
|
const FontSettings &fontSettings,
|
||||||
|
const ColorScheme &scheme,
|
||||||
|
QWidget *parent = 0);
|
||||||
|
~EditColorSchemeDialog();
|
||||||
|
|
||||||
|
ColorScheme colorScheme() const
|
||||||
|
{ return m_scheme; }
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void itemChanged();
|
||||||
|
void changeForeColor();
|
||||||
|
void changeBackColor();
|
||||||
|
void eraseBackColor();
|
||||||
|
void checkCheckBoxes();
|
||||||
|
void updatePreview();
|
||||||
|
|
||||||
|
private:
|
||||||
|
const TextEditor::FormatDescriptions m_descriptions;
|
||||||
|
const FontSettings m_fontSettings;
|
||||||
|
|
||||||
|
ColorScheme m_scheme;
|
||||||
|
int m_curItem;
|
||||||
|
|
||||||
|
Ui::EditColorSchemeDialog *m_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace TextEditor
|
||||||
|
|
||||||
|
#endif // EDITCOLORSCHEMEDIALOG_H
|
||||||
231
src/plugins/texteditor/editcolorschemedialog.ui
Normal file
231
src/plugins/texteditor/editcolorschemedialog.ui
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TextEditor::Internal::EditColorSchemeDialog</class>
|
||||||
|
<widget class="QDialog" name="TextEditor::Internal::EditColorSchemeDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>462</width>
|
||||||
|
<height>416</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Edit Color Scheme</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Text Categories</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="itemListWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="_2">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="boldCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bold</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="italicCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Italic</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QToolButton" name="foregroundToolButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Background:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Foreground:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="backgroundToolButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="eraseBackgroundToolButton">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Erase background</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>x</string>
|
||||||
|
</property>
|
||||||
|
<property name="arrowType">
|
||||||
|
<enum>Qt::LeftArrow</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Preview:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="previewTextEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>100</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>TextEditor::Internal::EditColorSchemeDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>TextEditor::Internal::EditColorSchemeDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
FontSettings();
|
FontSettings();
|
||||||
void clear();
|
void clear();
|
||||||
inline bool isEmpty() const { return m_formats.isEmpty(); }
|
inline bool isEmpty() const { return m_scheme.isEmpty(); }
|
||||||
|
|
||||||
void toSettings(const QString &category,
|
void toSettings(const QString &category,
|
||||||
const FormatDescriptions &descriptions,
|
const FormatDescriptions &descriptions,
|
||||||
@@ -103,6 +103,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
Format &formatFor(const QString &category);
|
Format &formatFor(const QString &category);
|
||||||
|
|
||||||
|
ColorScheme colorScheme() const
|
||||||
|
{ return m_scheme; }
|
||||||
|
|
||||||
|
void setColorScheme(const ColorScheme &scheme)
|
||||||
|
{ m_scheme = scheme; }
|
||||||
|
|
||||||
bool equals(const FontSettings &f) const;
|
bool equals(const FontSettings &f) const;
|
||||||
|
|
||||||
static QString defaultFixedFontFamily();
|
static QString defaultFixedFontFamily();
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "fontsettingspage.h"
|
#include "fontsettingspage.h"
|
||||||
|
|
||||||
|
#include "editcolorschemedialog.h"
|
||||||
#include "fontsettings.h"
|
#include "fontsettings.h"
|
||||||
#include "texteditorconstants.h"
|
#include "texteditorconstants.h"
|
||||||
#include "ui_fontsettingspage.h"
|
#include "ui_fontsettingspage.h"
|
||||||
@@ -38,7 +40,6 @@
|
|||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
#include <QtGui/QColorDialog>
|
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QFontDatabase>
|
#include <QtGui/QFontDatabase>
|
||||||
#include <QtGui/QListWidget>
|
#include <QtGui/QListWidget>
|
||||||
@@ -48,16 +49,6 @@
|
|||||||
#include <QtGui/QTextEdit>
|
#include <QtGui/QTextEdit>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
static inline QString colorButtonStyleSheet(const QColor &bgColor)
|
|
||||||
{
|
|
||||||
if (bgColor.isValid()) {
|
|
||||||
QString rc = QLatin1String("border: 2px solid black; border-radius: 2px; background:");
|
|
||||||
rc += bgColor.name();
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
return QLatin1String("border: 2px dotted black; border-radius: 2px;");
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -78,7 +69,6 @@ public:
|
|||||||
TextEditor::FormatDescriptions m_descriptions;
|
TextEditor::FormatDescriptions m_descriptions;
|
||||||
FontSettings m_value;
|
FontSettings m_value;
|
||||||
FontSettings m_lastValue;
|
FontSettings m_lastValue;
|
||||||
int m_curItem;
|
|
||||||
Ui::FontSettingsPage ui;
|
Ui::FontSettingsPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,8 +80,7 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip
|
|||||||
m_settingsGroup(Core::Utils::settingsKey(category)),
|
m_settingsGroup(Core::Utils::settingsKey(category)),
|
||||||
m_category(category),
|
m_category(category),
|
||||||
m_trCategory(trCategory),
|
m_trCategory(trCategory),
|
||||||
m_descriptions(fd),
|
m_descriptions(fd)
|
||||||
m_curItem(-1)
|
|
||||||
{
|
{
|
||||||
bool settingsFound = false;
|
bool settingsFound = false;
|
||||||
if (const QSettings *settings = Core::ICore::instance()->settings())
|
if (const QSettings *settings = Core::ICore::instance()->settings())
|
||||||
@@ -231,10 +220,9 @@ QWidget *FontSettingsPage::createPage(QWidget *parent)
|
|||||||
QWidget *w = new QWidget(parent);
|
QWidget *w = new QWidget(parent);
|
||||||
d_ptr->ui.setupUi(w);
|
d_ptr->ui.setupUi(w);
|
||||||
|
|
||||||
d_ptr->ui.itemListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
d_ptr->ui.schemeListWidget->addItem(tr("Default"));
|
||||||
|
d_ptr->ui.schemeListWidget->setCurrentIndex(d_ptr->ui.schemeListWidget->model()->index(0, 0));
|
||||||
foreach (const FormatDescription &d, d_ptr->m_descriptions)
|
d_ptr->ui.editButton->setEnabled(true);
|
||||||
d_ptr->ui.itemListWidget->addItem(d.trName());
|
|
||||||
|
|
||||||
QFontDatabase db;
|
QFontDatabase db;
|
||||||
const QStringList families = db.families();
|
const QStringList families = db.families();
|
||||||
@@ -245,170 +233,13 @@ QWidget *FontSettingsPage::createPage(QWidget *parent)
|
|||||||
d_ptr->ui.antialias->setChecked(d_ptr->m_value.antialias());
|
d_ptr->ui.antialias->setChecked(d_ptr->m_value.antialias());
|
||||||
|
|
||||||
connect(d_ptr->ui.familyComboBox, SIGNAL(activated(int)), this, SLOT(updatePointSizes()));
|
connect(d_ptr->ui.familyComboBox, SIGNAL(activated(int)), this, SLOT(updatePointSizes()));
|
||||||
connect(d_ptr->ui.sizeComboBox, SIGNAL(activated(int)), this, SLOT(updatePreview()));
|
connect(d_ptr->ui.editButton, SIGNAL(clicked()), this, SLOT(editColorScheme()));
|
||||||
connect(d_ptr->ui.antialias, SIGNAL(toggled(bool)), this, SLOT(updatePreview()));
|
|
||||||
connect(d_ptr->ui.itemListWidget, SIGNAL(itemSelectionChanged()),
|
|
||||||
this, SLOT(itemChanged()));
|
|
||||||
connect(d_ptr->ui.foregroundToolButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(changeForeColor()));
|
|
||||||
connect(d_ptr->ui.backgroundToolButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(changeBackColor()));
|
|
||||||
connect(d_ptr->ui.eraseBackgroundToolButton, SIGNAL(clicked()),
|
|
||||||
this, SLOT(eraseBackColor()));
|
|
||||||
connect(d_ptr->ui.boldCheckBox, SIGNAL(toggled(bool)), this, SLOT(checkCheckBoxes()));
|
|
||||||
connect(d_ptr->ui.italicCheckBox, SIGNAL(toggled(bool)), this, SLOT(checkCheckBoxes()));
|
|
||||||
|
|
||||||
if (!d_ptr->m_descriptions.empty())
|
|
||||||
d_ptr->ui.itemListWidget->setCurrentRow(0);
|
|
||||||
|
|
||||||
updatePointSizes();
|
updatePointSizes();
|
||||||
d_ptr->m_lastValue = d_ptr->m_value;
|
d_ptr->m_lastValue = d_ptr->m_value;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontSettingsPage::itemChanged()
|
|
||||||
{
|
|
||||||
QListWidgetItem *item = d_ptr->ui.itemListWidget->currentItem();
|
|
||||||
if (!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const int numFormats = d_ptr->m_descriptions.size();
|
|
||||||
for (int i = 0; i < numFormats; i++) {
|
|
||||||
if (d_ptr->m_descriptions[i].trName() == item->text()) {
|
|
||||||
d_ptr->m_curItem = i;
|
|
||||||
const Format &format = d_ptr->m_value.formatFor(d_ptr->m_descriptions[i].name());
|
|
||||||
d_ptr->ui.foregroundToolButton->setStyleSheet(colorButtonStyleSheet(format.foreground()));
|
|
||||||
d_ptr->ui.backgroundToolButton->setStyleSheet(colorButtonStyleSheet(format.background()));
|
|
||||||
|
|
||||||
d_ptr->ui.eraseBackgroundToolButton->setEnabled(i > 0 && format.background().isValid());
|
|
||||||
|
|
||||||
const bool boldBlocked = d_ptr->ui.boldCheckBox->blockSignals(true);
|
|
||||||
d_ptr->ui.boldCheckBox->setChecked(format.bold());
|
|
||||||
d_ptr->ui.boldCheckBox->blockSignals(boldBlocked);
|
|
||||||
const bool italicBlocked = d_ptr->ui.italicCheckBox->blockSignals(true);
|
|
||||||
d_ptr->ui.italicCheckBox->setChecked(format.italic());
|
|
||||||
d_ptr->ui.italicCheckBox->blockSignals(italicBlocked);
|
|
||||||
updatePreview();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FontSettingsPage::changeForeColor()
|
|
||||||
{
|
|
||||||
if (d_ptr->m_curItem == -1)
|
|
||||||
return;
|
|
||||||
QColor color = d_ptr->m_value.formatFor(d_ptr->m_descriptions[d_ptr->m_curItem].name()).foreground();
|
|
||||||
const QColor newColor = QColorDialog::getColor(color, d_ptr->ui.boldCheckBox->window());
|
|
||||||
if (!newColor.isValid())
|
|
||||||
return;
|
|
||||||
QPalette p = d_ptr->ui.foregroundToolButton->palette();
|
|
||||||
p.setColor(QPalette::Active, QPalette::Button, newColor);
|
|
||||||
d_ptr->ui.foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
|
||||||
|
|
||||||
const int numFormats = d_ptr->m_descriptions.size();
|
|
||||||
for (int i = 0; i < numFormats; i++) {
|
|
||||||
QList<QListWidgetItem*> items = d_ptr->ui.itemListWidget->findItems(d_ptr->m_descriptions[i].trName(), Qt::MatchExactly);
|
|
||||||
if (!items.isEmpty() && items.first()->isSelected())
|
|
||||||
d_ptr->m_value.formatFor(d_ptr->m_descriptions[i].name()).setForeground(newColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
updatePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FontSettingsPage::changeBackColor()
|
|
||||||
{
|
|
||||||
if (d_ptr->m_curItem == -1)
|
|
||||||
return;
|
|
||||||
QColor color = d_ptr->m_value.formatFor(d_ptr->m_descriptions[d_ptr->m_curItem].name()).background();
|
|
||||||
const QColor newColor = QColorDialog::getColor(color, d_ptr->ui.boldCheckBox->window());
|
|
||||||
if (!newColor.isValid())
|
|
||||||
return;
|
|
||||||
d_ptr->ui.backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
|
||||||
d_ptr->ui.eraseBackgroundToolButton->setEnabled(true);
|
|
||||||
|
|
||||||
const int numFormats = d_ptr->m_descriptions.size();
|
|
||||||
for (int i = 0; i < numFormats; i++) {
|
|
||||||
QList<QListWidgetItem*> items = d_ptr->ui.itemListWidget->findItems(d_ptr->m_descriptions[i].trName(), Qt::MatchExactly);
|
|
||||||
if (!items.isEmpty() && items.first()->isSelected())
|
|
||||||
d_ptr->m_value.formatFor(d_ptr->m_descriptions[i].name()).setBackground(newColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
updatePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FontSettingsPage::eraseBackColor()
|
|
||||||
{
|
|
||||||
if (d_ptr->m_curItem == -1)
|
|
||||||
return;
|
|
||||||
QColor newColor;
|
|
||||||
d_ptr->ui.backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
|
||||||
|
|
||||||
const int numFormats = d_ptr->m_descriptions.size();
|
|
||||||
for (int i = 0; i < numFormats; i++) {
|
|
||||||
QList<QListWidgetItem*> items = d_ptr->ui.itemListWidget->findItems(d_ptr->m_descriptions[i].trName(), Qt::MatchExactly);
|
|
||||||
if (!items.isEmpty() && items.first()->isSelected())
|
|
||||||
d_ptr->m_value.formatFor(d_ptr->m_descriptions[i].name()).setBackground(newColor);
|
|
||||||
}
|
|
||||||
d_ptr->ui.eraseBackgroundToolButton->setEnabled(false);
|
|
||||||
|
|
||||||
updatePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FontSettingsPage::checkCheckBoxes()
|
|
||||||
{
|
|
||||||
if (d_ptr->m_curItem == -1)
|
|
||||||
return;
|
|
||||||
const int numFormats = d_ptr->m_descriptions.size();
|
|
||||||
for (int i = 0; i < numFormats; i++) {
|
|
||||||
QList<QListWidgetItem*> items = d_ptr->ui.itemListWidget->findItems(d_ptr->m_descriptions[i].trName(), Qt::MatchExactly);
|
|
||||||
if (!items.isEmpty() && items.first()->isSelected()) {
|
|
||||||
d_ptr->m_value.formatFor(d_ptr->m_descriptions[i].name()).setBold(d_ptr->ui.boldCheckBox->isChecked());
|
|
||||||
d_ptr->m_value.formatFor(d_ptr->m_descriptions[i].name()).setItalic(d_ptr->ui.italicCheckBox->isChecked());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updatePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FontSettingsPage::updatePreview()
|
|
||||||
{
|
|
||||||
if (d_ptr->m_curItem == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const Format ¤tFormat = d_ptr->m_value.formatFor(d_ptr->m_descriptions[d_ptr->m_curItem].name());
|
|
||||||
const Format &baseFormat = d_ptr->m_value.formatFor(QLatin1String("Text"));
|
|
||||||
|
|
||||||
QPalette pal = QApplication::palette();
|
|
||||||
if (baseFormat.foreground().isValid()) {
|
|
||||||
pal.setColor(QPalette::Text, baseFormat.foreground());
|
|
||||||
pal.setColor(QPalette::Foreground, baseFormat.foreground());
|
|
||||||
}
|
|
||||||
if (baseFormat.background().isValid())
|
|
||||||
pal.setColor(QPalette::Base, baseFormat.background());
|
|
||||||
|
|
||||||
d_ptr->ui.previewTextEdit->setPalette(pal);
|
|
||||||
|
|
||||||
QTextCharFormat format;
|
|
||||||
if (currentFormat.foreground().isValid())
|
|
||||||
format.setForeground(QBrush(currentFormat.foreground()));
|
|
||||||
if (currentFormat.background().isValid())
|
|
||||||
format.setBackground(QBrush(currentFormat.background()));
|
|
||||||
format.setFontFamily(d_ptr->ui.familyComboBox->currentText());
|
|
||||||
format.setFontStyleStrategy(d_ptr->ui.antialias->isChecked() ? QFont::PreferAntialias : QFont::NoAntialias);
|
|
||||||
bool ok;
|
|
||||||
int size = d_ptr->ui.sizeComboBox->currentText().toInt(&ok);
|
|
||||||
if (!ok) {
|
|
||||||
size = QFont().pointSize();
|
|
||||||
}
|
|
||||||
format.setFontPointSize(size);
|
|
||||||
format.setFontItalic(currentFormat.italic());
|
|
||||||
if (currentFormat.bold())
|
|
||||||
format.setFontWeight(QFont::Bold);
|
|
||||||
d_ptr->ui.previewTextEdit->setCurrentCharFormat(format);
|
|
||||||
|
|
||||||
d_ptr->ui.previewTextEdit->setPlainText(tr("\n\tThis is only an example."));
|
|
||||||
}
|
|
||||||
|
|
||||||
void FontSettingsPage::updatePointSizes()
|
void FontSettingsPage::updatePointSizes()
|
||||||
{
|
{
|
||||||
const int oldSize = d_ptr->m_value.fontSize();
|
const int oldSize = d_ptr->m_value.fontSize();
|
||||||
@@ -431,7 +262,25 @@ void FontSettingsPage::updatePointSizes()
|
|||||||
}
|
}
|
||||||
if (d_ptr->ui.sizeComboBox->count())
|
if (d_ptr->ui.sizeComboBox->count())
|
||||||
d_ptr->ui.sizeComboBox->setCurrentIndex(idx);
|
d_ptr->ui.sizeComboBox->setCurrentIndex(idx);
|
||||||
updatePreview();
|
}
|
||||||
|
|
||||||
|
void FontSettingsPage::editColorScheme()
|
||||||
|
{
|
||||||
|
d_ptr->m_value.setFamily(d_ptr->ui.familyComboBox->currentText());
|
||||||
|
d_ptr->m_value.setAntialias(d_ptr->ui.antialias->isChecked());
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
const int size = d_ptr->ui.sizeComboBox->currentText().toInt(&ok);
|
||||||
|
if (ok)
|
||||||
|
d_ptr->m_value.setFontSize(size);
|
||||||
|
|
||||||
|
EditColorSchemeDialog dialog(d_ptr->m_descriptions,
|
||||||
|
d_ptr->m_value,
|
||||||
|
d_ptr->m_value.colorScheme(),
|
||||||
|
d_ptr->ui.editButton->window());
|
||||||
|
|
||||||
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
|
d_ptr->m_value.setColorScheme(dialog.colorScheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontSettingsPage::delayedChange()
|
void FontSettingsPage::delayedChange()
|
||||||
|
|||||||
@@ -109,13 +109,8 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void delayedChange();
|
void delayedChange();
|
||||||
void itemChanged();
|
|
||||||
void changeForeColor();
|
|
||||||
void changeBackColor();
|
|
||||||
void eraseBackColor();
|
|
||||||
void checkCheckBoxes();
|
|
||||||
void updatePointSizes();
|
void updatePointSizes();
|
||||||
void updatePreview();
|
void editColorScheme();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Internal::FontSettingsPagePrivate *d_ptr;
|
Internal::FontSettingsPagePrivate *d_ptr;
|
||||||
|
|||||||
@@ -6,18 +6,18 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>572</width>
|
<width>391</width>
|
||||||
<height>471</height>
|
<height>344</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Font</string>
|
<string>Font</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="familyComboBox">
|
<widget class="QComboBox" name="familyComboBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="2">
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="3">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="4">
|
||||||
<widget class="QComboBox" name="sizeComboBox">
|
<widget class="QComboBox" name="sizeComboBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@@ -79,14 +79,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="5">
|
||||||
<widget class="QCheckBox" name="antialias">
|
|
||||||
<property name="text">
|
|
||||||
<string>Antialias</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@@ -99,146 +92,69 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="antialias">
|
||||||
|
<property name="text">
|
||||||
|
<string>Antialias</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Color Scheme</string>
|
<string>Color Scheme</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QListWidget" name="itemListWidget">
|
<widget class="QPushButton" name="importButton">
|
||||||
<property name="sizePolicy">
|
<property name="enabled">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<bool>false</bool>
|
||||||
<horstretch>1</horstretch>
|
</property>
|
||||||
<verstretch>0</verstretch>
|
<property name="text">
|
||||||
</sizepolicy>
|
<string>Import</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<layout class="QGridLayout">
|
<widget class="QPushButton" name="exportButton">
|
||||||
<item row="2" column="0">
|
<property name="enabled">
|
||||||
<widget class="QCheckBox" name="boldCheckBox">
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bold</string>
|
<string>Export</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QCheckBox" name="italicCheckBox">
|
<widget class="QPushButton" name="editButton">
|
||||||
<property name="text">
|
<property name="enabled">
|
||||||
<string>Italic</string>
|
<bool>false</bool>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QToolButton" name="foregroundToolButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Edit</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Background:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Foreground:</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<spacer>
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>87</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="0" rowspan="4">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QListWidget" name="schemeListWidget"/>
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="backgroundToolButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="eraseBackgroundToolButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Erase background</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>x</string>
|
|
||||||
</property>
|
|
||||||
<property name="arrowType">
|
|
||||||
<enum>Qt::LeftArrow</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Preview:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="previewTextEdit">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ SOURCES += texteditorplugin.cpp \
|
|||||||
texteditorsettings.cpp \
|
texteditorsettings.cpp \
|
||||||
codecselector.cpp \
|
codecselector.cpp \
|
||||||
findincurrentfile.cpp \
|
findincurrentfile.cpp \
|
||||||
colorscheme.cpp
|
colorscheme.cpp \
|
||||||
|
editcolorschemedialog.cpp
|
||||||
HEADERS += texteditorplugin.h \
|
HEADERS += texteditorplugin.h \
|
||||||
textfilewizard.h \
|
textfilewizard.h \
|
||||||
plaintexteditor.h \
|
plaintexteditor.h \
|
||||||
@@ -58,9 +59,11 @@ HEADERS += texteditorplugin.h \
|
|||||||
texteditorsettings.h \
|
texteditorsettings.h \
|
||||||
codecselector.h \
|
codecselector.h \
|
||||||
findincurrentfile.h \
|
findincurrentfile.h \
|
||||||
colorscheme.h
|
colorscheme.h \
|
||||||
|
editcolorschemedialog.h
|
||||||
FORMS += behaviorsettingspage.ui \
|
FORMS += behaviorsettingspage.ui \
|
||||||
displaysettingspage.ui \
|
displaysettingspage.ui \
|
||||||
fontsettingspage.ui
|
fontsettingspage.ui \
|
||||||
|
editcolorschemedialog.ui
|
||||||
RESOURCES += texteditor.qrc
|
RESOURCES += texteditor.qrc
|
||||||
OTHER_FILES += TextEditor.pluginspec
|
OTHER_FILES += TextEditor.pluginspec
|
||||||
|
|||||||
Reference in New Issue
Block a user