1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2008-2009 Licq developers 4 * 5 * Licq is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * Licq is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef FONTEDIT_H 21 #define FONTEDIT_H 22 23 #include "config.h" 24 25 #ifdef USE_KDE 26 #include <KDE/KFontRequester> 27 #define FONTEDIT_BASE KFontRequester 28 #else 29 #include <QWidget> 30 #define FONTEDIT_BASE QWidget 31 32 class QLineEdit; 33 #endif 34 35 namespace LicqQtGui 36 { 37 38 /** 39 * Input field for a font together with a browse button that will open a 40 * font selection dialog. 41 * Uses KFontRequester when building with KDE support. 42 */ 43 class FontEdit : public FONTEDIT_BASE 44 { 45 Q_OBJECT 46 47 public: 48 /** 49 * Constructor 50 * 51 * @parent Parent widget 52 */ 53 FontEdit(QWidget* parent = NULL); 54 55 /** 56 * Set font 57 * 58 * @param font New font 59 * @param onlyFixed Not used, only present to match setFont() in KFontRequester 60 */ 61 virtual void setFont(const QFont& font, bool onlyFixed = false); 62 63 #ifndef USE_KDE 64 /** 65 * Get font 66 * 67 * @return Currently selected font 68 */ 69 QFont font() const; 70 71 signals: 72 /** 73 * A new font was selected 74 * 75 * @param font New font 76 */ 77 void fontSelected(const QFont& font); 78 79 private slots: 80 /** 81 * Open a font dialog to browse for file 82 */ 83 void browse(); 84 85 private: 86 QLineEdit* myEditor; 87 #endif 88 }; 89 90 } // namespace LicqQtGui 91 92 #endif 93