author | drw <drw> | 2005-03-03 20:10:24 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-03 20:10:24 (UTC) |
commit | 6c3a7220a587fbd5bee75d7b6c7376339286e25d (patch) (side-by-side diff) | |
tree | a304d17109586dbf1588e393824dbf907fff6ff5 | |
parent | 9c55e475ed3170488dd37ce8f36fa909397997bb (diff) | |
download | opie-6c3a7220a587fbd5bee75d7b6c7376339286e25d.zip opie-6c3a7220a587fbd5bee75d7b6c7376339286e25d.tar.gz opie-6c3a7220a587fbd5bee75d7b6c7376339286e25d.tar.bz2 |
Scale icons appropriately
-rw-r--r-- | core/settings/button/buttonsettings.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index d286369..779f6ef 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp @@ -12,39 +12,40 @@ .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <opie2/odevice.h> + +#include <qpe/applnk.h> + #include <qlayout.h> #include <qlabel.h> #include <qtimer.h> - -#include <opie2/odevice.h> - #include "buttonsettings.h" #include "buttonutils.h" #include "remapdlg.h" using namespace Opie::Core; struct buttoninfo { const ODeviceButton *m_button; int m_index; OQCopMessage m_pmsg; QLabel *m_picon; QLabel *m_plabel; OQCopMessage m_hmsg; QLabel *m_hicon; @@ -140,38 +141,41 @@ ButtonSettings::ButtonSettings ( QWidget *parent , const char *, bool, WFlags updateLabels ( ); QPEApplication::grabKeyboard ( ); } ButtonSettings::~ButtonSettings ( ) { QPEApplication::ungrabKeyboard ( ); } void ButtonSettings::updateLabels ( ) { for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { qCopInfo cip = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_pmsg ); - (*it)-> m_picon-> setPixmap ( cip. m_icon ); + QPixmap pic; + pic.convertFromImage( cip.m_icon.convertToImage().smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + (*it)-> m_picon-> setPixmap ( pic ); (*it)-> m_plabel-> setText ( cip. m_name ); qCopInfo cih = ButtonUtils::inst ( )-> messageToInfo ((*it)-> m_hmsg ); - (*it)-> m_hicon-> setPixmap ( cih. m_icon ); + pic.convertFromImage( cih.m_icon.convertToImage().smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + (*it)-> m_hicon-> setPixmap ( pic ); (*it)-> m_hlabel-> setText ( cih. m_name ); } } buttoninfo *ButtonSettings::buttonInfoForKeycode ( ushort key ) { for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { if ((*it)-> m_button-> keycode ( ) == key ) return *it; } return 0; } void ButtonSettings::keyPressEvent ( QKeyEvent *e ) { buttoninfo *bi = buttonInfoForKeycode ( e-> key ( )); |