summaryrefslogtreecommitdiff
path: root/libopie2/opieui/ofontselector.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opieui/ofontselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/ofontselector.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index f93781f..b19c26e 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -17,118 +17,118 @@
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/* OPIE */
#include <opie2/ofontselector.h>
#include <qpe/fontdatabase.h>
/* QT */
#include <qlayout.h>
#include <qlistbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qmultilineedit.h>
-using namespace Opie;
-namespace Opie
-{
+namespace Opie {
+namespace Ui {
+namespace Private {
class OFontSelectorPrivate
{
public:
QListBox * m_font_family_list;
QComboBox * m_font_style_list;
QComboBox * m_font_size_list;
QMultiLineEdit *m_preview;
bool m_pointbug : 1;
FontDatabase m_fdb;
};
-};
-
-namespace
-{
-
class FontListItem : public QListBoxText
{
public:
FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText()
{
m_name = t;
m_styles = styles;
m_sizes = sizes;
QString str = t;
str [0] = str [0]. upper();
setText ( str );
}
QString family() const
{
return m_name;
}
const QStringList &styles() const
{
return m_styles;
}
const QValueList<int> &sizes() const
{
return m_sizes;
}
private:
QStringList m_styles;
QValueList<int> m_sizes;
QString m_name;
};
+}
+}
+}
+
+using namespace Opie::Ui;
+using namespace Opie::Ui::Private;
static int findItemCB( QComboBox *box, const QString &str )
{
for ( int i = 0; i < box->count(); i++ )
{
if ( box->text ( i ) == str )
return i;
}
return -1;
}
-}
/* static same as anon. namespace */
static int qt_version()
{
const char *qver = qVersion();
return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
}
/**
* Constructs the Selector object
* @param withpreview If a font preview should be given
* @param parent The parent of the Font Selector
* @param name The name of the object
* @param fl WidgetFlags
*/
OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
{
d = new OFontSelectorPrivate();
QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 );
gridLayout->setRowStretch( 4, 10 );
d->m_font_family_list = new QListBox( this, "FontListBox" );
gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 );
@@ -405,24 +405,25 @@ QFont OFontSelector::selectedFont()
{
return d->m_fdb. font ( fli->family(), \
fst >= 0 ? fli->styles() [fst] : QString::null, \
fsi >= 0 ? fli->sizes() [fsi] : 10, \
d->m_fdb. charSets ( fli->family()) [0] );
}
else
return QFont();
}
void OFontSelector::resizeEvent ( QResizeEvent *re )
{
if ( d->m_preview )
{
d->m_preview->setMinimumHeight ( 1 );
d->m_preview->setMaximumHeight ( 32767 );
}
QWidget::resizeEvent ( re );
if ( d->m_preview )
d->m_preview->setFixedHeight ( d->m_preview->height());
}
+