summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2002-11-10 03:13:39 (UTC)
committer llornkcor <llornkcor>2002-11-10 03:13:39 (UTC)
commitea3334042e9625c0f67c9a7293a482849f60e4e2 (patch) (side-by-side diff)
treed9c36920818ed681a4a80d3e7af14524e66fa942 /noncore
parent7601c75b529d9ff205403a32206b9431845cfc91 (diff)
downloadopie-ea3334042e9625c0f67c9a7293a482849f60e4e2.zip
opie-ea3334042e9625c0f67c9a7293a482849f60e4e2.tar.gz
opie-ea3334042e9625c0f67c9a7293a482849f60e4e2.tar.bz2
use opie's FontDatabase so to be able to use freetype
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-write/mainwindow.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp
index ed95e83..bcafd16 100644
--- a/noncore/apps/opie-write/mainwindow.cpp
+++ b/noncore/apps/opie-write/mainwindow.cpp
@@ -2,48 +2,50 @@
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** Licensees holding valid Qtopia Developer license may use this
** file in accordance with the Qtopia Developer License Agreement
** provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE.
**
** email sales@trolltech.com for information about Qtopia License
** Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "mainwindow.h"
#include <qpe/fileselector.h>
#include <qpe/applnk.h>
#include <qpe/resource.h>
+#include <qpe/fontdatabase.h>
+
//#include "qspellchecker.h"
#include "qtextedit.h"
#include <qaction.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <qapplication.h>
#include <qfontdatabase.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qfileinfo.h>
#include <qfile.h>
#include <qfiledialog.h>
#include <qprinter.h>
#include <qpaintdevicemetrics.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qcolordialog.h>
#include <qpainter.h>
#include <qstyle.h>
class ButtonMenu : public QToolButton
{
Q_OBJECT
@@ -187,53 +189,55 @@ void MainWindow::setupActions()
a = new QAction( tr( "Copy" ), Resource::loadIconSet("copy"),
QString::null, 0, this, "editCopy" );
connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
a->addTo( tbEdit );
a->addTo( edit );
a = new QAction( tr( "Cut" ), Resource::loadIconSet("cut"),
QString::null, 0, this, "editCut" );
connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
connect( editor, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)) );
a->addTo( tbEdit );
a->addTo( edit );
a = new QAction( tr( "Paste" ), Resource::loadPixmap("paste"),
QString::null, 0, this, "editPaste" );
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
a->addTo( tbEdit );
a->addTo( edit );
tbFont = new QToolBar( this );
tbFont->setLabel( "Font Actions" );
tbFont->setHorizontalStretchable(TRUE);
comboFont = new QComboBox( FALSE, tbFont );
- QFontDatabase db;
+ FontDatabase db;
+ QStringList f= db.families();
comboFont->insertStringList( db.families() );
connect( comboFont, SIGNAL( activated( const QString & ) ),
this, SLOT( textFamily( const QString & ) ) );
comboFont->setCurrentItem( comboFont->listBox()->index( comboFont->listBox()->findItem( QApplication::font().family() ) ) );
+ comboFont->setMaximumWidth(90);
comboSize = new QComboBox( TRUE, tbFont );
QValueList<int> sizes = db.standardSizes();
QValueList<int>::Iterator it = sizes.begin();
for ( ; it != sizes.end(); ++it )
comboSize->insertItem( QString::number( *it ) );
connect( comboSize, SIGNAL( activated( const QString & ) ),
this, SLOT( textSize( const QString & ) ) );
comboSize->lineEdit()->setText( QString::number( QApplication::font().pointSize() ) );
comboSize->setFixedWidth( 38 );
tbStyle = new QToolBar( this );
tbStyle->setLabel( "Style Actions" );
actionTextBold = new QAction( tr( "Bold" ),
Resource::loadPixmap("bold"),
QString::null, CTRL + Key_B,
this, "textBold" );
connect( actionTextBold, SIGNAL( activated() ), this, SLOT( textBold() ) );
actionTextBold->addTo( tbStyle );
actionTextBold->setToggleAction( TRUE );
actionTextItalic = new QAction( tr( "Italic" ),
Resource::loadPixmap("italic"),
tr( "&Italic" ), CTRL + Key_I,
@@ -256,49 +260,49 @@ void MainWindow::setupActions()
alignMenu->insertItem( Resource::loadPixmap("center"), tr("Center"), AlignCenter );
alignMenu->insertItem( Resource::loadPixmap("right"), tr("Right"), AlignRight );
alignMenu->insertItem( Resource::loadPixmap("opie-write/justify"), tr("Full"), Qt3::AlignJustify );
connect( alignMenu, SIGNAL(activated(int)), this, SLOT(textAlign(int)) );
}
Qt3::QTextEdit *MainWindow::currentEditor() const
{
return editor;
}
void MainWindow::doConnections( Qt3::QTextEdit *e )
{
connect( e, SIGNAL( currentFontChanged( const QFont & ) ),
this, SLOT( fontChanged( const QFont & ) ) );
connect( e, SIGNAL( currentColorChanged( const QColor & ) ),
this, SLOT( colorChanged( const QColor & ) ) );
connect( e, SIGNAL( currentAlignmentChanged( int ) ),
this, SLOT( alignmentChanged( int ) ) );
}
void MainWindow::updateFontSizeCombo( const QFont &f )
{
comboSize->clear();
- QFontDatabase fdb;
+ FontDatabase fdb;
QValueList<int> sizes = fdb.pointSizes( f.family() );
QValueList<int>::Iterator it = sizes.begin();
for ( ; it != sizes.end(); ++it )
comboSize->insertItem( QString::number( *it ) );
}
void MainWindow::editUndo()
{
if ( !currentEditor() )
return;
currentEditor()->undo();
}
void MainWindow::editRedo()
{
if ( !currentEditor() )
return;
currentEditor()->redo();
}
void MainWindow::editCut()
{
if ( !currentEditor() )
return;