summaryrefslogtreecommitdiff
authordrw <drw>2005-03-04 22:07:55 (UTC)
committer drw <drw>2005-03-04 22:07:55 (UTC)
commit206e91c510caba81f41704f11b097307d8daa6cb (patch) (unidiff)
tree6170fc7285ca6d5e0cc3574df1768770277e1217
parent9df83023cf5db974ba78b7b562be019791052f2f (diff)
downloadopie-206e91c510caba81f41704f11b097307d8daa6cb.zip
opie-206e91c510caba81f41704f11b097307d8daa6cb.tar.gz
opie-206e91c510caba81f41704f11b097307d8daa6cb.tar.bz2
Scale icons appropriately
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp5
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 @@
1 1
2#include "mainwindowimp.h" 2#include "mainwindowimp.h"
3#include "addconnectionimp.h" 3#include "addconnectionimp.h"
4#include "interfaceinformationimp.h" 4#include "interfaceinformationimp.h"
5#include "interfacesetupimp.h" 5#include "interfacesetupimp.h"
6#include "interfaces.h" 6#include "interfaces.h"
7#include "module.h" 7#include "module.h"
8 8
9/* OPIE */ 9/* OPIE */
10#include <opie2/odebug.h> 10#include <opie2/odebug.h>
11#include <qpe/applnk.h>
11#include <qpe/qcopenvelope_qws.h> 12#include <qpe/qcopenvelope_qws.h>
12#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
13#include <qpe/config.h> 14#include <qpe/config.h>
14#include <qpe/qlibrary.h> 15#include <qpe/qlibrary.h>
15#include <qpe/resource.h> 16#include <qpe/resource.h>
16 17
17/* QT */ 18/* QT */
18#include <qpushbutton.h> 19#include <qpushbutton.h>
19#include <qlistbox.h> 20#include <qlistbox.h>
20#include <qlineedit.h> 21#include <qlineedit.h>
21#include <qlistview.h> 22#include <qlistview.h>
22#include <qheader.h> 23#include <qheader.h>
23#include <qlabel.h> 24#include <qlabel.h>
24#include <qtabwidget.h> // in order to disable the profiles tab 25#include <qtabwidget.h> // in order to disable the profiles tab
25#include <qmessagebox.h> 26#include <qmessagebox.h>
26 27
27 28
28#if QT_VERSION < 0x030000 29#if QT_VERSION < 0x030000
29#include <qlist.h> 30#include <qlist.h>
30#else 31#else
31#include <qptrlist.h> 32#include <qptrlist.h>
32#endif 33#endif
33#include <qdir.h> 34#include <qdir.h>
34#include <qfile.h> 35#include <qfile.h>
35#include <qtextstream.h> 36#include <qtextstream.h>
36#include <qregexp.h> 37#include <qregexp.h>
37 38
38/* STD */ 39/* STD */
39#include <net/if.h> 40#include <net/if.h>
40#include <sys/ioctl.h> 41#include <sys/ioctl.h>
41#include <sys/socket.h> 42#include <sys/socket.h>
42 43
43#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 44#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
44#define _PROCNETDEV "/proc/net/dev" 45#define _PROCNETDEV "/proc/net/dev"
45 46
46MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME) 47MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME)
47{ 48{
48 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 49 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
49 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 50 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
50 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 51 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
51 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 52 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
52 53
53 //remove tab with no function 54 //remove tab with no function
54 tabWidget->removePage( tab ); 55 tabWidget->removePage( tab );
55 56
56 // Load connections. 57 // Load connections.
57 // /usr/local/kde/lib/libinterfaces.la 58 // /usr/local/kde/lib/libinterfaces.la
58 loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); 59 loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
@@ -475,97 +476,99 @@ void MainWindowImp::informationClicked()
475 { 476 {
476 QWidget *moduleInformation = i->getModuleOwner()->information(i); 477 QWidget *moduleInformation = i->getModuleOwner()->information(i);
477 if(moduleInformation != NULL) 478 if(moduleInformation != NULL)
478 { 479 {
479 QPEApplication::showWidget( moduleInformation ); 480 QPEApplication::showWidget( moduleInformation );
480#ifdef DEBUG 481#ifdef DEBUG
481 odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl; 482 odebug << "MainWindowImp::informationClicked:: Module owner has created, we showed." << oendl;
482#endif 483#endif
483 return; 484 return;
484 } 485 }
485 } 486 }
486 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); 487 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp);
487 QPEApplication::showWidget( information ); 488 QPEApplication::showWidget( information );
488} 489}
489 490
490/** 491/**
491 * Update this interface. If no QListViewItem exists create one. 492 * Update this interface. If no QListViewItem exists create one.
492 * @param Interface* pointer to the interface that needs to be updated. 493 * @param Interface* pointer to the interface that needs to be updated.
493 */ 494 */
494void MainWindowImp::updateInterface(Interface *i) 495void MainWindowImp::updateInterface(Interface *i)
495{ 496{
496 if(!advancedUserMode) 497 if(!advancedUserMode)
497 { 498 {
498 if(i->getInterfaceName() == "lo") 499 if(i->getInterfaceName() == "lo")
499 return; 500 return;
500 } 501 }
501 502
502 QListViewItem *item = NULL; 503 QListViewItem *item = NULL;
503 504
504 // Find the interface, making it if needed. 505 // Find the interface, making it if needed.
505 if(items.find(i) == items.end()) 506 if(items.find(i) == items.end())
506 { 507 {
507 item = new QListViewItem(connectionList, "", "", ""); 508 item = new QListViewItem(connectionList, "", "", "");
508 // See if you can't find a module owner for this interface 509 // See if you can't find a module owner for this interface
509 QMap<Module*, QLibrary*>::Iterator it; 510 QMap<Module*, QLibrary*>::Iterator it;
510 for( it = libraries.begin(); it != libraries.end(); ++it ) 511 for( it = libraries.begin(); it != libraries.end(); ++it )
511 { 512 {
512 if(it.key()->isOwner(i)) 513 if(it.key()->isOwner(i))
513 i->setModuleOwner(it.key()); 514 i->setModuleOwner(it.key());
514 } 515 }
515 items.insert(i, item); 516 items.insert(i, item);
516 interfaceItems.insert(item, i); 517 interfaceItems.insert(item, i);
517 } 518 }
518 else 519 else
519 item = items[i]; 520 item = items[i];
520 521
521 // Update the icons and information 522 // Update the icons and information
522#ifdef QWS 523#ifdef QWS
523 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 524 QPixmap pic;
525 pic.convertFromImage( Resource::loadImage( i->getStatus() ? "up": "down" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
526 item->setPixmap(0, ( pic ));
524#else 527#else
525 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); 528 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down")));
526#endif 529#endif
527 530
528 QString typeName = "lan"; 531 QString typeName = "lan";
529 if(i->getInterfaceName() == "lo") 532 if(i->getInterfaceName() == "lo")
530 typeName = "lo"; 533 typeName = "lo";
531 if(i->getInterfaceName().contains("irda")) 534 if(i->getInterfaceName().contains("irda"))
532 typeName = "irda"; 535 typeName = "irda";
533 if(i->getInterfaceName().contains("wlan")) 536 if(i->getInterfaceName().contains("wlan"))
534 typeName = "wlan"; 537 typeName = "wlan";
535 if(i->getInterfaceName().contains("usb")) 538 if(i->getInterfaceName().contains("usb"))
536 typeName = "usb"; 539 typeName = "usb";
537 540
538 if(!i->isAttached()) 541 if(!i->isAttached())
539 typeName = "connect_no"; 542 typeName = "connect_no";
540 // Actually try to use the Module 543 // Actually try to use the Module
541 if(i->getModuleOwner() != NULL) 544 if(i->getModuleOwner() != NULL)
542 typeName = i->getModuleOwner()->getPixmapName(i); 545 typeName = i->getModuleOwner()->getPixmapName(i);
543 546
544#ifdef QWS 547#ifdef QWS
545 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); 548 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName)));
546#else 549#else
547 item->setPixmap(1, (SmallIcon(typeName))); 550 item->setPixmap(1, (SmallIcon(typeName)));
548#endif 551#endif
549 item->setText(2, i->getHardwareName()); 552 item->setText(2, i->getHardwareName());
550 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 553 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
551 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 554 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
552} 555}
553 556
554void MainWindowImp::newProfileChanged(const QString& newText) 557void MainWindowImp::newProfileChanged(const QString& newText)
555{ 558{
556 if(newText.length() > 0) 559 if(newText.length() > 0)
557 newProfileButton->setEnabled(true); 560 newProfileButton->setEnabled(true);
558 else 561 else
559 newProfileButton->setEnabled(false); 562 newProfileButton->setEnabled(false);
560} 563}
561 564
562/** 565/**
563 * Adds a new profile to the list of profiles. 566 * Adds a new profile to the list of profiles.
564 * Don't add profiles that already exists. 567 * Don't add profiles that already exists.
565 * Appends to the list and QStringList 568 * Appends to the list and QStringList
566 */ 569 */
567void MainWindowImp::addProfile() 570void MainWindowImp::addProfile()
568{ 571{
569 QString newProfileName = newProfile->text(); 572 QString newProfileName = newProfile->text();
570 if(profiles.grep(newProfileName).count() > 0) 573 if(profiles.grep(newProfileName).count() > 0)
571 { 574 {