author | drw <drw> | 2005-03-04 22:07:55 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-04 22:07:55 (UTC) |
commit | 206e91c510caba81f41704f11b097307d8daa6cb (patch) (side-by-side diff) | |
tree | 6170fc7285ca6d5e0cc3574df1768770277e1217 | |
parent | 9df83023cf5db974ba78b7b562be019791052f2f (diff) | |
download | opie-206e91c510caba81f41704f11b097307d8daa6cb.zip opie-206e91c510caba81f41704f11b097307d8daa6cb.tar.gz opie-206e91c510caba81f41704f11b097307d8daa6cb.tar.bz2 |
Scale icons appropriately
-rw-r--r-- | noncore/settings/networksettings/mainwindow/mainwindowimp.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp index 8feb7a5..f83e370 100644 --- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp @@ -1,58 +1,59 @@ #include "mainwindowimp.h" #include "addconnectionimp.h" #include "interfaceinformationimp.h" #include "interfacesetupimp.h" #include "interfaces.h" #include "module.h" /* OPIE */ #include <opie2/odebug.h> +#include <qpe/applnk.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/qlibrary.h> #include <qpe/resource.h> /* QT */ #include <qpushbutton.h> #include <qlistbox.h> #include <qlineedit.h> #include <qlistview.h> #include <qheader.h> #include <qlabel.h> #include <qtabwidget.h> // in order to disable the profiles tab #include <qmessagebox.h> #if QT_VERSION < 0x030000 #include <qlist.h> #else #include <qptrlist.h> #endif #include <qdir.h> #include <qfile.h> #include <qtextstream.h> #include <qregexp.h> /* STD */ #include <net/if.h> #include <sys/ioctl.h> #include <sys/socket.h> #define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" #define _PROCNETDEV "/proc/net/dev" MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) { connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); //remove tab with no function tabWidget->removePage( tab ); // Load connections. // /usr/local/kde/lib/libinterfaces.la loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); @@ -475,97 +476,99 @@ void MainWindowImp::informationClicked() { QWidget *moduleInformation = i->getModuleOwner()->information(i); if(moduleInformation != NULL) { QPEApplication::showWidget( moduleInformation ); #ifdef DEBUG odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl; #endif return; } } InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); QPEApplication::showWidget( information ); } /** * Update this interface. If no QListViewItem exists create one. * @param Interface* pointer to the interface that needs to be updated. */ void MainWindowImp::updateInterface(Interface *i) { if(!advancedUserMode) { if(i->getInterfaceName() == "lo") return; } QListViewItem *item = NULL; // Find the interface, making it if needed. if(items.find(i) == items.end()) { item = new QListViewItem(connectionList, "", "", ""); // See if you can't find a module owner for this interface QMap<Module*, QLibrary*>::Iterator it; for( it = libraries.begin(); it != libraries.end(); ++it ) { if(it.key()->isOwner(i)) i->setModuleOwner(it.key()); } items.insert(i, item); interfaceItems.insert(item, i); } else item = items[i]; // Update the icons and information #ifdef QWS - item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( i->getStatus() ? "up": "down" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + item->setPixmap(0, ( pic )); #else item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); #endif QString typeName = "lan"; if(i->getInterfaceName() == "lo") typeName = "lo"; if(i->getInterfaceName().contains("irda")) typeName = "irda"; if(i->getInterfaceName().contains("wlan")) typeName = "wlan"; if(i->getInterfaceName().contains("usb")) typeName = "usb"; if(!i->isAttached()) typeName = "connect_no"; // Actually try to use the Module if(i->getModuleOwner() != NULL) typeName = i->getModuleOwner()->getPixmapName(i); #ifdef QWS item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); #else item->setPixmap(1, (SmallIcon(typeName))); #endif item->setText(2, i->getHardwareName()); item->setText(3, QString("(%1)").arg(i->getInterfaceName())); item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); } void MainWindowImp::newProfileChanged(const QString& newText) { if(newText.length() > 0) newProfileButton->setEnabled(true); else newProfileButton->setEnabled(false); } /** * Adds a new profile to the list of profiles. * Don't add profiles that already exists. * Appends to the list and QStringList */ void MainWindowImp::addProfile() { QString newProfileName = newProfile->text(); if(profiles.grep(newProfileName).count() > 0) { |