author | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
commit | 0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff) | |
tree | 503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /libopie/ofontselector.cpp | |
parent | a0981652d61776d70f25980f035748b21339e946 (diff) | |
download | opie-0d59c780513da78033f4d9040475dee9db0256d4.zip opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2 |
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you
can check the diff (but it had compiled and run here)
-rw-r--r-- | libopie/ofontselector.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp index 7e07008..87b7869 100644 --- a/libopie/ofontselector.cpp +++ b/libopie/ofontselector.cpp | |||
@@ -74,111 +74,111 @@ public: | |||
74 | } | 74 | } |
75 | 75 | ||
76 | const QValueList<int> &sizes ( ) const | 76 | const QValueList<int> &sizes ( ) const |
77 | { | 77 | { |
78 | return m_sizes; | 78 | return m_sizes; |
79 | } | 79 | } |
80 | 80 | ||
81 | private: | 81 | private: |
82 | QStringList m_styles; | 82 | QStringList m_styles; |
83 | QValueList<int> m_sizes; | 83 | QValueList<int> m_sizes; |
84 | QString m_name; | 84 | QString m_name; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | 87 | ||
88 | static int findItemCB ( QComboBox *box, const QString &str ) | 88 | static int findItemCB ( QComboBox *box, const QString &str ) |
89 | { | 89 | { |
90 | for ( int i = 0; i < box-> count ( ); i++ ) { | 90 | for ( int i = 0; i < box-> count ( ); i++ ) { |
91 | if ( box-> text ( i ) == str ) | 91 | if ( box-> text ( i ) == str ) |
92 | return i; | 92 | return i; |
93 | } | 93 | } |
94 | return -1; | 94 | return -1; |
95 | } | 95 | } |
96 | 96 | ||
97 | } | 97 | } |
98 | /* static same as anon. namespace */ | 98 | /* static same as anon. namespace */ |
99 | static int qt_version ( ) | 99 | static int qt_version ( ) |
100 | { | 100 | { |
101 | const char *qver = qVersion ( ); | 101 | const char *qver = qVersion ( ); |
102 | 102 | ||
103 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 103 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Constructs the Selector object | 107 | * Constructs the Selector object |
108 | * @param withpreview If a font preview should be given | 108 | * @param withpreview If a font preview should be given |
109 | * @param parent The parent of the Font Selector | 109 | * @param parent The parent of the Font Selector |
110 | * @param name The name of the object | 110 | * @param name The name of the object |
111 | * @param fl WidgetFlags | 111 | * @param fl WidgetFlags |
112 | */ | 112 | */ |
113 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 113 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
114 | { | 114 | { |
115 | d = new OFontSelectorPrivate ( ); | 115 | d = new OFontSelectorPrivate ( ); |
116 | 116 | ||
117 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); | 117 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); |
118 | gridLayout->setRowStretch ( 4, 10 ); | 118 | gridLayout->setRowStretch ( 4, 10 ); |
119 | 119 | ||
120 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); | 120 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); |
121 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); | 121 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); |
122 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | 122 | connect( d-> m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); |
123 | 123 | ||
124 | QLabel *label = new QLabel( tr( "Style" ), this ); | 124 | QLabel *label = new QLabel( tr( "Style" ), this ); |
125 | gridLayout->addWidget( label, 0, 1 ); | 125 | gridLayout->addWidget( label, 0, 1 ); |
126 | 126 | ||
127 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); | 127 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); |
128 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | 128 | connect( d-> m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); |
129 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); | 129 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); |
130 | 130 | ||
131 | label = new QLabel( tr( "Size" ), this ); | 131 | label = new QLabel( tr( "Size" ), this ); |
132 | gridLayout->addWidget( label, 2, 1 ); | 132 | gridLayout->addWidget( label, 2, 1 ); |
133 | 133 | ||
134 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); | 134 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); |
135 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), | 135 | connect( d-> m_font_size_list, SIGNAL( activated(int) ), |
136 | this, SLOT( fontSizeClicked( int ) ) ); | 136 | this, SLOT( fontSizeClicked(int) ) ); |
137 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); | 137 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); |
138 | 138 | ||
139 | d-> m_pointbug = ( qt_version ( ) <= 233 ); | 139 | d-> m_pointbug = ( qt_version ( ) <= 233 ); |
140 | 140 | ||
141 | if ( withpreview ) { | 141 | if ( withpreview ) { |
142 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); | 142 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); |
143 | d-> m_preview-> setAlignment ( AlignCenter ); | 143 | d-> m_preview-> setAlignment ( AlignCenter ); |
144 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); | 144 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); |
145 | d-> m_preview-> setMargin ( 3 ); | 145 | d-> m_preview-> setMargin ( 3 ); |
146 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | 146 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); |
147 | gridLayout-> addRowSpacing ( 5, 4 ); | 147 | gridLayout-> addRowSpacing ( 5, 4 ); |
148 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); | 148 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); |
149 | gridLayout-> setRowStretch ( 6, 5 ); | 149 | gridLayout-> setRowStretch ( 6, 5 ); |
150 | } | 150 | } |
151 | else | 151 | else |
152 | d-> m_preview = 0; | 152 | d-> m_preview = 0; |
153 | 153 | ||
154 | loadFonts ( d-> m_font_family_list ); | 154 | loadFonts ( d-> m_font_family_list ); |
155 | } | 155 | } |
156 | 156 | ||
157 | OFontSelector::~OFontSelector ( ) | 157 | OFontSelector::~OFontSelector ( ) |
158 | { | 158 | { |
159 | delete d; | 159 | delete d; |
160 | } | 160 | } |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * This methods tries to set the font | 163 | * This methods tries to set the font |
164 | * @param f The wishes font | 164 | * @param f The wishes font |
165 | * @return success or failure | 165 | * @return success or failure |
166 | */ | 166 | */ |
167 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 167 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
168 | { | 168 | { |
169 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | 169 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | /** | 173 | /** |
174 | * This is an overloaded method @see setSelectedFont | 174 | * This is an overloaded method @see setSelectedFont |
175 | * @param familyStr The family of the font | 175 | * @param familyStr The family of the font |
176 | * @param styleStr The style of the font | 176 | * @param styleStr The style of the font |
177 | * @param sizeVal The size of font | 177 | * @param sizeVal The size of font |
178 | * @param charset The charset to be used. Will be deprecated by QT3 | 178 | * @param charset The charset to be used. Will be deprecated by QT3 |
179 | */ | 179 | */ |
180 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 180 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
181 | { | 181 | { |
182 | QString sizeStr = QString::number ( sizeVal ); | 182 | QString sizeStr = QString::number ( sizeVal ); |
183 | 183 | ||
184 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); | 184 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); |