-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 22 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 24 |
2 files changed, 33 insertions, 13 deletions
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 7dea591..36851b0 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp @@ -108,53 +108,56 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap label = new QLabel( tr( "Space Avail" ), this ); layout->addWidget( label, 1, 0 ); m_availSpace = new QLabel( this ); layout->addWidget( m_availSpace, 1, 1 ); // TODO - select correct destination slotDisplayAvailSpace( m_destination->currentText() ); } else { m_destination = 0l; m_availSpace = 0l; } QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); groupBox->layout()->setSpacing( 0 ); groupBox->layout()->setMargin( 4 ); QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); m_output = new QMultiLineEdit( groupBox ); m_output->setReadOnly( true ); groupBoxLayout->addWidget( m_output ); layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); - m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_btnStart = new QPushButton( pic, tr( "Start" ), this ); layout->addWidget( m_btnStart, 3, 0 ); connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); - m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); + pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); layout->addWidget( m_btnOptions, 3, 1 ); connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); // Display packages being acted upon in output widget for( int i = 0; i < m_numCommands; i++ ) { if ( !m_packages[ i ].isEmpty() ) { QString lineStr = tr( "Packages to " ); switch( m_command[ i ] ) { case OPackage::Install : lineStr.append( tr( "install" ) ); break; case OPackage::Remove : lineStr.append( tr( "remove" ) ); break; case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); break; case OPackage::Download : lineStr.append( tr( "download" ) ); break; default : break; }; lineStr.append( ":\n" ); @@ -196,92 +199,99 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination ) long div = 1024 / fs.f_bsize; if ( !mult ) mult = 1; if ( !div ) div = 1; long avail = fs.f_bavail * mult / div; space = tr( "%1 Kb" ).arg( avail ); } } // Display available space m_availSpace->setText( space ); } void InstallDlg::slotBtnStart() { QString btnText = m_btnStart->text(); if ( btnText == tr( "Abort" ) ) { // Prevent unexecuted commands from executing m_currCommand = 999; // Allow user to close dialog m_btnStart->setText( tr( "Close" ) ); - m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_btnStart->setIconSet( pic ); return; } else if ( btnText == tr( "Close" ) ) { // TODO - force reload of package data emit closeInstallDlg(); return; } // Start was clicked, start executing QString dest; if ( m_installFound ) { dest = m_destination->currentText(); m_destination->setEnabled( false ); } m_btnOptions->setEnabled( false ); if ( m_numCommands > 1 ) { m_btnStart->setText( tr( "Abort" ) ); - m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_btnStart->setIconSet( pic ); } else { m_btnStart->setEnabled( false ); } for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) { // Execute next command m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, this, SLOT(slotOutput(const QString &)), true ); } // All commands executed, allow user to close dialog m_btnStart->setEnabled( true ); m_btnStart->setText( tr( "Close" ) ); - m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_btnStart->setIconSet( pic ); m_btnOptions->setEnabled( true ); m_btnOptions->setText( tr( "Save output" ) ); - m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); + pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_btnOptions->setIconSet( pic ); } void InstallDlg::slotBtnOptions() { QString btnText = m_btnOptions->text(); if ( btnText == tr( "Options" ) ) { // Display configuration dialog (only options tab is enabled) m_packman->configureDlg( true ); return; } // Save output was clicked QMap<QString, QStringList> map; map.insert( tr( "All" ), QStringList() ); QStringList text; text << "text/*"; map.insert(tr( "Text" ), text ); text << "*"; map.insert( tr( "All" ), text ); QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); if( !filename.isEmpty() ) { diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 7ee2d74..5f60990 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp @@ -159,98 +159,106 @@ void OIpkgConfigDlg::reject() if ( m_configs ) delete m_configs; } void OIpkgConfigDlg::initServerWidget() { m_serverWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); QScrollView *sv = new QScrollView( m_serverWidget ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); m_serverList = new QListBox( container ); QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); - QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); layout->addWidget( btn, 1, 0 ); - m_serverEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); + pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); m_serverEditBtn->setEnabled( false ); QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); layout->addWidget( m_serverEditBtn, 1, 1 ); - m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); + pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); m_serverDeleteBtn->setEnabled( false ); QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); layout->addWidget( m_serverDeleteBtn, 1, 2 ); } void OIpkgConfigDlg::initDestinationWidget() { m_destWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); QScrollView *sv = new QScrollView( m_destWidget ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); m_destList = new QListBox( container ); QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); - QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); layout->addWidget( btn, 1, 0 ); - m_destEditBtn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), container ); + pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container ); m_destEditBtn->setEnabled( false ); QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); layout->addWidget( m_destEditBtn, 1, 1 ); - m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); + pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); m_destDeleteBtn->setEnabled( false ); QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); layout->addWidget( m_destDeleteBtn, 1, 2 ); } void OIpkgConfigDlg::initProxyWidget() { m_proxyWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); QScrollView *sv = new QScrollView( m_proxyWidget ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); // HTTP proxy server configuration QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); grpbox->layout()->setSpacing( 2 ); grpbox->layout()->setMargin( 4 ); @@ -320,49 +328,51 @@ void OIpkgConfigDlg::initOptionsWidget() m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); QLabel *l = new QLabel( tr( "Information level:" ), container ); QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); layout->addMultiCellWidget( l, 4, 4, 0, 1 ); m_optVerboseIpkg = new QComboBox( container ); QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); l = new QLabel( tr( "Package source lists directory:" ), container ); QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); layout->addMultiCellWidget( l, 6, 6, 0, 1 ); m_optSourceLists = new QLineEdit( container ); QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); layout->addWidget( m_optSourceLists, 7, 0 ); - QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, container ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + QPushButton *btn = new QPushButton( pic, QString::null, container ); btn->setMaximumWidth( btn->height() ); QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); layout->addWidget( btn, 7, 1 ); layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); } void OIpkgConfigDlg::initData() { // Read ipkg configuration (server/destination/proxy) information if ( m_ipkg && !m_installOptions ) { m_configs = m_ipkg->configItems(); if ( m_configs ) { for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) { OConfItem *config = configIt.current(); // Add configuration item to the appropriate dialog controls if ( config ) { switch ( config->type() ) |