mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +00:00
generic: replace KFontDialog and KFontChooser with QFontDialog
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8353b43b36
commit
71359006ac
11 changed files with 61 additions and 68 deletions
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include "dolphinfontrequester.h"
|
#include "dolphinfontrequester.h"
|
||||||
|
|
||||||
#include <KFontDialog>
|
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KComboBox>
|
#include <KComboBox>
|
||||||
|
@ -27,6 +26,7 @@
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QFontDialog>
|
||||||
|
|
||||||
DolphinFontRequester::DolphinFontRequester(QWidget* parent) :
|
DolphinFontRequester::DolphinFontRequester(QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
|
@ -87,11 +87,9 @@ QFont DolphinFontRequester::customFont() const
|
||||||
|
|
||||||
void DolphinFontRequester::openFontDialog()
|
void DolphinFontRequester::openFontDialog()
|
||||||
{
|
{
|
||||||
QFont font = m_customFont;
|
bool result = false;
|
||||||
const int result = KFontDialog::getFont(font,
|
QFont font = QFontDialog::getFont(&result, m_customFont, this);
|
||||||
KFontChooser::NoDisplayFlags,
|
if (result) {
|
||||||
this);
|
|
||||||
if (result == KFontDialog::Accepted) {
|
|
||||||
m_customFont = font;
|
m_customFont = font;
|
||||||
m_modeCombo->setFont(m_customFont);
|
m_modeCombo->setFont(m_customFont);
|
||||||
emit changed();
|
emit changed();
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
#include <kcombobox.h>
|
#include <kcombobox.h>
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kfontdialog.h>
|
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <kglobalsettings.h>
|
#include <kglobalsettings.h>
|
||||||
#include <kiconloader.h>
|
#include <kiconloader.h>
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <kcolorscheme.h>
|
#include <kcolorscheme.h>
|
||||||
#include <kcolorutils.h>
|
#include <kcolorutils.h>
|
||||||
#include <kinputdialog.h>
|
#include <kinputdialog.h>
|
||||||
#include <kfontchooser.h>
|
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
#include <khbox.h>
|
#include <khbox.h>
|
||||||
#include <ktabwidget.h>
|
#include <ktabwidget.h>
|
||||||
|
@ -359,7 +358,9 @@ KateSchemaConfigFontTab::KateSchemaConfigFontTab()
|
||||||
{
|
{
|
||||||
QGridLayout *grid = new QGridLayout( this );
|
QGridLayout *grid = new QGridLayout( this );
|
||||||
|
|
||||||
m_fontchooser = new KFontChooser ( this, KFontChooser::NoDisplayFlags );
|
m_fontchooser = new QFontDialog ( this );
|
||||||
|
m_fontchooser->setWindowFlags(Qt::Widget);
|
||||||
|
m_fontchooser->setOptions( QFontDialog::NoButtons );
|
||||||
grid->addWidget( m_fontchooser, 0, 0);
|
grid->addWidget( m_fontchooser, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,14 +410,14 @@ void KateSchemaConfigFontTab::schemaChanged( const QString &newSchema )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fontchooser->disconnect ( this );
|
m_fontchooser->disconnect ( this );
|
||||||
m_fontchooser->setFont ( newFont );
|
m_fontchooser->setCurrentFont ( newFont );
|
||||||
connect (m_fontchooser, SIGNAL (fontSelected(QFont)), this, SLOT (slotFontSelected(QFont)));
|
connect (m_fontchooser, SIGNAL (currentFontChanged(QFont)), this, SLOT (slotFontSelected(QFont)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KateSchemaConfigFontTab::importSchema(KConfigGroup& config)
|
void KateSchemaConfigFontTab::importSchema(KConfigGroup& config)
|
||||||
{
|
{
|
||||||
QFont f (KGlobalSettings::fixedFont());
|
QFont f (KGlobalSettings::fixedFont());
|
||||||
m_fontchooser->setFont(config.readEntry("Font", f));
|
m_fontchooser->setCurrentFont(config.readEntry("Font", f));
|
||||||
m_fonts[m_currentSchema] = m_fontchooser->font();
|
m_fonts[m_currentSchema] = m_fontchooser->font();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QtGui/QFont>
|
#include <QtGui/QFont>
|
||||||
|
#include <QtGui/QFontDialog>
|
||||||
|
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ class KateSchemaConfigFontTab : public QWidget
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class KFontChooser *m_fontchooser;
|
QFontDialog *m_fontchooser;
|
||||||
QMap<QString, QFont> m_fonts;
|
QMap<QString, QFont> m_fonts;
|
||||||
QString m_currentSchema;
|
QString m_currentSchema;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <kapplication.h>
|
#include <kapplication.h>
|
||||||
#include <kcolorbutton.h>
|
#include <kcolorbutton.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kfontdialog.h>
|
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kdeprintdialog.h>
|
#include <kdeprintdialog.h>
|
||||||
#include <kurl.h>
|
#include <kurl.h>
|
||||||
|
@ -45,6 +44,8 @@
|
||||||
#include <klineedit.h>
|
#include <klineedit.h>
|
||||||
#include <knuminput.h>
|
#include <knuminput.h>
|
||||||
#include <kcombobox.h>
|
#include <kcombobox.h>
|
||||||
|
#include <kconfiggroup.h>
|
||||||
|
#include <kdialog.h>
|
||||||
|
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
|
@ -52,7 +53,7 @@
|
||||||
#include <QtGui/QPrintDialog>
|
#include <QtGui/QPrintDialog>
|
||||||
#include <QtGui/QPrinter>
|
#include <QtGui/QPrinter>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QFontDialog>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QLayout>
|
#include <QtGui/QLayout>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
@ -958,9 +959,11 @@ bool KatePrintHeaderFooter::useFooterBackground()
|
||||||
|
|
||||||
void KatePrintHeaderFooter::setHFFont()
|
void KatePrintHeaderFooter::setHFFont()
|
||||||
{
|
{
|
||||||
QFont fnt( lFontPreview->font() );
|
bool ok = false;
|
||||||
|
const QString title = KDialog::makeStandardCaption(i18n("Select Font"), this);
|
||||||
// display a font dialog
|
// display a font dialog
|
||||||
if ( KFontDialog::getFont( fnt, KFontChooser::NoDisplayFlags, this ) == KFontDialog::Accepted )
|
QFont fnt = QFontDialog::getFont( &ok, lFontPreview->font(), this, title );
|
||||||
|
if ( ok )
|
||||||
{
|
{
|
||||||
// set preview
|
// set preview
|
||||||
lFontPreview->setFont( fnt );
|
lFontPreview->setFont( fnt );
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
#include <QFontDialog>
|
||||||
#include <qplatformdefs.h>
|
#include <qplatformdefs.h>
|
||||||
|
|
||||||
#include <KFontDialog>
|
|
||||||
#include <KAcceleratorManager>
|
#include <KAcceleratorManager>
|
||||||
#include <KApplication>
|
#include <KApplication>
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
@ -136,24 +136,20 @@ void FontUseItem::writeFont()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontUseItem::applyFontDiff( const QFont &fnt, int fontDiffFlags )
|
void FontUseItem::applyFontDiff( const QFont &fnt )
|
||||||
{
|
{
|
||||||
QFont _font( font() );
|
QFont _font( font() );
|
||||||
|
|
||||||
if (fontDiffFlags & KFontChooser::FontDiffSize) {
|
if (_font.family() != fnt.family()) {
|
||||||
_font.setPointSizeF( fnt.pointSizeF() );
|
|
||||||
}
|
|
||||||
if (fontDiffFlags & KFontChooser::FontDiffFamily) {
|
|
||||||
QFontDatabase fdb;
|
QFontDatabase fdb;
|
||||||
if (!isFixedOnly() || fdb.isFixedPitch(fnt.family(), fnt.styleName()))
|
if (!isFixedOnly() || fdb.isFixedPitch(fnt.family(), fnt.styleName()))
|
||||||
_font.setFamily( fnt.family() );
|
_font.setFamily( fnt.family() );
|
||||||
}
|
}
|
||||||
if (fontDiffFlags & KFontChooser::FontDiffStyle) {
|
_font.setPointSizeF( fnt.pointSizeF() );
|
||||||
_font.setWeight( fnt.weight() );
|
_font.setWeight( fnt.weight() );
|
||||||
_font.setStyle( fnt.style() );
|
_font.setStyle( fnt.style() );
|
||||||
_font.setUnderline( fnt.underline() );
|
_font.setUnderline( fnt.underline() );
|
||||||
_font.setStyleName( fnt.styleName() );
|
_font.setStyleName( fnt.styleName() );
|
||||||
}
|
|
||||||
|
|
||||||
setFont( _font, isFixedOnly() );
|
setFont( _font, isFixedOnly() );
|
||||||
}
|
}
|
||||||
|
@ -744,14 +740,12 @@ void KFonts::save()
|
||||||
|
|
||||||
void KFonts::slotApplyFontDiff()
|
void KFonts::slotApplyFontDiff()
|
||||||
{
|
{
|
||||||
QFont font = QFont(fontUseList.first()->font());
|
bool ret = false;
|
||||||
KFontChooser::FontDiffFlags fontDiffFlags = 0;
|
QFont font = QFontDialog::getFont(&ret, fontUseList.first()->font(), this);
|
||||||
int ret = KFontDialog::getFontDiff(font,fontDiffFlags,KFontChooser::NoDisplayFlags,this);
|
if (ret)
|
||||||
|
|
||||||
if (ret == KDialog::Accepted && fontDiffFlags)
|
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < (int) fontUseList.count(); i++ )
|
for ( int i = 0; i < (int) fontUseList.count(); i++ )
|
||||||
fontUseList.at( i )->applyFontDiff( font,fontDiffFlags );
|
fontUseList.at( i )->applyFontDiff( font );
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
void readFont();
|
void readFont();
|
||||||
void writeFont();
|
void writeFont();
|
||||||
void setDefault();
|
void setDefault();
|
||||||
void applyFontDiff(const QFont &fnt, int fontDiffFlags);
|
void applyFontDiff(const QFont &fnt);
|
||||||
|
|
||||||
const QString& rcFile() { return _rcfile; }
|
const QString& rcFile() { return _rcfile; }
|
||||||
const QString& rcGroup() { return _rcgroup; }
|
const QString& rcGroup() { return _rcgroup; }
|
||||||
|
|
|
@ -70,7 +70,7 @@ KCMGreeter::KCMGreeter(QWidget* parent, const QVariantList& args)
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
connect(fontchooser, SIGNAL(fontSelected(QFont)), this, SLOT(slotFontChanged(QFont)));
|
connect(fontchooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(slotFontChanged(QFont)));
|
||||||
|
|
||||||
const QStringList kthemercs = KGlobal::dirs()->findAllResources("data", "kstyle/themes/*.themerc");
|
const QStringList kthemercs = KGlobal::dirs()->findAllResources("data", "kstyle/themes/*.themerc");
|
||||||
foreach (const QString &style, QStyleFactory::keys()) {
|
foreach (const QString &style, QStyleFactory::keys()) {
|
||||||
|
@ -136,7 +136,7 @@ KCMGreeter::~KCMGreeter()
|
||||||
void KCMGreeter::load()
|
void KCMGreeter::load()
|
||||||
{
|
{
|
||||||
QSettings kgreetersettings(KDE_SYSCONFDIR "/lightdm/lightdm-kgreeter-greeter.conf");
|
QSettings kgreetersettings(KDE_SYSCONFDIR "/lightdm/lightdm-kgreeter-greeter.conf");
|
||||||
const QString kgreeterfontstring = kgreetersettings.string("greeter/font");
|
const QString kgreeterfontstring = kgreetersettings.string("greeter/font", KGreeterDefaultFont().toString());
|
||||||
const QString kgreeterstyle = kgreetersettings.string("greeter/style", KGreeterDefaultStyle());
|
const QString kgreeterstyle = kgreetersettings.string("greeter/style", KGreeterDefaultStyle());
|
||||||
const QString kgreetercolor = kgreetersettings.string("greeter/colorscheme");
|
const QString kgreetercolor = kgreetersettings.string("greeter/colorscheme");
|
||||||
const QString kgreetercursortheme = kgreetersettings.string("greeter/cursortheme", KGreeterDefaultCursorTheme());
|
const QString kgreetercursortheme = kgreetersettings.string("greeter/cursortheme", KGreeterDefaultCursorTheme());
|
||||||
|
@ -273,7 +273,7 @@ void KCMGreeter::loadSettings(const QString &font, const QString &style, const Q
|
||||||
if (!kgreeterfont.fromString(font)) {
|
if (!kgreeterfont.fromString(font)) {
|
||||||
kgreeterfont = KGreeterDefaultFont();
|
kgreeterfont = KGreeterDefaultFont();
|
||||||
}
|
}
|
||||||
fontchooser->setFont(kgreeterfont);
|
fontchooser->setCurrentFont(kgreeterfont);
|
||||||
|
|
||||||
for (int i = 0; i < stylesbox->count(); i++) {
|
for (int i = 0; i < stylesbox->count(); i++) {
|
||||||
if (stylesbox->itemData(i).toString().toLower() == style.toLower()) {
|
if (stylesbox->itemData(i).toString().toLower() == style.toLower()) {
|
||||||
|
|
|
@ -126,18 +126,20 @@
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="0" column="0" colspan="3">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="KFontChooser" name="fontchooser"/>
|
<widget class="QFontDialog" name="fontchooser">
|
||||||
|
<property name="windowFlags">
|
||||||
|
<set>Qt::Widget</set>
|
||||||
|
</property>
|
||||||
|
<property name="options">
|
||||||
|
<set>QFontDialog::NoButtons</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
|
||||||
<class>KFontChooser</class>
|
|
||||||
<extends></extends>
|
|
||||||
<header>kfontdialog.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>KUrlRequester</class>
|
<class>KUrlRequester</class>
|
||||||
<extends></extends>
|
<extends></extends>
|
||||||
|
|
|
@ -23,19 +23,18 @@
|
||||||
// Standard
|
// Standard
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
// Qt
|
// Katie
|
||||||
|
#include <QtCore/QTextCodec>
|
||||||
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QBrush>
|
#include <QtGui/QBrush>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/qstandarditemmodel.h>
|
#include <QtGui/QStandardItemModel>
|
||||||
#include <QtCore/QTextCodec>
|
#include <QtGui/QBrush>
|
||||||
#include <QtGui/qbrush.h>
|
#include <QtGui/QFontDialog>
|
||||||
#include <QtGui/qbrush.h>
|
|
||||||
#include <QtCore/QTimer>
|
|
||||||
|
|
||||||
// KDE
|
// KDE
|
||||||
#include <kdeversion.h>
|
#include <kdeversion.h>
|
||||||
#include <KCodecAction>
|
#include <KCodecAction>
|
||||||
#include <KFontDialog>
|
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KIconDialog>
|
#include <KIconDialog>
|
||||||
#include <KFileDialog>
|
#include <KFileDialog>
|
||||||
|
@ -1210,25 +1209,22 @@ void EditProfileDialog::fontSelected(const QFont& aFont)
|
||||||
}
|
}
|
||||||
void EditProfileDialog::showFontDialog()
|
void EditProfileDialog::showFontDialog()
|
||||||
{
|
{
|
||||||
|
// TODO: no setter for it
|
||||||
|
#if 0
|
||||||
QString sampleText = QString("ell 'lL', one '1', little eye 'i', big eye");
|
QString sampleText = QString("ell 'lL', one '1', little eye 'i', big eye");
|
||||||
sampleText += QString("'I', lL1iI, Zero '0', little oh 'o', big oh 'O', 0oO");
|
sampleText += QString("'I', lL1iI, Zero '0', little oh 'o', big oh 'O', 0oO");
|
||||||
sampleText += QString("`~!@#$%^&*()_+-=[]\\{}|:\";'<>?,./");
|
sampleText += QString("`~!@#$%^&*()_+-=[]\\{}|:\";'<>?,./");
|
||||||
sampleText += QString("0123456789");
|
sampleText += QString("0123456789");
|
||||||
sampleText += QString("\nThe Quick Brown Fox Jumps Over The Lazy Dog\n");
|
sampleText += QString("\nThe Quick Brown Fox Jumps Over The Lazy Dog\n");
|
||||||
sampleText += i18n("--- Type anything in this box ---");
|
sampleText += i18n("--- Type anything in this box ---");
|
||||||
|
#endif
|
||||||
|
|
||||||
QFont currentFont = _ui->fontPreviewLabel->font();
|
QFont currentFont = _ui->fontPreviewLabel->font();
|
||||||
|
|
||||||
QWeakPointer<KFontDialog> dialog = new KFontDialog(this, KFontChooser::FixedFontsOnly);
|
QWeakPointer<QFontDialog> dialog = new QFontDialog(currentFont, this);
|
||||||
dialog.data()->setCaption(i18n("Select Fixed Width Font"));
|
dialog.data()->setWindowTitle(KDialog::makeStandardCaption(i18n("Select Fixed Width Font"), this));
|
||||||
dialog.data()->setFont(currentFont, true);
|
dialog.data()->setOptions(QFontDialog::MonospacedFonts);
|
||||||
|
connect(dialog.data(), SIGNAL(currentFontChanged(QFont)), this, SLOT(fontSelected(QFont)));
|
||||||
// Use text more fitting to show font differences in a terminal
|
|
||||||
QList<KFontChooser*> chooserList = dialog.data()->findChildren<KFontChooser*>();
|
|
||||||
if (!chooserList.isEmpty())
|
|
||||||
chooserList.at(0)->setSampleText(sampleText);
|
|
||||||
|
|
||||||
connect(dialog.data(), SIGNAL(fontSelected(QFont)), this, SLOT(fontSelected(QFont)));
|
|
||||||
|
|
||||||
if (dialog.data()->exec() == QDialog::Rejected)
|
if (dialog.data()->exec() == QDialog::Rejected)
|
||||||
fontSelected(currentFont);
|
fontSelected(currentFont);
|
||||||
delete dialog.data();
|
delete dialog.data();
|
||||||
|
|
|
@ -24,19 +24,18 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <kfontdialog.h>
|
|
||||||
#include <kdebug.h>
|
#include <kdialog.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kcolorbutton.h>
|
#include <kcolorbutton.h>
|
||||||
#include <knotification.h>
|
#include <knotification.h>
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include "StyleEngine.h"
|
#include "StyleEngine.h"
|
||||||
|
|
||||||
#include "ui_LogFileSettings.h"
|
#include "ui_LogFileSettings.h"
|
||||||
|
|
||||||
#include "moc_LogFile.cpp"
|
#include "moc_LogFile.cpp"
|
||||||
|
|
||||||
LogFile::LogFile(QWidget *parent, const QString& title, SharedSettings *workSheetSettings)
|
LogFile::LogFile(QWidget *parent, const QString& title, SharedSettings *workSheetSettings)
|
||||||
|
|
Loading…
Add table
Reference in a new issue