mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
drop config support
with QGuiPlatformPlugin and the QApplication settings and getters in place it is simply redundant Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
dda478c25b
commit
565423a1c1
26 changed files with 15 additions and 3357 deletions
|
@ -99,7 +99,7 @@ set(KATIE_TYPE SHARED CACHE STRING "Build type")
|
|||
|
||||
# components and tools that will be build, changed depending on the requirements availability
|
||||
set(KATIE_COMPONENTS "Core Gui Declarative Network Svg Xml Script Test UiTools")
|
||||
set(KATIE_TOOLS "moc uic qscript qtconfig")
|
||||
set(KATIE_TOOLS "moc uic qscript")
|
||||
|
||||
set(KATIE_HEADERS_PATH "${CMAKE_INSTALL_FULL_INCLUDEDIR}/katie" CACHE PATH "Headers installation path")
|
||||
set(KATIE_LIBRARIES_PATH "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Libraries installation path")
|
||||
|
|
|
@ -32,7 +32,7 @@ Description: C++ toolkit derived from the Qt 4.8 framework
|
|||
on the latest Git revision of Qt v4.8.
|
||||
.
|
||||
This package includes designer, moc, qdbus, qdbuscpp2xml, qdbusviewer,
|
||||
qdbusxml2cpp, qscript, qtconfig, rcc, and uic
|
||||
qdbusxml2cpp, qscript, trc, rcc, and uic
|
||||
|
||||
Package: katie-dev
|
||||
Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390x hurd-i386
|
||||
|
|
|
@ -4,7 +4,6 @@ bin/qdbuscpp2xml-katie
|
|||
bin/qdbusviewer-katie
|
||||
bin/qdbusxml2cpp-katie
|
||||
bin/qscript-katie
|
||||
bin/qtconfig-katie
|
||||
bin/trc-katie
|
||||
bin/uic-katie
|
||||
include/katie/QtCore/QAbstractEventDispatcher
|
||||
|
@ -1086,7 +1085,6 @@ libdata/pkgconfig/KtTest.pc
|
|||
libdata/pkgconfig/KtUiTools.pc
|
||||
libdata/pkgconfig/KtXml.pc
|
||||
share/applications/qdbusviewer-katie.desktop
|
||||
share/applications/qtconfig-katie.desktop
|
||||
share/man/man1/moc-katie.1.gz
|
||||
share/man/man1/qdbus-katie.1.gz
|
||||
share/man/man1/qdbuscpp2xml-katie.1.gz
|
||||
|
@ -1095,4 +1093,3 @@ share/man/man1/qscript-katie.1.gz
|
|||
share/man/man1/trc-katie.1.gz
|
||||
share/man/man1/uic-katie.1.gz
|
||||
share/pixmaps/qdbusviewer-katie.png
|
||||
share/pixmaps/qtconfig-katie.png
|
||||
|
|
|
@ -365,7 +365,6 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
|
|||
static bool initrgb = false;
|
||||
static QRgb stdrgb[6*8];
|
||||
static QRgb cusrgb[2*8];
|
||||
static bool customSet = false;
|
||||
|
||||
|
||||
static void initRGB()
|
||||
|
@ -413,7 +412,6 @@ void QColorDialog::setCustomColor(int index, QRgb color)
|
|||
if (index >= customCount())
|
||||
return;
|
||||
initRGB();
|
||||
customSet = true;
|
||||
cusrgb[index] = color;
|
||||
}
|
||||
|
||||
|
@ -1327,22 +1325,12 @@ void QColorDialogPrivate::init(const QColor &initial)
|
|||
const int lumSpace = topLay->spacing() / 2;
|
||||
|
||||
if (!smallDisplay) {
|
||||
leftLay = new QVBoxLayout;
|
||||
leftLay = new QVBoxLayout();
|
||||
topLay->addLayout(leftLay);
|
||||
}
|
||||
|
||||
initRGB();
|
||||
|
||||
if (!customSet) {
|
||||
QSettings settings(QString::fromLatin1("Katie"));
|
||||
for (int i = 0; i < 2*8; ++i) {
|
||||
qlonglong l = settings.integer(QLatin1String("Qt/customColors/") + QString::number(i));
|
||||
if (l != 0) {
|
||||
cusrgb[i] = QRgb(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!smallDisplay) {
|
||||
standard = new QColorWell(q, 6, 8, stdrgb);
|
||||
lblBasicColors = new QLabel(q);
|
||||
|
@ -1748,12 +1736,6 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
|
|||
QColorDialog::~QColorDialog()
|
||||
{
|
||||
Q_D(QColorDialog);
|
||||
|
||||
if (!customSet) {
|
||||
QSettings settings(QString::fromLatin1("Katie"));
|
||||
for (int i = 0; i < 2*8; ++i)
|
||||
settings.setInteger(QLatin1String("Qt/customColors/") + QString::number(i), cusrgb[i]);
|
||||
}
|
||||
if (d->nativeDialogInUse)
|
||||
qt_guiPlatformPlugin()->colorDialogDelete(this);
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "qmenu.h"
|
||||
#include "qmessagebox.h"
|
||||
#include "qinputdialog.h"
|
||||
#include "qsettings.h"
|
||||
#include "qdebug.h"
|
||||
#include "qapplication.h"
|
||||
#include "qstylepainter.h"
|
||||
|
@ -280,8 +279,6 @@ QFileDialog::QFileDialog(QWidget *parent,
|
|||
QFileDialog::~QFileDialog()
|
||||
{
|
||||
Q_D(QFileDialog);
|
||||
QSettings settings(QString::fromLatin1("Katie"));
|
||||
settings.setString(QLatin1String("Qt/filedialog"), saveState());
|
||||
d->deleteNativeDialog_sys();
|
||||
}
|
||||
|
||||
|
@ -1904,10 +1901,8 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte
|
|||
retranslateStrings();
|
||||
q->setFileMode(fileMode);
|
||||
|
||||
QSettings settings(QString::fromLatin1("Katie"));
|
||||
if (!directory.isEmpty())
|
||||
setLastVisitedDirectory(workingDirectory(directory));
|
||||
q->restoreState(settings.string(QLatin1String("Qt/filedialog")).toAscii());
|
||||
|
||||
// Default case
|
||||
if (!nameFilter.isEmpty())
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "qsessionmanager.h"
|
||||
#include "qclipboard.h"
|
||||
#include "qwhatsthis.h"
|
||||
#include "qsettings.h"
|
||||
#include "qstylefactory.h"
|
||||
#include "qfileinfo.h"
|
||||
#include "qdir.h"
|
||||
|
@ -574,60 +573,13 @@ bool QApplicationPrivate::x11_apply_settings()
|
|||
GUIEffects - QStringList
|
||||
*/
|
||||
|
||||
QPalette pal(Qt::black);
|
||||
int groupCount = 0;
|
||||
QSettings settings(QString::fromLatin1("Katie"));
|
||||
QStringList strlist = settings.stringList(QLatin1String("Qt/Palette/active"));
|
||||
if (!strlist.isEmpty()) {
|
||||
++groupCount;
|
||||
for (int i = 0; i < qMin(strlist.count(), int(QPalette::NColorRoles)); i++)
|
||||
pal.setColor(QPalette::Active, (QPalette::ColorRole) i,
|
||||
QColor(strlist[i]));
|
||||
}
|
||||
strlist = settings.stringList(QLatin1String("Qt/Palette/inactive"));
|
||||
if (!strlist.isEmpty()) {
|
||||
++groupCount;
|
||||
for (int i = 0; i < qMin(strlist.count(), int(QPalette::NColorRoles)); i++)
|
||||
pal.setColor(QPalette::Inactive, (QPalette::ColorRole) i,
|
||||
QColor(strlist[i]));
|
||||
}
|
||||
strlist = settings.stringList(QLatin1String("Qt/Palette/disabled"));
|
||||
if (!strlist.isEmpty()) {
|
||||
++groupCount;
|
||||
for (int i = 0; i < qMin(strlist.count(), int(QPalette::NColorRoles)); i++)
|
||||
pal.setColor(QPalette::Disabled, (QPalette::ColorRole) i,
|
||||
QColor(strlist[i]));
|
||||
}
|
||||
|
||||
if (groupCount == QPalette::NColorGroups) {
|
||||
QPalette pal = qt_guiPlatformPlugin()->palette();
|
||||
if (pal != QPalette()) {
|
||||
QApplicationPrivate::setSystemPalette(pal);
|
||||
} else {
|
||||
pal = qt_guiPlatformPlugin()->palette();
|
||||
if (pal != QPalette()) {
|
||||
QApplicationPrivate::setSystemPalette(pal);
|
||||
}
|
||||
}
|
||||
|
||||
QString fontDescription = settings.string(QLatin1String("Qt/font"));
|
||||
if (!fontDescription.isEmpty()) {
|
||||
QFont font(QApplication::font());
|
||||
font.fromString(fontDescription);
|
||||
QApplicationPrivate::setSystemFont(font);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
// read library (ie. plugin) path list
|
||||
QStringList pathlist = settings.string(QLatin1String("Qt/libraryPath")).split(QLatin1Char(':'));
|
||||
if (!pathlist.isEmpty()) {
|
||||
QStringList::ConstIterator it = pathlist.constBegin();
|
||||
while (it != pathlist.constEnd())
|
||||
QApplication::addLibraryPath(*it++);
|
||||
}
|
||||
#endif // QT_NO_LIBRARY
|
||||
|
||||
// read new QStyle
|
||||
QString stylename = settings.string(QLatin1String("Qt/style"));
|
||||
if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isEmpty()) {
|
||||
QString stylename;
|
||||
if (QApplicationPrivate::styleOverride.isEmpty()) {
|
||||
stylename = qt_guiPlatformPlugin()->styleName();
|
||||
}
|
||||
if (!stylename.isEmpty() && QApplicationPrivate::styleOverride.isEmpty()) {
|
||||
|
@ -636,36 +588,6 @@ bool QApplicationPrivate::x11_apply_settings()
|
|||
}
|
||||
}
|
||||
|
||||
int num = settings.integer(QLatin1String("Qt/doubleClickInterval"),
|
||||
QApplication::doubleClickInterval());
|
||||
QApplication::setDoubleClickInterval(num);
|
||||
|
||||
num = settings.integer(QLatin1String("Qt/cursorFlashTime"),
|
||||
QApplication::cursorFlashTime());
|
||||
QApplication::setCursorFlashTime(num);
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
num = settings.integer(QLatin1String("Qt/wheelScrollLines"),
|
||||
QApplication::wheelScrollLines());
|
||||
QApplication::setWheelScrollLines(num);
|
||||
#endif
|
||||
|
||||
int w = settings.integer(QLatin1String("Qt/globalStrut/width"));
|
||||
int h = settings.integer(QLatin1String("Qt/globalStrut/height"));
|
||||
QSize strut(w, h);
|
||||
if (strut.isValid())
|
||||
QApplication::setGlobalStrut(strut);
|
||||
|
||||
QStringList effects = settings.stringList(QLatin1String("Qt/GUIEffects"));
|
||||
QApplication::setEffectEnabled(Qt::UI_General,
|
||||
effects.contains(QLatin1String("general")));
|
||||
QApplication::setEffectEnabled(Qt::UI_FadeMenu,
|
||||
effects.contains(QLatin1String("fademenu")));
|
||||
QApplication::setEffectEnabled(Qt::UI_FadeTooltip,
|
||||
effects.contains(QLatin1String("fadetooltip")));
|
||||
|
||||
qt_use_rtl_extensions = settings.boolean(QLatin1String("Qt/useRtlExtensions"), false);
|
||||
|
||||
#ifndef QT_NO_ICON
|
||||
QIconLoader::instance()->updateSystemTheme();
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "qstring.h"
|
||||
#include "qbytearray.h"
|
||||
#include "qhash.h"
|
||||
#include "qsettings.h"
|
||||
#include "qmap.h"
|
||||
#include "qbitmap.h"
|
||||
#include "qregion.h"
|
||||
|
@ -150,9 +149,6 @@ QPSPrintEnginePrivate::QPSPrintEnginePrivate()
|
|||
postscript = true;
|
||||
|
||||
firstPage = true;
|
||||
|
||||
QSettings settings(QString::fromLatin1("Katie"));
|
||||
embedFonts = settings.boolean(QLatin1String("Qt/embedFonts"), true);
|
||||
}
|
||||
|
||||
QPSPrintEnginePrivate::~QPSPrintEnginePrivate()
|
||||
|
|
|
@ -18,4 +18,3 @@ if(WITH_GETTEXTPO AND GETTEXTPO_FOUND)
|
|||
add_subdirectory(trc)
|
||||
endif()
|
||||
add_subdirectory(qscript)
|
||||
add_subdirectory(qtconfig)
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
# add_definitions()
|
||||
set(EXTRA_QTCONFIG_LIBS
|
||||
KtCore KtGui
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/privateinclude
|
||||
${CMAKE_BINARY_DIR}/include/QtCore
|
||||
${CMAKE_BINARY_DIR}/include/QtGui
|
||||
# for UI file includes
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set(QTCONFIG_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/colorbutton.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/previewframe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/previewwidget.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/paletteeditoradvanced.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.ui
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/paletteeditoradvanced.ui
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/previewwidget.ui
|
||||
)
|
||||
|
||||
set(QTCONFIG_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/colorbutton.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/previewframe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/previewwidget.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/paletteeditoradvanced.h
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/qtconfig.desktop.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/qtconfig.desktop
|
||||
@ONLY
|
||||
)
|
||||
|
||||
katie_setup_target(qtconfig ${QTCONFIG_SOURCES} ${QTCONFIG_HEADERS})
|
||||
|
||||
add_executable(qtconfig ${qtconfig_SOURCES})
|
||||
target_link_libraries(qtconfig ${EXTRA_QTCONFIG_LIBS})
|
||||
|
||||
set_target_properties(qtconfig PROPERTIES
|
||||
EXPORT_NAME qtconfig
|
||||
OUTPUT_NAME qtconfig${KATIE_TOOLS_SUFFIX}
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS qtconfig
|
||||
EXPORT KatieTargets
|
||||
RUNTIME DESTINATION ${KATIE_BINARIES_PATH}
|
||||
COMPONENT Tools
|
||||
)
|
||||
|
||||
install(
|
||||
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/qtconfig.desktop
|
||||
DESTINATION ${KATIE_APPLICATIONS_PATH}
|
||||
RENAME qtconfig${KATIE_TOOLS_SUFFIX}.desktop
|
||||
COMPONENT Tools
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_SOURCE_DIR}/data/katie.png
|
||||
DESTINATION ${KATIE_PIXMAPS_PATH}
|
||||
RENAME qtconfig${KATIE_TOOLS_SUFFIX}.png
|
||||
COMPONENT Tools
|
||||
)
|
|
@ -1,189 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "colorbutton.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDragMoveEvent>
|
||||
#include <QColorDialog>
|
||||
#include <QPainter>
|
||||
#include <QMimeData>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
ColorButton::ColorButton(QWidget *parent)
|
||||
: QAbstractButton(parent)
|
||||
, col(Qt::black)
|
||||
, mousepressed(false)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
connect(this, SIGNAL(clicked()), SLOT(changeColor()));
|
||||
}
|
||||
|
||||
|
||||
ColorButton::ColorButton(const QColor &c, QWidget *parent)
|
||||
: QAbstractButton(parent)
|
||||
, col(c)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
connect(this, SIGNAL(clicked()), SLOT(changeColor()));
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::setColor(const QColor &c)
|
||||
{
|
||||
col = c;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::changeColor()
|
||||
{
|
||||
QColor c = QColorDialog::getColor(col, qApp->activeWindow());
|
||||
|
||||
if (c.isValid()) {
|
||||
setColor(c);
|
||||
emit colorChanged(color());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QSize ColorButton::sizeHint() const
|
||||
{
|
||||
return QSize(40, 25);
|
||||
}
|
||||
|
||||
|
||||
QSize ColorButton::minimumSizeHint() const
|
||||
{
|
||||
return QSize(40, 25);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::drawButton(QPainter *p)
|
||||
{
|
||||
QStyleOptionButton buttonOptions;
|
||||
buttonOptions.init(this);
|
||||
buttonOptions.features = QStyleOptionButton::None;
|
||||
buttonOptions.rect = rect();
|
||||
buttonOptions.palette = palette();
|
||||
buttonOptions.state = (isDown() ? QStyle::State_Sunken : QStyle::State_Raised);
|
||||
style()->drawPrimitive(QStyle::PE_PanelButtonBevel, &buttonOptions, p, this);
|
||||
|
||||
p->save();
|
||||
drawButtonLabel(p);
|
||||
p->restore();
|
||||
|
||||
QStyleOptionFocusRect frectOptions;
|
||||
frectOptions.init(this);
|
||||
frectOptions.rect = style()->subElementRect(QStyle::SE_PushButtonFocusRect, &buttonOptions, this);
|
||||
if (hasFocus())
|
||||
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &frectOptions, p, this);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::drawButtonLabel(QPainter *p)
|
||||
{
|
||||
QPalette::ColorGroup cg =
|
||||
(isEnabled() ? (hasFocus() ? QPalette::Active : QPalette::Inactive) : QPalette::Disabled);
|
||||
|
||||
p->setPen(palette().color(cg, QPalette::ButtonText));
|
||||
p->setBrush(col);
|
||||
p->drawRect(width() / 4, height() / 4, width() / 2 - 1, height() / 2 - 1);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::dragEnterEvent(QDragEnterEvent *e)
|
||||
{
|
||||
if (!e->mimeData()->hasColor()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::dragMoveEvent(QDragMoveEvent *e)
|
||||
{
|
||||
if (!e->mimeData()->hasColor()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::dropEvent(QDropEvent *e)
|
||||
{
|
||||
if (!e->mimeData()->hasColor()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
QColor c = qvariant_cast<QColor>(e->mimeData()->colorData());
|
||||
setColor(c);
|
||||
emit colorChanged(color());
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
presspos = e->pos();
|
||||
mousepressed = true;
|
||||
QAbstractButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
mousepressed = false;
|
||||
QAbstractButton::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
|
||||
void ColorButton::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (!mousepressed)
|
||||
return;
|
||||
|
||||
if ((presspos - e->pos()).manhattanLength() > QApplication::startDragDistance()) {
|
||||
mousepressed = false;
|
||||
setDown(false);
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
QMimeData *data = new QMimeData;
|
||||
data->setColorData(color());
|
||||
drag->setMimeData(data);
|
||||
drag->start(Qt::CopyAction);
|
||||
}
|
||||
}
|
||||
|
||||
void ColorButton::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
drawButton(&p);
|
||||
}
|
||||
|
||||
#include "moc_colorbutton.h"
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -1,70 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef COLORBUTTON_H
|
||||
#define COLORBUTTON_H
|
||||
|
||||
#include <QAbstractButton>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class ColorButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ColorButton(QWidget *);
|
||||
ColorButton(const QColor &, QWidget *);
|
||||
|
||||
const QColor &color() const { return col; }
|
||||
|
||||
void setColor(const QColor &);
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
void mousePressEvent(QMouseEvent *);
|
||||
void mouseReleaseEvent(QMouseEvent *);
|
||||
void mouseMoveEvent(QMouseEvent *);
|
||||
void dragEnterEvent(QDragEnterEvent *);
|
||||
void dragMoveEvent(QDragMoveEvent *);
|
||||
void dropEvent(QDropEvent *);
|
||||
|
||||
signals:
|
||||
void colorChanged(const QColor &);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void drawButton(QPainter *);
|
||||
void drawButtonLabel(QPainter *);
|
||||
|
||||
private slots:
|
||||
void changeColor();
|
||||
|
||||
|
||||
private:
|
||||
QColor col;
|
||||
QPoint presspos;
|
||||
bool mousepressed;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // COLORBUTTON_H
|
|
@ -1,45 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
QTranslator translator;
|
||||
QTranslator qtTranslator;
|
||||
if (translator.load(QLatin1String("qt_tools"))
|
||||
&& qtTranslator.load(QLatin1String("qt"))) {
|
||||
app.installTranslator(&translator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
}
|
||||
#endif
|
||||
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
return app.exec();
|
||||
}
|
|
@ -1,568 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include "colorbutton.h"
|
||||
#include "previewframe.h"
|
||||
#include "paletteeditoradvanced.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QApplication>
|
||||
#include <QComboBox>
|
||||
#include <QStyleFactory>
|
||||
#include <QFontDatabase>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QFileDialog>
|
||||
#include <QAction>
|
||||
#include <QStatusBar>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QStyle>
|
||||
#include <QCloseEvent>
|
||||
#include <QDebug>
|
||||
#include <QPixmap>
|
||||
#include <QGuiPlatformPlugin>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// from qapplication.cpp and qapplication_x11.cpp - These are NOT for
|
||||
// external use ignore them
|
||||
// extern bool Q_CORE_EXPORT qt_resolve_symlinks;
|
||||
|
||||
static const char *appearance_text = QT_TRANSLATE_NOOP("MainWindow",
|
||||
"<p><b><font size+=2>Appearance</font></b></p>"
|
||||
"<hr>"
|
||||
"<p>Use this tab to customize the appearance of your Katie applications.</p>"
|
||||
"<p>You can select the default GUI Style from the drop down list and "
|
||||
"customize the colors.</p>"
|
||||
"<p>Any GUI Style plugins in your plugin path will automatically be added "
|
||||
"to the list of built-in Katie styles. (See the Library Paths tab for "
|
||||
"information on adding new plugin paths.)</p>"
|
||||
"<p>When you choose 3-D Effects and Window Background colors, the Katie "
|
||||
"Configuration program will automatically generate a palette for you. "
|
||||
"To customize colors further, press the Tune Palette button to open "
|
||||
"the advanced palette editor.</p>"
|
||||
"<p>The Preview Window shows what the selected Style and colors look "
|
||||
"like.</p>"
|
||||
);
|
||||
|
||||
static const char *font_text = QT_TRANSLATE_NOOP("MainWindow",
|
||||
"<p><b><font size+=2>Fonts</font></b></p>"
|
||||
"<hr>"
|
||||
"<p>Use this tab to select the default font for your Katie applications. "
|
||||
"The selected font is shown (initially as 'Sample Text') in the line "
|
||||
"edit below the Family, Style and Point Size drop down lists.</p>"
|
||||
"<p>You can specify if Katie should try to embed fonts into its generated output "
|
||||
"when printing. If you enable font embedding, the resulting postscript will be "
|
||||
"more portable and will more accurately reflect the "
|
||||
"visual output on the screen; however the resulting postscript file "
|
||||
"size will be bigger.</p>"
|
||||
);
|
||||
|
||||
static const char *interface_text = QT_TRANSLATE_NOOP("MainWindow",
|
||||
"<p><b><font size+=2>Interface</font></b></p>"
|
||||
"<hr>"
|
||||
"<p>Use this tab to customize the feel of your Katie applications.</p>"
|
||||
"<p>If the Resolve Symlinks checkbox is checked Katie will follow symlinks "
|
||||
"when handling URLs. For example, in the file dialog, if this setting is turned "
|
||||
"on and /usr/tmp is a symlink to /var/tmp, entering the /usr/tmp directory "
|
||||
"will cause the file dialog to change to /var/tmp. With this setting turned "
|
||||
"off, symlinks are not resolved or followed.</p>"
|
||||
"<p>The Global Strut setting is useful for people who require a "
|
||||
"minimum size for all widgets (e.g. when using a touch panel or for users "
|
||||
"who are visually impaired). Leaving the Global Strut width and height "
|
||||
"at 0 will disable the Global Strut feature.</p>"
|
||||
);
|
||||
// ### What does the 'Enhanced support for languages written R2L do?
|
||||
|
||||
QPalette::ColorGroup MainWindow::groupFromIndex(int item)
|
||||
{
|
||||
switch (item) {
|
||||
case 0:
|
||||
default:
|
||||
return QPalette::Active;
|
||||
case 1:
|
||||
return QPalette::Inactive;
|
||||
case 2:
|
||||
return QPalette::Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
static void setStyleHelper(QWidget *w, QStyle *s)
|
||||
{
|
||||
const QObjectList children = w->children();
|
||||
for (int i = 0; i < children.size(); ++i) {
|
||||
QObject *child = children.at(i);
|
||||
if (child->isWidgetType())
|
||||
setStyleHelper((QWidget *) child, s);
|
||||
}
|
||||
w->setStyle(s);
|
||||
}
|
||||
|
||||
static QString qtconfigPixmap()
|
||||
{
|
||||
QString result = QString::fromLatin1(KATIE_PIXMAPS_PATH);
|
||||
result.append("/qtconfig");
|
||||
result.append(QLatin1String(KATIE_TOOLS_SUFFIX));
|
||||
result.append(QLatin1String(".png"));
|
||||
return result;
|
||||
}
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: ui(new Ui::MainWindow),
|
||||
editPalette(palette()),
|
||||
previewPalette(palette()),
|
||||
previewstyle(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// signals and slots connections
|
||||
connect(ui->fontStyleCombo, SIGNAL(activated(int)), SLOT(buildFont()));
|
||||
connect(ui->pointSizeCombo, SIGNAL(activated(int)), SLOT(buildFont()));
|
||||
connect(ui->fontFamilyCombo, SIGNAL(activated(QString)), SLOT(familySelected(QString)));
|
||||
connect(ui->fileExitAction, SIGNAL(triggered()), SLOT(fileExit()));
|
||||
connect(ui->fileSaveAction, SIGNAL(triggered()), SLOT(fileSave()));
|
||||
connect(ui->helpAboutAction, SIGNAL(triggered()), SLOT(helpAbout()));
|
||||
connect(ui->helpAboutQtAction, SIGNAL(triggered()), SLOT(helpAboutQt()));
|
||||
connect(ui->mainTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged(int)));
|
||||
connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int)));
|
||||
connect(ui->doubleClickIntervalSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
|
||||
connect(ui->cursorFlashTimeSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
|
||||
connect(ui->wheelScrollLinesSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
|
||||
connect(ui->menuEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
|
||||
connect(ui->toolTipEffectCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
|
||||
connect(ui->strutWidthSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
|
||||
connect(ui->strutHeightSpinBox, SIGNAL(valueChanged(int)), SLOT(somethingModified()));
|
||||
connect(ui->effectsCheckBox, SIGNAL(toggled(bool)), SLOT(effectsToggled(bool)));
|
||||
connect(ui->resolveLinksCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified()));
|
||||
connect(ui->fontEmbeddingCheckBox, SIGNAL(clicked()), SLOT(somethingModified()));
|
||||
connect(ui->rtlExtensionsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified()));
|
||||
connect(ui->guiStyleCombo, SIGNAL(activated(QString)), SLOT(styleSelected(QString)));
|
||||
connect(ui->tunePaletteButton, SIGNAL(clicked()), SLOT(tunePalette()));
|
||||
|
||||
modified = true;
|
||||
desktopThemeName = tr("Desktop Settings (Default)");
|
||||
setWindowIcon(QPixmap(qtconfigPixmap()));
|
||||
QStringList gstyles = QStyleFactory::keys();
|
||||
gstyles.sort();
|
||||
ui->guiStyleCombo->addItem(desktopThemeName);
|
||||
ui->guiStyleCombo->setItemData(ui->guiStyleCombo->findText(desktopThemeName),
|
||||
tr("Choose style and palette based on your desktop settings."),
|
||||
Qt::ToolTipRole);
|
||||
ui->guiStyleCombo->addItems(gstyles);
|
||||
|
||||
QSettings settings(QLatin1String("Katie"));
|
||||
|
||||
QString currentstyle = settings.string(QLatin1String("Qt/style"));
|
||||
if (currentstyle.isEmpty()) {
|
||||
ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->findText(desktopThemeName));
|
||||
currentstyle = QApplication::style()->objectName();
|
||||
} else {
|
||||
int index = ui->guiStyleCombo->findText(currentstyle, Qt::MatchFixedString);
|
||||
if (index != -1) {
|
||||
ui->guiStyleCombo->setCurrentIndex(index);
|
||||
} else { // we give up
|
||||
ui->guiStyleCombo->addItem(tr("Unknown"));
|
||||
ui->guiStyleCombo->setCurrentIndex(ui->guiStyleCombo->count() - 1);
|
||||
}
|
||||
}
|
||||
ui->buttonMainColor->setColor(palette().color(QPalette::Active, QPalette::Button));
|
||||
ui->buttonWindowColor->setColor(palette().color(QPalette::Active, QPalette::Window));
|
||||
connect(ui->buttonMainColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette()));
|
||||
connect(ui->buttonWindowColor, SIGNAL(colorChanged(QColor)), SLOT(buildPalette()));
|
||||
|
||||
#ifndef Q_WS_X11
|
||||
ui->colorConfig->hide();
|
||||
#endif
|
||||
|
||||
QFontDatabase db;
|
||||
QStringList families = db.families();
|
||||
ui->fontFamilyCombo->addItems(families);
|
||||
|
||||
QList<int> sizes = db.standardSizes();
|
||||
foreach(int i, sizes)
|
||||
ui->pointSizeCombo->addItem(QString::number(i));
|
||||
|
||||
ui->doubleClickIntervalSpinBox->setValue(QApplication::doubleClickInterval());
|
||||
ui->cursorFlashTimeSpinBox->setValue(QApplication::cursorFlashTime());
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
ui->wheelScrollLinesSpinBox->setValue(QApplication::wheelScrollLines());
|
||||
#else // QT_NO_WHEELEVENT
|
||||
ui->wheelScrollLinesLabel->hide();
|
||||
ui->wheelScrollLinesSpinBox->hide();
|
||||
#endif // QT_NO_WHEELEVENT
|
||||
// #############
|
||||
// resolveLinksCheckBox->setChecked(qt_resolve_symlinks);
|
||||
|
||||
ui->effectsCheckBox->setChecked(QApplication::isEffectEnabled(Qt::UI_General));
|
||||
ui->effectsFrame->setEnabled(ui->effectsCheckBox->isChecked());
|
||||
|
||||
if (QApplication::isEffectEnabled(Qt::UI_FadeMenu))
|
||||
ui->menuEffectCombo->setCurrentIndex(1);
|
||||
|
||||
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
|
||||
ui->toolTipEffectCombo->setCurrentIndex(1);
|
||||
|
||||
QSize globalStrut = QApplication::globalStrut();
|
||||
ui->strutWidthSpinBox->setValue(globalStrut.width());
|
||||
ui->strutHeightSpinBox->setValue(globalStrut.height());
|
||||
|
||||
// find the default family
|
||||
QStringList::Iterator sit = families.begin();
|
||||
int i = 0, possible = -1;
|
||||
while (sit != families.end()) {
|
||||
if (*sit == QApplication::font().family())
|
||||
break;
|
||||
if ((*sit).contains(QApplication::font().family()))
|
||||
possible = i;
|
||||
|
||||
i++;
|
||||
sit++;
|
||||
}
|
||||
if (sit == families.end())
|
||||
i = possible;
|
||||
if (i == -1) // no clue about the current font
|
||||
i = 0;
|
||||
|
||||
ui->fontFamilyCombo->setCurrentIndex(i);
|
||||
|
||||
QStringList styles = db.styles(ui->fontFamilyCombo->currentText());
|
||||
ui->fontStyleCombo->addItems(styles);
|
||||
|
||||
QString stylestring = db.styleString(QApplication::font());
|
||||
sit = styles.begin();
|
||||
i = 0;
|
||||
possible = -1;
|
||||
while (sit != styles.end()) {
|
||||
if (*sit == stylestring)
|
||||
break;
|
||||
if ((*sit).contains(stylestring))
|
||||
possible = i;
|
||||
|
||||
i++;
|
||||
sit++;
|
||||
}
|
||||
if (sit == styles.end())
|
||||
i = possible;
|
||||
if (i == -1) // no clue about the current font
|
||||
i = 0;
|
||||
ui->fontStyleCombo->setCurrentIndex(i);
|
||||
|
||||
i = 0;
|
||||
for (int psize = QApplication::font().pointSize(); i < ui->pointSizeCombo->count(); ++i) {
|
||||
const int sz = ui->pointSizeCombo->itemText(i).toInt();
|
||||
if (sz == psize) {
|
||||
ui->pointSizeCombo->setCurrentIndex(i);
|
||||
break;
|
||||
} else if(sz > psize) {
|
||||
ui->pointSizeCombo->insertItem(i, QString::number(psize));
|
||||
ui->pointSizeCombo->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ui->rtlExtensionsCheckBox->setChecked(settings.boolean(QLatin1String("Qt/useRtlExtensions"), false));
|
||||
|
||||
ui->fontEmbeddingCheckBox->setChecked(settings.boolean(QLatin1String("Qt/embedFonts"), true));
|
||||
|
||||
ui->helpView->setText(tr(appearance_text));
|
||||
|
||||
setModified(false);
|
||||
updateStyleLayout();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
extern void qt_x11_apply_settings_in_all_apps();
|
||||
#endif
|
||||
|
||||
void MainWindow::fileSave()
|
||||
{
|
||||
if (! modified) {
|
||||
#ifndef QT_NO_STATUSBAR
|
||||
statusBar()->showMessage(tr("No changes to be saved."), 2000);
|
||||
#endif // QT_NO_STATUSBAR
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_STATUSBAR
|
||||
statusBar()->showMessage(tr("Saving changes..."));
|
||||
#endif // QT_NO_STATUSBAR
|
||||
|
||||
{
|
||||
QSettings settings(QLatin1String("Katie"));
|
||||
QFontDatabase db;
|
||||
QFont font = db.font(ui->fontFamilyCombo->currentText(),
|
||||
ui->fontStyleCombo->currentText(),
|
||||
ui->pointSizeCombo->currentText().toInt());
|
||||
|
||||
QStringList actcg, inactcg, discg;
|
||||
bool overrideDesktopSettings = (ui->guiStyleCombo->currentText() != desktopThemeName);
|
||||
if (overrideDesktopSettings) {
|
||||
int i;
|
||||
for (i = 0; i < QPalette::NColorRoles; i++)
|
||||
actcg << editPalette.color(QPalette::Active,
|
||||
QPalette::ColorRole(i)).name();
|
||||
for (i = 0; i < QPalette::NColorRoles; i++)
|
||||
inactcg << editPalette.color(QPalette::Inactive,
|
||||
QPalette::ColorRole(i)).name();
|
||||
for (i = 0; i < QPalette::NColorRoles; i++)
|
||||
discg << editPalette.color(QPalette::Disabled,
|
||||
QPalette::ColorRole(i)).name();
|
||||
}
|
||||
|
||||
settings.setString(QLatin1String("Qt/font"), font.toString());
|
||||
settings.setStringList(QLatin1String("Qt/Palette/active"), actcg);
|
||||
settings.setStringList(QLatin1String("Qt/Palette/inactive"), inactcg);
|
||||
settings.setStringList(QLatin1String("Qt/Palette/disabled"), discg);
|
||||
|
||||
settings.setInteger(QLatin1String("Qt/embedFonts"), ui->fontEmbeddingCheckBox->isChecked());
|
||||
settings.setString(QLatin1String("Qt/style"),
|
||||
overrideDesktopSettings ? ui->guiStyleCombo->currentText() : QString());
|
||||
|
||||
settings.setInteger(QLatin1String("Qt/doubleClickInterval"), ui->doubleClickIntervalSpinBox->value());
|
||||
settings.setInteger(QLatin1String("Qt/cursorFlashTime"),
|
||||
ui->cursorFlashTimeSpinBox->value() == 9 ? 0 : ui->cursorFlashTimeSpinBox->value());
|
||||
settings.setInteger(QLatin1String("Qt/wheelScrollLines"), ui->wheelScrollLinesSpinBox->value());
|
||||
settings.setInteger(QLatin1String("Qt/resolveSymlinks"), ui->resolveLinksCheckBox->isChecked());
|
||||
|
||||
QSize strut(ui->strutWidthSpinBox->value(), ui->strutHeightSpinBox->value());
|
||||
settings.setInteger(QLatin1String("Qt/globalStrut/width"), strut.width());
|
||||
settings.setInteger(QLatin1String("Qt/globalStrut/height"), strut.height());
|
||||
|
||||
settings.setInteger(QLatin1String("Qt/useRtlExtensions"), ui->rtlExtensionsCheckBox->isChecked());
|
||||
|
||||
QStringList effects;
|
||||
if (ui->effectsCheckBox->isChecked()) {
|
||||
effects << QLatin1String("general");
|
||||
|
||||
switch (ui->menuEffectCombo->currentIndex()) {
|
||||
case 1: effects << QLatin1String("fademenu"); break;
|
||||
}
|
||||
|
||||
switch (ui->toolTipEffectCombo->currentIndex()) {
|
||||
case 1: effects << QLatin1String("fadetooltip"); break;
|
||||
}
|
||||
} else
|
||||
effects << QLatin1String("none");
|
||||
settings.setStringList(QLatin1String("Qt/GUIEffects"), effects);
|
||||
}
|
||||
|
||||
#if defined(Q_WS_X11)
|
||||
qt_x11_apply_settings_in_all_apps();
|
||||
#endif // Q_WS_X11
|
||||
|
||||
setModified(false);
|
||||
#ifndef QT_NO_STATUSBAR
|
||||
statusBar()->showMessage(tr("Saved changes."));
|
||||
#endif // QT_NO_STATUSBAR
|
||||
}
|
||||
|
||||
void MainWindow::fileExit()
|
||||
{
|
||||
qApp->closeAllWindows();
|
||||
}
|
||||
|
||||
void MainWindow::setModified(bool m)
|
||||
{
|
||||
if (modified == m)
|
||||
return;
|
||||
|
||||
modified = m;
|
||||
ui->fileSaveAction->setEnabled(m);
|
||||
}
|
||||
|
||||
void MainWindow::buildPalette()
|
||||
{
|
||||
QPalette temp(ui->buttonMainColor->color(), ui->buttonWindowColor->color());
|
||||
for (int i = 0; i < QPalette::NColorGroups; i++)
|
||||
temp = PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup(i), temp);
|
||||
|
||||
editPalette = temp;
|
||||
setPreviewPalette(editPalette);
|
||||
updateColorButtons();
|
||||
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
void MainWindow::setPreviewPalette(const QPalette &pal)
|
||||
{
|
||||
QPalette::ColorGroup colorGroup = groupFromIndex(ui->paletteCombo->currentIndex());
|
||||
|
||||
for (int i = 0; i < QPalette::NColorGroups; i++) {
|
||||
for (int j = 0; j < QPalette::NColorRoles; j++) {
|
||||
QPalette::ColorGroup targetGroup = QPalette::ColorGroup(i);
|
||||
QPalette::ColorRole targetRole = QPalette::ColorRole(j);
|
||||
previewPalette.setColor(targetGroup, targetRole, pal.color(colorGroup, targetRole));
|
||||
}
|
||||
}
|
||||
|
||||
ui->previewFrame->setPreviewPalette(previewPalette);
|
||||
}
|
||||
|
||||
void MainWindow::updateColorButtons()
|
||||
{
|
||||
ui->buttonMainColor->setColor(editPalette.color(QPalette::Active, QPalette::Button));
|
||||
ui->buttonWindowColor->setColor(editPalette.color(QPalette::Active, QPalette::Window));
|
||||
}
|
||||
|
||||
void MainWindow::tunePalette()
|
||||
{
|
||||
bool ok;
|
||||
QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette,
|
||||
backgroundRole(), this);
|
||||
if (!ok)
|
||||
return;
|
||||
|
||||
editPalette = pal;
|
||||
setPreviewPalette(editPalette);
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
void MainWindow::paletteSelected(int)
|
||||
{
|
||||
setPreviewPalette(editPalette);
|
||||
}
|
||||
|
||||
void MainWindow::updateStyleLayout()
|
||||
{
|
||||
ui->previewFrame->setPreviewVisible(true);
|
||||
ui->buildPaletteGroup->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::styleSelected(const QString &stylename)
|
||||
{
|
||||
QString realstyle(stylename);
|
||||
if (stylename == desktopThemeName) {
|
||||
QGuiPlatformPlugin* platformplugin = qt_guiPlatformPlugin();
|
||||
if (platformplugin) {
|
||||
realstyle = platformplugin->styleName();
|
||||
}
|
||||
}
|
||||
QStyle *style = QStyleFactory::create(realstyle);
|
||||
if (!style)
|
||||
return;
|
||||
setStyleHelper(ui->previewFrame, style);
|
||||
delete previewstyle;
|
||||
previewstyle = style;
|
||||
setModified(true);
|
||||
updateStyleLayout();
|
||||
}
|
||||
|
||||
void MainWindow::familySelected(const QString &family)
|
||||
{
|
||||
QFontDatabase db;
|
||||
QStringList styles = db.styles(family);
|
||||
ui->fontStyleCombo->clear();
|
||||
ui->fontStyleCombo->addItems(styles);
|
||||
buildFont();
|
||||
}
|
||||
|
||||
void MainWindow::buildFont()
|
||||
{
|
||||
QFontDatabase db;
|
||||
QFont font = db.font(ui->fontFamilyCombo->currentText(),
|
||||
ui->fontStyleCombo->currentText(),
|
||||
ui->pointSizeCombo->currentText().toInt());
|
||||
ui->sampleLineEdit->setFont(font);
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
void MainWindow::somethingModified()
|
||||
{
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
void MainWindow::helpAbout()
|
||||
{
|
||||
QMessageBox box(this);
|
||||
box.setText(tr("<h3>%1</h3>"
|
||||
"<br/>Version %2"
|
||||
"<br/><br/>Copyright (C) 2015 The Qt Company Ltd."
|
||||
"<br/><br/>Copyright (C) 2016 Ivailo Monev"
|
||||
)
|
||||
.arg(tr("Katie Configuration")).arg(QLatin1String(QT_VERSION_STR)));
|
||||
box.setWindowTitle(tr("Katie Configuration"));
|
||||
box.setIcon(QMessageBox::NoIcon);
|
||||
box.exec();
|
||||
}
|
||||
|
||||
void MainWindow::helpAboutQt()
|
||||
{
|
||||
QMessageBox::aboutQt(this, tr("Katie Configuration"));
|
||||
}
|
||||
|
||||
void MainWindow::pageChanged(int pageNumber)
|
||||
{
|
||||
QWidget *page = ui->mainTabWidget->widget(pageNumber);
|
||||
if (page == ui->interfaceTab)
|
||||
ui->helpView->setText(tr(interface_text));
|
||||
else if (page == ui->appearanceTab)
|
||||
ui->helpView->setText(tr(appearance_text));
|
||||
else if (page == ui->fontsTab)
|
||||
ui->helpView->setText(tr(font_text));
|
||||
}
|
||||
|
||||
void MainWindow::effectsToggled(bool toggled)
|
||||
{
|
||||
ui->effectsFrame->setEnabled(toggled);
|
||||
setModified(true);
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
if (modified) {
|
||||
switch (QMessageBox::warning(this, tr("Save Changes"),
|
||||
tr("Save changes to settings?"),
|
||||
(QMessageBox::Yes | QMessageBox::No
|
||||
| QMessageBox::Cancel))) {
|
||||
case QMessageBox::Yes: // save
|
||||
qApp->processEvents();
|
||||
fileSave();
|
||||
|
||||
// fall through intended
|
||||
case QMessageBox::No: // don't save
|
||||
e->accept();
|
||||
break;
|
||||
|
||||
case QMessageBox::Cancel: // cancel
|
||||
e->ignore();
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
} else
|
||||
e->accept();
|
||||
}
|
||||
|
||||
#include "moc_mainwindow.h"
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -1,78 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow();
|
||||
|
||||
void closeEvent(QCloseEvent *);
|
||||
|
||||
public slots:
|
||||
virtual void buildPalette();
|
||||
virtual void buildFont();
|
||||
virtual void tunePalette();
|
||||
virtual void paletteSelected(int);
|
||||
virtual void styleSelected(const QString &);
|
||||
virtual void familySelected(const QString &);
|
||||
virtual void fileSave();
|
||||
virtual void fileExit();
|
||||
virtual void somethingModified();
|
||||
virtual void helpAbout();
|
||||
virtual void helpAboutQt();
|
||||
virtual void pageChanged(int);
|
||||
virtual void effectsToggled(bool);
|
||||
|
||||
private:
|
||||
void updateColorButtons();
|
||||
void updateFontSample();
|
||||
void updateStyleLayout();
|
||||
|
||||
static QPalette::ColorGroup groupFromIndex(int);
|
||||
|
||||
void setPreviewPalette(const QPalette &);
|
||||
|
||||
void setModified(bool);
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
QString desktopThemeName;
|
||||
QPalette editPalette, previewPalette;
|
||||
QStyle *previewstyle;
|
||||
bool modified;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // MAINWINDOW_H
|
|
@ -1,784 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<comment>*********************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
*********************************************************************</comment>
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>861</width>
|
||||
<height>552</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Katie Configuration</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QTabWidget" name="mainTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="appearanceTab">
|
||||
<attribute name="title">
|
||||
<string>Appearance</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="guiStyleGroup">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>GUI Style</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="guiStyleLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select GUI &Style:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>guiStyleCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="guiStyleCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="previewGroup">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="paletteLabel">
|
||||
<property name="text">
|
||||
<string>Select &Palette:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>paletteCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="paletteCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Active Palette</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inactive Palette</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disabled Palette</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="PreviewFrame" name="previewFrame" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>410</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="buildPaletteGroup">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Build Palette</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="colorConfig" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelMainColor">
|
||||
<property name="text">
|
||||
<string>&Button Background:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>buttonMainColor</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ColorButton" name="buttonMainColor" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelWindowColor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Window Back&ground:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>buttonWindowColor</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ColorButton" name="buttonWindowColor" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="tunePaletteButton">
|
||||
<property name="text">
|
||||
<string>&Tune Palette...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="fontsTab">
|
||||
<attribute name="title">
|
||||
<string>Fonts</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="defaultFontGroup">
|
||||
<property name="title">
|
||||
<string>Default Font</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="fontStyleCombo">
|
||||
<property name="autoCompletion">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="fontFamilyCombo">
|
||||
<property name="autoCompletion">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fontStyleLabel">
|
||||
<property name="text">
|
||||
<string>&Style:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontStyleCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="pointSizeCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoCompletion">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="duplicatesEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="fontFamilyLabel">
|
||||
<property name="text">
|
||||
<string>F&amily:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>fontFamilyCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="pointSizeLabel">
|
||||
<property name="text">
|
||||
<string>&Point Size:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>pointSizeCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<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="3" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="sampleLineEdit">
|
||||
<property name="text">
|
||||
<string>Sample Text</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="fontEmbeddingCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable Font embedding</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="interfaceTab">
|
||||
<attribute name="title">
|
||||
<string>Interface</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="feelSettingsGroup">
|
||||
<property name="title">
|
||||
<string>Feel Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="doubleClickIntervalSpinBox">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="doubleClickIntervalLabel">
|
||||
<property name="text">
|
||||
<string>&Double Click Interval:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>doubleClickIntervalSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="cursorFlashTimeSpinBox">
|
||||
<property name="specialValueText">
|
||||
<string>No blinking</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="cursorFlashTimeLabel">
|
||||
<property name="text">
|
||||
<string>&Cursor Flash Time:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cursorFlashTimeSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="wheelScrollLinesSpinBox">
|
||||
<property name="suffix">
|
||||
<string> lines</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="wheelScrollLinesLabel">
|
||||
<property name="text">
|
||||
<string>Wheel &Scroll Lines:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>wheelScrollLinesSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="resolveLinksCheckBox">
|
||||
<property name="text">
|
||||
<string>Resolve symlinks in URLs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="guiEffectsGroup">
|
||||
<property name="title">
|
||||
<string>GUI Effects</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="effectsCheckBox">
|
||||
<property name="text">
|
||||
<string>&Enable</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Alt+E</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="effectsFrame">
|
||||
<layout class="QGridLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="menuEffectLabel">
|
||||
<property name="text">
|
||||
<string>&Menu Effect:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>menuEffectCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="toolTipEffectLabel">
|
||||
<property name="text">
|
||||
<string>&ToolTip Effect:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>toolTipEffectCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="menuEffectCombo">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="autoCompletion">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disable</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fade</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="toolTipEffectCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disable</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fade</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="globalStrutGroup">
|
||||
<property name="title">
|
||||
<string>Global Strut</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="strutWidthLabel">
|
||||
<property name="text">
|
||||
<string>Minimum &Width:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>strutWidthSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="strutHeightLabel">
|
||||
<property name="text">
|
||||
<string>Minimum Hei&ght:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>strutHeightSpinBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="strutWidthSpinBox">
|
||||
<property name="suffix">
|
||||
<string> pixels</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="strutHeightSpinBox">
|
||||
<property name="suffix">
|
||||
<string> pixels</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="rtlExtensionsCheckBox">
|
||||
<property name="text">
|
||||
<string>Enhanced support for languages written right-to-left</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="helpView">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="mainMenu">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>861</width>
|
||||
<height>19</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="fileMenu">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>203</x>
|
||||
<y>114</y>
|
||||
<width>122</width>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="fileSaveAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="fileExitAction"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="saveMenu">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>543</x>
|
||||
<y>98</y>
|
||||
<width>122</width>
|
||||
<height>106</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="helpAboutAction"/>
|
||||
<addaction name="helpAboutQtAction"/>
|
||||
</widget>
|
||||
<addaction name="fileMenu"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="saveMenu"/>
|
||||
</widget>
|
||||
<action name="fileSaveAction">
|
||||
<property name="text">
|
||||
<string>&Save</string>
|
||||
</property>
|
||||
<property name="iconText">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="fileExitAction">
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
</property>
|
||||
<property name="iconText">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="helpAboutAction">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
<property name="iconText">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="helpAboutQtAction">
|
||||
<property name="text">
|
||||
<string>About &Katie</string>
|
||||
</property>
|
||||
<property name="iconText">
|
||||
<string>About Katie</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ColorButton</class>
|
||||
<extends></extends>
|
||||
<header>colorbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PreviewFrame</class>
|
||||
<extends></extends>
|
||||
<header>previewframe.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>helpView</tabstop>
|
||||
<tabstop>mainTabWidget</tabstop>
|
||||
<tabstop>guiStyleCombo</tabstop>
|
||||
<tabstop>tunePaletteButton</tabstop>
|
||||
<tabstop>paletteCombo</tabstop>
|
||||
<tabstop>fontFamilyCombo</tabstop>
|
||||
<tabstop>fontStyleCombo</tabstop>
|
||||
<tabstop>pointSizeCombo</tabstop>
|
||||
<tabstop>sampleLineEdit</tabstop>
|
||||
<tabstop>doubleClickIntervalSpinBox</tabstop>
|
||||
<tabstop>cursorFlashTimeSpinBox</tabstop>
|
||||
<tabstop>wheelScrollLinesSpinBox</tabstop>
|
||||
<tabstop>resolveLinksCheckBox</tabstop>
|
||||
<tabstop>effectsCheckBox</tabstop>
|
||||
<tabstop>menuEffectCombo</tabstop>
|
||||
<tabstop>toolTipEffectCombo</tabstop>
|
||||
<tabstop>strutWidthSpinBox</tabstop>
|
||||
<tabstop>strutHeightSpinBox</tabstop>
|
||||
<tabstop>rtlExtensionsCheckBox</tabstop>
|
||||
</tabstops>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,387 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "ui_paletteeditoradvanced.h"
|
||||
#include "paletteeditoradvanced.h"
|
||||
#include "colorbutton.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
PaletteEditorAdvanced::PaletteEditorAdvanced(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::PaletteEditorAdvanced), selectedPalette(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// create a ColorButton's
|
||||
buttonCentral = new ColorButton(ui->groupCentral);
|
||||
buttonCentral->setToolTip(tr("Choose a color"));
|
||||
#ifndef QT_NO_WHATSTHIS
|
||||
buttonCentral->setWhatsThis(tr("Choose a color for the selected central color role."));
|
||||
#endif // QT_NO_WHATSTHIS
|
||||
ui->layoutCentral->addWidget(buttonCentral);
|
||||
ui->labelCentral->setBuddy(buttonCentral);
|
||||
|
||||
buttonEffect = new ColorButton(ui->groupEffect);
|
||||
buttonEffect->setToolTip(tr("Choose a color"));
|
||||
#ifndef QT_NO_WHATSTHIS
|
||||
buttonEffect->setWhatsThis(tr("Choose a color for the selected effect color role."));
|
||||
#endif // QT_NO_WHATSTHIS
|
||||
buttonEffect->setEnabled(false);
|
||||
ui->layoutEffect->addWidget(buttonEffect);
|
||||
ui->labelEffect->setBuddy(buttonEffect);
|
||||
|
||||
// signals and slots connections
|
||||
connect(ui->paletteCombo, SIGNAL(activated(int)), SLOT(paletteSelected(int)));
|
||||
connect(ui->comboCentral, SIGNAL(activated(int)), SLOT(onCentral(int)));
|
||||
connect(buttonCentral, SIGNAL(clicked()), SLOT(onChooseCentralColor()));
|
||||
connect(buttonEffect, SIGNAL(clicked()), SLOT(onChooseEffectColor()));
|
||||
connect(ui->comboEffect, SIGNAL(activated(int)), SLOT(onEffect(int)));
|
||||
connect(ui->checkBuildEffect, SIGNAL(toggled(bool)), SLOT(onToggleBuildEffects(bool)));
|
||||
connect(ui->checkBuildEffect, SIGNAL(toggled(bool)), buttonEffect, SLOT(setDisabled(bool)));
|
||||
connect(ui->checkBuildInactive, SIGNAL(toggled(bool)), SLOT(onToggleBuildInactive(bool)));
|
||||
connect(ui->checkBuildDisabled, SIGNAL(toggled(bool)), SLOT(onToggleBuildDisabled(bool)));
|
||||
|
||||
onToggleBuildEffects(true);
|
||||
|
||||
editPalette = QApplication::palette();
|
||||
}
|
||||
|
||||
PaletteEditorAdvanced::~PaletteEditorAdvanced()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onToggleBuildInactive(bool v)
|
||||
{
|
||||
if (selectedPalette == 1) {
|
||||
ui->groupCentral->setDisabled(v);
|
||||
ui->groupEffect->setDisabled(v);
|
||||
}
|
||||
|
||||
if (v) {
|
||||
build(QPalette::Inactive);
|
||||
updateColorButtons();
|
||||
}
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onToggleBuildDisabled(bool v)
|
||||
{
|
||||
if (selectedPalette == 2) {
|
||||
ui->groupCentral->setDisabled(v);
|
||||
ui->groupEffect->setDisabled(v);
|
||||
}
|
||||
|
||||
if (v) {
|
||||
build(QPalette::Disabled);
|
||||
updateColorButtons();
|
||||
}
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::paletteSelected(int p)
|
||||
{
|
||||
selectedPalette = p;
|
||||
|
||||
if(p == 1) { // inactive
|
||||
ui->groupCentral->setDisabled(ui->checkBuildInactive->isChecked());
|
||||
ui->groupEffect->setDisabled(ui->checkBuildInactive->isChecked());
|
||||
} else if (p == 2) { // disabled
|
||||
ui->groupCentral->setDisabled(ui->checkBuildDisabled->isChecked());
|
||||
ui->groupEffect->setDisabled(ui->checkBuildDisabled->isChecked());
|
||||
} else {
|
||||
ui->groupCentral->setEnabled(true);
|
||||
ui->groupEffect->setEnabled(true);
|
||||
}
|
||||
updateColorButtons();
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onChooseCentralColor()
|
||||
{
|
||||
QPalette::ColorGroup group = groupFromIndex(selectedPalette);
|
||||
editPalette.setColor(group, centralFromIndex(ui->comboCentral->currentIndex()),
|
||||
buttonCentral->color());
|
||||
|
||||
buildEffect(group);
|
||||
if (group == QPalette::Active) {
|
||||
if(ui->checkBuildInactive->isChecked())
|
||||
build(QPalette::Inactive);
|
||||
if(ui->checkBuildDisabled->isChecked())
|
||||
build(QPalette::Disabled);
|
||||
}
|
||||
|
||||
updateColorButtons();
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onChooseEffectColor()
|
||||
{
|
||||
QPalette::ColorGroup group = groupFromIndex(selectedPalette);
|
||||
editPalette.setColor(group, effectFromIndex(ui->comboEffect->currentIndex()),
|
||||
buttonEffect->color());
|
||||
|
||||
if (group == QPalette::Active) {
|
||||
if(ui->checkBuildInactive->isChecked())
|
||||
build(QPalette::Inactive);
|
||||
if(ui->checkBuildDisabled->isChecked())
|
||||
build(QPalette::Disabled);
|
||||
}
|
||||
|
||||
updateColorButtons();
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onToggleBuildEffects(bool on)
|
||||
{
|
||||
if (on) {
|
||||
for (int i = 0; i < QPalette::NColorGroups; i++)
|
||||
buildEffect(QPalette::ColorGroup(i));
|
||||
}
|
||||
}
|
||||
|
||||
QPalette::ColorGroup PaletteEditorAdvanced::groupFromIndex(int item)
|
||||
{
|
||||
switch (item) {
|
||||
case 0:
|
||||
default:
|
||||
return QPalette::Active;
|
||||
case 1:
|
||||
return QPalette::Inactive;
|
||||
case 2:
|
||||
return QPalette::Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
QPalette::ColorRole PaletteEditorAdvanced::centralFromIndex(int item)
|
||||
{
|
||||
switch (item) {
|
||||
case 0:
|
||||
return QPalette::Window;
|
||||
case 1:
|
||||
return QPalette::WindowText;
|
||||
case 2:
|
||||
return QPalette::Base;
|
||||
case 3:
|
||||
return QPalette::AlternateBase;
|
||||
case 4:
|
||||
return QPalette::ToolTipBase;
|
||||
case 5:
|
||||
return QPalette::ToolTipText;
|
||||
case 6:
|
||||
return QPalette::Text;
|
||||
case 7:
|
||||
return QPalette::Button;
|
||||
case 8:
|
||||
return QPalette::ButtonText;
|
||||
case 9:
|
||||
return QPalette::BrightText;
|
||||
case 10:
|
||||
return QPalette::Highlight;
|
||||
case 11:
|
||||
return QPalette::HighlightedText;
|
||||
case 12:
|
||||
return QPalette::Link;
|
||||
case 13:
|
||||
return QPalette::LinkVisited;
|
||||
default:
|
||||
return QPalette::NoRole;
|
||||
}
|
||||
}
|
||||
|
||||
QPalette::ColorRole PaletteEditorAdvanced::effectFromIndex(int item)
|
||||
{
|
||||
switch (item) {
|
||||
case 0:
|
||||
return QPalette::Light;
|
||||
case 1:
|
||||
return QPalette::Midlight;
|
||||
case 2:
|
||||
return QPalette::Mid;
|
||||
case 3:
|
||||
return QPalette::Dark;
|
||||
case 4:
|
||||
return QPalette::Shadow;
|
||||
default:
|
||||
return QPalette::NoRole;
|
||||
}
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onCentral(int item)
|
||||
{
|
||||
QColor c = editPalette.color(groupFromIndex(selectedPalette), centralFromIndex(item));
|
||||
buttonCentral->setColor(c);
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::onEffect(int item)
|
||||
{
|
||||
QColor c = editPalette.color(groupFromIndex(selectedPalette), effectFromIndex(item));
|
||||
buttonEffect->setColor(c);
|
||||
}
|
||||
|
||||
QPalette PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup,
|
||||
const QPalette &basePalette)
|
||||
{
|
||||
QPalette result(basePalette);
|
||||
|
||||
if (colorGroup == QPalette::Active) {
|
||||
QPalette calculatedPalette(basePalette.color(colorGroup, QPalette::Button),
|
||||
basePalette.color(colorGroup, QPalette::Window));
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
QPalette::ColorRole effectRole = effectFromIndex(i);
|
||||
result.setColor(colorGroup, effectRole,
|
||||
calculatedPalette.color(colorGroup, effectRole));
|
||||
}
|
||||
} else {
|
||||
QColor btn = basePalette.color(colorGroup, QPalette::Button);
|
||||
|
||||
result.setColor(colorGroup, QPalette::Light, btn.lighter());
|
||||
result.setColor(colorGroup, QPalette::Midlight, btn.lighter(115));
|
||||
result.setColor(colorGroup, QPalette::Mid, btn.darker(150));
|
||||
result.setColor(colorGroup, QPalette::Dark, btn.darker());
|
||||
result.setColor(colorGroup, QPalette::Shadow, Qt::black);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::buildEffect(QPalette::ColorGroup colorGroup)
|
||||
{
|
||||
editPalette = buildEffect(colorGroup, editPalette);
|
||||
updateColorButtons();
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::build(QPalette::ColorGroup colorGroup)
|
||||
{
|
||||
if (colorGroup != QPalette::Active) {
|
||||
for (int i = 0; i < QPalette::NColorRoles; i++)
|
||||
editPalette.setColor(colorGroup, QPalette::ColorRole(i),
|
||||
editPalette.color(QPalette::Active, QPalette::ColorRole(i)));
|
||||
|
||||
if (colorGroup == QPalette::Disabled) {
|
||||
editPalette.setColor(colorGroup, QPalette::ButtonText, Qt::darkGray);
|
||||
editPalette.setColor(colorGroup, QPalette::WindowText, Qt::darkGray);
|
||||
editPalette.setColor(colorGroup, QPalette::Text, Qt::darkGray);
|
||||
editPalette.setColor(colorGroup, QPalette::HighlightedText, Qt::darkGray);
|
||||
}
|
||||
|
||||
if (ui->checkBuildEffect->isChecked())
|
||||
buildEffect(colorGroup);
|
||||
else
|
||||
updateColorButtons();
|
||||
}
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::updateColorButtons()
|
||||
{
|
||||
QPalette::ColorGroup colorGroup = groupFromIndex(selectedPalette);
|
||||
buttonCentral->setColor(editPalette.color(colorGroup,
|
||||
centralFromIndex(ui->comboCentral->currentIndex())));
|
||||
buttonEffect->setColor(editPalette.color(colorGroup,
|
||||
effectFromIndex(ui->comboEffect->currentIndex())));
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::setPal(const QPalette &pal)
|
||||
{
|
||||
editPalette = pal;
|
||||
updateColorButtons();
|
||||
}
|
||||
|
||||
QPalette PaletteEditorAdvanced::pal() const
|
||||
{
|
||||
return editPalette;
|
||||
}
|
||||
|
||||
void PaletteEditorAdvanced::setupBackgroundRole(QPalette::ColorRole role)
|
||||
{
|
||||
int initRole = 0;
|
||||
|
||||
switch (role) {
|
||||
case QPalette::Window:
|
||||
initRole = 0;
|
||||
break;
|
||||
case QPalette::WindowText:
|
||||
initRole = 1;
|
||||
break;
|
||||
case QPalette::Base:
|
||||
initRole = 2;
|
||||
break;
|
||||
case QPalette::AlternateBase:
|
||||
initRole = 3;
|
||||
break;
|
||||
case QPalette::ToolTipBase:
|
||||
initRole = 4;
|
||||
break;
|
||||
case QPalette::ToolTipText:
|
||||
initRole = 5;
|
||||
break;
|
||||
case QPalette::Text:
|
||||
initRole = 6;
|
||||
break;
|
||||
case QPalette::Button:
|
||||
initRole = 7;
|
||||
break;
|
||||
case QPalette::ButtonText:
|
||||
initRole = 8;
|
||||
break;
|
||||
case QPalette::BrightText:
|
||||
initRole = 9;
|
||||
break;
|
||||
case QPalette::Highlight:
|
||||
initRole = 10;
|
||||
break;
|
||||
case QPalette::HighlightedText:
|
||||
initRole = 11;
|
||||
break;
|
||||
case QPalette::Link:
|
||||
initRole = 12;
|
||||
break;
|
||||
case QPalette::LinkVisited:
|
||||
initRole = 13;
|
||||
break;
|
||||
default:
|
||||
initRole = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (initRole != -1)
|
||||
ui->comboCentral->setCurrentIndex(initRole);
|
||||
}
|
||||
|
||||
QPalette PaletteEditorAdvanced::getPalette(bool *ok, const QPalette &init,
|
||||
QPalette::ColorRole backgroundRole, QWidget *parent)
|
||||
{
|
||||
PaletteEditorAdvanced *dlg = new PaletteEditorAdvanced(parent);
|
||||
dlg->setupBackgroundRole(backgroundRole);
|
||||
|
||||
if (init != QPalette())
|
||||
dlg->setPal(init);
|
||||
int resultCode = dlg->exec();
|
||||
|
||||
QPalette result = init;
|
||||
if (resultCode == QDialog::Accepted)
|
||||
result = dlg->pal();
|
||||
|
||||
if (ok)
|
||||
*ok = resultCode;
|
||||
|
||||
delete dlg;
|
||||
return result;
|
||||
}
|
||||
|
||||
#include "moc_paletteeditoradvanced.h"
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -1,86 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PALETTEEDITORADVANCED_H
|
||||
#define PALETTEEDITORADVANCED_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class PaletteEditorAdvanced;
|
||||
}
|
||||
|
||||
class ColorButton;
|
||||
|
||||
class PaletteEditorAdvanced : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PaletteEditorAdvanced(QWidget *parent = nullptr);
|
||||
~PaletteEditorAdvanced();
|
||||
|
||||
static QPalette getPalette(bool *ok, const QPalette &pal,
|
||||
QPalette::ColorRole backgroundRole = QPalette::Window,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
static QPalette buildEffect(QPalette::ColorGroup colorGroup, const QPalette &basePalette);
|
||||
|
||||
protected slots:
|
||||
void paletteSelected(int);
|
||||
|
||||
void onCentral(int);
|
||||
void onEffect(int);
|
||||
|
||||
void onChooseCentralColor();
|
||||
void onChooseEffectColor();
|
||||
|
||||
void onToggleBuildEffects(bool);
|
||||
void onToggleBuildInactive(bool);
|
||||
void onToggleBuildDisabled(bool);
|
||||
|
||||
protected:
|
||||
void buildEffect(QPalette::ColorGroup);
|
||||
void build(QPalette::ColorGroup);
|
||||
|
||||
private:
|
||||
void updateColorButtons();
|
||||
void setupBackgroundRole(QPalette::ColorRole);
|
||||
|
||||
QPalette pal() const;
|
||||
void setPal(const QPalette &);
|
||||
|
||||
static QPalette::ColorGroup groupFromIndex(int);
|
||||
static QPalette::ColorRole centralFromIndex(int);
|
||||
static QPalette::ColorRole effectFromIndex(int);
|
||||
QPalette editPalette;
|
||||
|
||||
Ui::PaletteEditorAdvanced *ui;
|
||||
|
||||
int selectedPalette;
|
||||
ColorButton *buttonCentral;
|
||||
ColorButton *buttonEffect;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PALETTEEDITORADVANCED_H
|
|
@ -1,395 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<comment>*********************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
*********************************************************************</comment>
|
||||
<class>PaletteEditorAdvanced</class>
|
||||
<widget class="QDialog" name="PaletteEditorAdvanced">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>239</width>
|
||||
<height>344</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Tune Palette</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="paletteComboLabel">
|
||||
<property name="text">
|
||||
<string>Select &Palette:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>paletteCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="paletteCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Active Palette</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Inactive Palette</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disabled Palette</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="autoGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBuildInactive">
|
||||
<property name="text">
|
||||
<string>Build inactive palette from active</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBuildDisabled">
|
||||
<property name="text">
|
||||
<string>Build disabled palette from active</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupCentral">
|
||||
<property name="title">
|
||||
<string>Central color &roles</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboCentral">
|
||||
<property name="toolTip">
|
||||
<string>Choose central color role</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Select a color role.</b><p>Available central roles are: <ul> <li>Window - general background color.</li> <li>WindowText - general foreground color. </li> <li>Base - used as background color for e.g. text entry widgets, usually white or another light color. </li> <li>Text - the foreground color used with Base. Usually this is the same as WindowText, in what case it must provide good contrast both with Window and Base. </li> <li>Button - general button background color, where buttons need a background different from Window, as in the Macintosh style. </li> <li>ButtonText - a foreground color used with the Button color. </li> <li>Highlight - a color to indicate a selected or highlighted item. </li> <li>HighlightedText - a text color that contrasts to Highlight. </li> <li>BrightText - a text color that is very different from WindowText and contrasts well with e.g. black. </li> </ul> </p></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Window</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>WindowText</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Base</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>AlternateBase</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ToolTipBase</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ToolTipText</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Text</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Button</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ButtonText</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>BrightText</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Highlight</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>HighlightedText</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Link</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>LinkVisited</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutCentral">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCentral">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Select Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupEffect">
|
||||
<property name="title">
|
||||
<string>3-D shadow &effects</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBuildEffect">
|
||||
<property name="toolTip">
|
||||
<string>Generate shadings</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Check to let 3D-effect colors be calculated from button-color.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Build &from button color</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboEffect">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Choose 3D-effect color role</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><b>Select a color role.</b><p>Available effect roles are: <ul> <li>Light - lighter than Button color. </li> <li>Midlight - between Button and Light. </li> <li>Mid - between Button and Dark. </li> <li>Dark - darker than Button. </li> <li>Shadow - a very dark color. </li> </ul></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Light</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Midlight</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mid</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dark</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Shadow</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutEffect">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelEffect">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Co&lor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PaletteEditorAdvanced</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>238</x>
|
||||
<y>384</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PaletteEditorAdvanced</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>306</x>
|
||||
<y>390</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>checkBuildEffect</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>comboEffect</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>82</x>
|
||||
<y>262</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>190</x>
|
||||
<y>262</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,58 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "previewframe.h"
|
||||
#include "previewwidget.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QPainter>
|
||||
#include <QPen>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
PreviewFrame::PreviewFrame(QWidget *parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
setMinimumSize(200, 200);
|
||||
setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
||||
setLineWidth(1);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
previewWidget = new PreviewWidget();
|
||||
vbox->addWidget(previewWidget);
|
||||
previewWidget->setAutoFillBackground(true);
|
||||
}
|
||||
|
||||
void PreviewFrame::setPreviewPalette(const QPalette &pal)
|
||||
{
|
||||
previewWidget->setPalette(pal);
|
||||
}
|
||||
|
||||
|
||||
void PreviewFrame::setPreviewVisible(bool visible)
|
||||
{
|
||||
previewWidget->parentWidget()->setVisible(visible);
|
||||
}
|
||||
|
||||
#include "moc_previewframe.h"
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -1,44 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PREVIEWFRAME_H
|
||||
#define PREVIEWFRAME_H
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class PreviewWidget;
|
||||
class PreviewFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreviewFrame(QWidget *parent = nullptr);
|
||||
void setPreviewPalette(const QPalette &pal);
|
||||
void setPreviewVisible(bool val);
|
||||
PreviewWidget *widget() const { return previewWidget; }
|
||||
private:
|
||||
PreviewWidget *previewWidget;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
|
@ -1,71 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "previewwidget.h"
|
||||
#include "ui_previewwidget.h"
|
||||
#include <QCloseEvent>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
PreviewWidget::PreviewWidget(QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::PreviewWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// install event filter on child widgets
|
||||
QList<QWidget *> l = findChildren<QWidget *>();
|
||||
foreach(QWidget *w, l) {
|
||||
w->installEventFilter(this);
|
||||
w->setFocusPolicy(Qt::NoFocus);
|
||||
}
|
||||
}
|
||||
|
||||
PreviewWidget::~PreviewWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool PreviewWidget::eventFilter(QObject *, QEvent *e)
|
||||
{
|
||||
switch (e->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
case QEvent::MouseButtonRelease:
|
||||
case QEvent::MouseButtonDblClick:
|
||||
case QEvent::MouseMove:
|
||||
case QEvent::KeyPress:
|
||||
case QEvent::KeyRelease:
|
||||
case QEvent::Enter:
|
||||
case QEvent::Leave:
|
||||
return true; // ignore;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PreviewWidget::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
#include "moc_previewwidget.h"
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -1,50 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PREVIEWWIDGET_H
|
||||
#define PREVIEWWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class PreviewWidget;
|
||||
}
|
||||
|
||||
|
||||
class PreviewWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreviewWidget(QWidget *parent = nullptr);
|
||||
~PreviewWidget();
|
||||
|
||||
bool eventFilter(QObject *, QEvent *);
|
||||
private:
|
||||
void closeEvent(QCloseEvent *);
|
||||
Ui::PreviewWidget *ui;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // PREVIEWWIDGET_H
|
|
@ -1,231 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<comment>*********************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
**
|
||||
** This file is part of the tools applications of the Katie Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
*********************************************************************</comment>
|
||||
<class>PreviewWidget</class>
|
||||
<widget class="QWidget" name="PreviewWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>398</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Preview Window</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="GroupBox1">
|
||||
<property name="title">
|
||||
<string>GroupBox</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="RadioButton1">
|
||||
<property name="text">
|
||||
<string>RadioButton1</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="RadioButton2">
|
||||
<property name="text">
|
||||
<string>RadioButton2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="RadioButton3">
|
||||
<property name="text">
|
||||
<string>RadioButton3</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="GroupBox2">
|
||||
<property name="title">
|
||||
<string>GroupBox2</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox1">
|
||||
<property name="text">
|
||||
<string>CheckBox1</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox2">
|
||||
<property name="text">
|
||||
<string>CheckBox2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="ProgressBar1">
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="LineEdit1">
|
||||
<property name="text">
|
||||
<string>LineEdit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="ComboBox1">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ComboBox</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="SpinBox1"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="PushButton1">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="ScrollBar1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="Slider1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textView">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32767</width>
|
||||
<height>55</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><p><a href="http://qt.nokia.com">http://qt.nokia.com</a></p>
|
||||
<p><a href="http://www.kde.org">http://www.kde.org</a></p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="Spacer2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,9 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Katie Config
|
||||
Comment=Configure Katie behavior, styles, fonts
|
||||
Exec=@KATIE_BINARIES_PATH@/qtconfig@KATIE_TOOLS_SUFFIX@@CMAKE_EXECUTABLE_SUFFIX@
|
||||
Icon=@KATIE_PIXMAPS_PATH@/qtconfig@KATIE_TOOLS_SUFFIX@.png
|
||||
Terminal=false
|
||||
Encoding=UTF-8
|
||||
Type=Application
|
||||
Categories=Qt;Settings;
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-08-20 20:18+0300\n"
|
||||
"POT-Creation-Date: 2023-09-01 04:23+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -1902,7 +1902,7 @@ msgstr ""
|
|||
msgid "Step &down"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/kernel/qwidget.cpp:4773
|
||||
#: src/gui/kernel/qwidget.cpp:4737
|
||||
msgid "*"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3270,23 +3270,23 @@ msgctxt "QShortcut"
|
|||
msgid "ShiftLock"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/kernel/qkeysequence.cpp:873 src/gui/kernel/qkeysequence.cpp:952
|
||||
#: src/gui/kernel/qkeysequence.cpp:873 src/gui/kernel/qkeysequence.cpp:959
|
||||
msgid "Ctrl"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/kernel/qkeysequence.cpp:874 src/gui/kernel/qkeysequence.cpp:956
|
||||
#: src/gui/kernel/qkeysequence.cpp:874 src/gui/kernel/qkeysequence.cpp:963
|
||||
msgid "Shift"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/kernel/qkeysequence.cpp:875 src/gui/kernel/qkeysequence.cpp:954
|
||||
#: src/gui/kernel/qkeysequence.cpp:875 src/gui/kernel/qkeysequence.cpp:961
|
||||
msgid "Alt"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/kernel/qkeysequence.cpp:876 src/gui/kernel/qkeysequence.cpp:950
|
||||
#: src/gui/kernel/qkeysequence.cpp:876 src/gui/kernel/qkeysequence.cpp:957
|
||||
msgid "Meta"
|
||||
msgstr ""
|
||||
|
||||
#: src/gui/kernel/qkeysequence.cpp:939
|
||||
#: src/gui/kernel/qkeysequence.cpp:946
|
||||
msgid "+"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-08-20 20:18+0300\n"
|
||||
"POT-Creation-Date: 2023-09-01 04:23+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -17,105 +17,6 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:57
|
||||
msgctxt "MainWindow"
|
||||
msgid ""
|
||||
"<p><b><font size+=2>Appearance</font></b></p><hr><p>Use this tab to "
|
||||
"customize the appearance of your Katie applications.</p><p>You can select "
|
||||
"the default GUI Style from the drop down list and customize the colors.</"
|
||||
"p><p>Any GUI Style plugins in your plugin path will automatically be added "
|
||||
"to the list of built-in Katie styles. (See the Library Paths tab for "
|
||||
"information on adding new plugin paths.)</p><p>When you choose 3-D Effects "
|
||||
"and Window Background colors, the Katie Configuration program will "
|
||||
"automatically generate a palette for you. To customize colors further, press "
|
||||
"the Tune Palette button to open the advanced palette editor.</p><p>The "
|
||||
"Preview Window shows what the selected Style and colors look like.</p>"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:74
|
||||
msgctxt "MainWindow"
|
||||
msgid ""
|
||||
"<p><b><font size+=2>Fonts</font></b></p><hr><p>Use this tab to select the "
|
||||
"default font for your Katie applications. The selected font is shown "
|
||||
"(initially as 'Sample Text') in the line edit below the Family, Style and "
|
||||
"Point Size drop down lists.</p><p>You can specify if Katie should try to "
|
||||
"embed fonts into its generated output when printing. If you enable font "
|
||||
"embedding, the resulting postscript will be more portable and will more "
|
||||
"accurately reflect the visual output on the screen; however the resulting "
|
||||
"postscript file size will be bigger.</p>"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:87
|
||||
msgctxt "MainWindow"
|
||||
msgid ""
|
||||
"<p><b><font size+=2>Interface</font></b></p><hr><p>Use this tab to customize "
|
||||
"the feel of your Katie applications.</p><p>If the Resolve Symlinks checkbox "
|
||||
"is checked Katie will follow symlinks when handling URLs. For example, in "
|
||||
"the file dialog, if this setting is turned on and /usr/tmp is a symlink to /"
|
||||
"var/tmp, entering the /usr/tmp directory will cause the file dialog to "
|
||||
"change to /var/tmp. With this setting turned off, symlinks are not resolved "
|
||||
"or followed.</p><p>The Global Strut setting is useful for people who require "
|
||||
"a minimum size for all widgets (e.g. when using a touch panel or for users "
|
||||
"who are visually impaired). Leaving the Global Strut width and height at 0 "
|
||||
"will disable the Global Strut feature.</p>"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:168
|
||||
msgid "Desktop Settings (Default)"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:174
|
||||
msgid "Choose style and palette based on your desktop settings."
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:189
|
||||
msgid "Unknown"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:311
|
||||
msgid "No changes to be saved."
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:317
|
||||
msgid "Saving changes..."
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:385
|
||||
msgid "Saved changes."
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:507
|
||||
msgid ""
|
||||
"<h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2015 The Qt Company Ltd."
|
||||
"<br/><br/>Copyright (C) 2016 Ivailo Monev"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:512 src/tools/qtconfig/mainwindow.cpp:513
|
||||
#: src/tools/qtconfig/mainwindow.cpp:520
|
||||
msgid "Katie Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:543
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/mainwindow.cpp:544
|
||||
msgid "Save changes to settings?"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/paletteeditoradvanced.cpp:34
|
||||
#: src/tools/qtconfig/paletteeditoradvanced.cpp:42
|
||||
msgid "Choose a color"
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/paletteeditoradvanced.cpp:36
|
||||
msgid "Choose a color for the selected central color role."
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qtconfig/paletteeditoradvanced.cpp:44
|
||||
msgid "Choose a color for the selected effect color role."
|
||||
msgstr ""
|
||||
|
||||
#: src/tools/qdbusviewer/qdbusviewermain.cpp:49
|
||||
msgctxt "QtDBusViewer"
|
||||
msgid "Katie D-Bus Viewer"
|
||||
|
|
Loading…
Add table
Reference in a new issue