mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32: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 <KFontDialog>
|
||||
#include <KGlobalSettings>
|
||||
#include <KLocale>
|
||||
#include <KComboBox>
|
||||
|
@ -27,6 +26,7 @@
|
|||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QFontDialog>
|
||||
|
||||
DolphinFontRequester::DolphinFontRequester(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
|
@ -87,11 +87,9 @@ QFont DolphinFontRequester::customFont() const
|
|||
|
||||
void DolphinFontRequester::openFontDialog()
|
||||
{
|
||||
QFont font = m_customFont;
|
||||
const int result = KFontDialog::getFont(font,
|
||||
KFontChooser::NoDisplayFlags,
|
||||
this);
|
||||
if (result == KFontDialog::Accepted) {
|
||||
bool result = false;
|
||||
QFont font = QFontDialog::getFont(&result, m_customFont, this);
|
||||
if (result) {
|
||||
m_customFont = font;
|
||||
m_modeCombo->setFont(m_customFont);
|
||||
emit changed();
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
#include <kcombobox.h>
|
||||
#include <kconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <kfontdialog.h>
|
||||
#include <kglobal.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <kiconloader.h>
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <kcolorscheme.h>
|
||||
#include <kcolorutils.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <kfontchooser.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <khbox.h>
|
||||
#include <ktabwidget.h>
|
||||
|
@ -359,7 +358,9 @@ KateSchemaConfigFontTab::KateSchemaConfigFontTab()
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -409,14 +410,14 @@ void KateSchemaConfigFontTab::schemaChanged( const QString &newSchema )
|
|||
}
|
||||
|
||||
m_fontchooser->disconnect ( this );
|
||||
m_fontchooser->setFont ( newFont );
|
||||
connect (m_fontchooser, SIGNAL (fontSelected(QFont)), this, SLOT (slotFontSelected(QFont)));
|
||||
m_fontchooser->setCurrentFont ( newFont );
|
||||
connect (m_fontchooser, SIGNAL (currentFontChanged(QFont)), this, SLOT (slotFontSelected(QFont)));
|
||||
}
|
||||
|
||||
void KateSchemaConfigFontTab::importSchema(KConfigGroup& config)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtGui/QFontDialog>
|
||||
|
||||
#include <kconfig.h>
|
||||
|
||||
|
@ -93,7 +94,7 @@ class KateSchemaConfigFontTab : public QWidget
|
|||
void changed();
|
||||
|
||||
private:
|
||||
class KFontChooser *m_fontchooser;
|
||||
QFontDialog *m_fontchooser;
|
||||
QMap<QString, QFont> m_fonts;
|
||||
QString m_currentSchema;
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <kapplication.h>
|
||||
#include <kcolorbutton.h>
|
||||
#include <kdebug.h>
|
||||
#include <kfontdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kdeprintdialog.h>
|
||||
#include <kurl.h>
|
||||
|
@ -45,6 +44,8 @@
|
|||
#include <klineedit.h>
|
||||
#include <knuminput.h>
|
||||
#include <kcombobox.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kdialog.h>
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QCheckBox>
|
||||
|
@ -52,7 +53,7 @@
|
|||
#include <QtGui/QPrintDialog>
|
||||
#include <QtGui/QPrinter>
|
||||
#include <QtGui/QApplication>
|
||||
|
||||
#include <QtGui/QFontDialog>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtCore/QStringList>
|
||||
|
@ -958,9 +959,11 @@ bool KatePrintHeaderFooter::useFooterBackground()
|
|||
|
||||
void KatePrintHeaderFooter::setHFFont()
|
||||
{
|
||||
QFont fnt( lFontPreview->font() );
|
||||
bool ok = false;
|
||||
const QString title = KDialog::makeStandardCaption(i18n("Select Font"), this);
|
||||
// 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
|
||||
lFontPreview->setFont( fnt );
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QFontDatabase>
|
||||
#include <QFontDialog>
|
||||
#include <qplatformdefs.h>
|
||||
|
||||
#include <KFontDialog>
|
||||
#include <KAcceleratorManager>
|
||||
#include <KApplication>
|
||||
#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() );
|
||||
|
||||
if (fontDiffFlags & KFontChooser::FontDiffSize) {
|
||||
_font.setPointSizeF( fnt.pointSizeF() );
|
||||
}
|
||||
if (fontDiffFlags & KFontChooser::FontDiffFamily) {
|
||||
if (_font.family() != fnt.family()) {
|
||||
QFontDatabase fdb;
|
||||
if (!isFixedOnly() || fdb.isFixedPitch(fnt.family(), fnt.styleName()))
|
||||
_font.setFamily( fnt.family() );
|
||||
}
|
||||
if (fontDiffFlags & KFontChooser::FontDiffStyle) {
|
||||
_font.setWeight( fnt.weight() );
|
||||
_font.setStyle( fnt.style() );
|
||||
_font.setUnderline( fnt.underline() );
|
||||
_font.setStyleName( fnt.styleName() );
|
||||
}
|
||||
_font.setPointSizeF( fnt.pointSizeF() );
|
||||
_font.setWeight( fnt.weight() );
|
||||
_font.setStyle( fnt.style() );
|
||||
_font.setUnderline( fnt.underline() );
|
||||
_font.setStyleName( fnt.styleName() );
|
||||
|
||||
setFont( _font, isFixedOnly() );
|
||||
}
|
||||
|
@ -744,14 +740,12 @@ void KFonts::save()
|
|||
|
||||
void KFonts::slotApplyFontDiff()
|
||||
{
|
||||
QFont font = QFont(fontUseList.first()->font());
|
||||
KFontChooser::FontDiffFlags fontDiffFlags = 0;
|
||||
int ret = KFontDialog::getFontDiff(font,fontDiffFlags,KFontChooser::NoDisplayFlags,this);
|
||||
|
||||
if (ret == KDialog::Accepted && fontDiffFlags)
|
||||
bool ret = false;
|
||||
QFont font = QFontDialog::getFont(&ret, fontUseList.first()->font(), this);
|
||||
if (ret)
|
||||
{
|
||||
for ( int i = 0; i < (int) fontUseList.count(); i++ )
|
||||
fontUseList.at( i )->applyFontDiff( font,fontDiffFlags );
|
||||
fontUseList.at( i )->applyFontDiff( font );
|
||||
emit changed(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
void readFont();
|
||||
void writeFont();
|
||||
void setDefault();
|
||||
void applyFontDiff(const QFont &fnt, int fontDiffFlags);
|
||||
void applyFontDiff(const QFont &fnt);
|
||||
|
||||
const QString& rcFile() { return _rcfile; }
|
||||
const QString& rcGroup() { return _rcgroup; }
|
||||
|
|
|
@ -70,7 +70,7 @@ KCMGreeter::KCMGreeter(QWidget* parent, const QVariantList& args)
|
|||
|
||||
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");
|
||||
foreach (const QString &style, QStyleFactory::keys()) {
|
||||
|
@ -136,7 +136,7 @@ KCMGreeter::~KCMGreeter()
|
|||
void KCMGreeter::load()
|
||||
{
|
||||
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 kgreetercolor = kgreetersettings.string("greeter/colorscheme");
|
||||
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)) {
|
||||
kgreeterfont = KGreeterDefaultFont();
|
||||
}
|
||||
fontchooser->setFont(kgreeterfont);
|
||||
fontchooser->setCurrentFont(kgreeterfont);
|
||||
|
||||
for (int i = 0; i < stylesbox->count(); i++) {
|
||||
if (stylesbox->itemData(i).toString().toLower() == style.toLower()) {
|
||||
|
|
|
@ -126,18 +126,20 @@
|
|||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KFontChooser</class>
|
||||
<extends></extends>
|
||||
<header>kfontdialog.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KUrlRequester</class>
|
||||
<extends></extends>
|
||||
|
|
|
@ -23,19 +23,18 @@
|
|||
// Standard
|
||||
#include <cmath>
|
||||
|
||||
// Qt
|
||||
// Katie
|
||||
#include <QtCore/QTextCodec>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QBrush>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/qstandarditemmodel.h>
|
||||
#include <QtCore/QTextCodec>
|
||||
#include <QtGui/qbrush.h>
|
||||
#include <QtGui/qbrush.h>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QStandardItemModel>
|
||||
#include <QtGui/QBrush>
|
||||
#include <QtGui/QFontDialog>
|
||||
|
||||
// KDE
|
||||
#include <kdeversion.h>
|
||||
#include <KCodecAction>
|
||||
#include <KFontDialog>
|
||||
#include <KIcon>
|
||||
#include <KIconDialog>
|
||||
#include <KFileDialog>
|
||||
|
@ -1210,25 +1209,22 @@ void EditProfileDialog::fontSelected(const QFont& aFont)
|
|||
}
|
||||
void EditProfileDialog::showFontDialog()
|
||||
{
|
||||
// TODO: no setter for it
|
||||
#if 0
|
||||
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("`~!@#$%^&*()_+-=[]\\{}|:\";'<>?,./");
|
||||
sampleText += QString("0123456789");
|
||||
sampleText += QString("\nThe Quick Brown Fox Jumps Over The Lazy Dog\n");
|
||||
sampleText += i18n("--- Type anything in this box ---");
|
||||
#endif
|
||||
|
||||
QFont currentFont = _ui->fontPreviewLabel->font();
|
||||
|
||||
QWeakPointer<KFontDialog> dialog = new KFontDialog(this, KFontChooser::FixedFontsOnly);
|
||||
dialog.data()->setCaption(i18n("Select Fixed Width Font"));
|
||||
dialog.data()->setFont(currentFont, true);
|
||||
|
||||
// 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)));
|
||||
|
||||
QWeakPointer<QFontDialog> dialog = new QFontDialog(currentFont, this);
|
||||
dialog.data()->setWindowTitle(KDialog::makeStandardCaption(i18n("Select Fixed Width Font"), this));
|
||||
dialog.data()->setOptions(QFontDialog::MonospacedFonts);
|
||||
connect(dialog.data(), SIGNAL(currentFontChanged(QFont)), this, SLOT(fontSelected(QFont)));
|
||||
if (dialog.data()->exec() == QDialog::Rejected)
|
||||
fontSelected(currentFont);
|
||||
delete dialog.data();
|
||||
|
|
|
@ -24,19 +24,18 @@
|
|||
|
||||
#include <QPushButton>
|
||||
#include <QRegExp>
|
||||
|
||||
#include <QFile>
|
||||
#include <QListWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <kfontdialog.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kcolorbutton.h>
|
||||
#include <knotification.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "StyleEngine.h"
|
||||
|
||||
#include "ui_LogFileSettings.h"
|
||||
|
||||
#include "moc_LogFile.cpp"
|
||||
|
||||
LogFile::LogFile(QWidget *parent, const QString& title, SharedSettings *workSheetSettings)
|
||||
|
|
Loading…
Add table
Reference in a new issue