Permalink
Browse files

Add a new quick-launch button for starting up applications. This repl…

…aces using the icon as a button as well.

Also clean up some old commented out code in the process manager.
  • Loading branch information...
1 parent f981222 commit 80faf743cfc922f249d4daeb371d043d181f34d8 Ken Moore committed Aug 22, 2013
@@ -153,15 +153,15 @@ void MainUI::initializeInstalledTab(){
actionMenu->addAction( QIcon(":icons/dialog-cancel.png"), tr("Cancel Actions"), this, SLOT(slotActionCancel()) );
//Setup the binary menu for installed applications
appBinMenu = new QMenu();
- ui->tool_install_icon->setMenu(appBinMenu);
+ ui->tool_install_startApp->setMenu(appBinMenu);
connect(appBinMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotStartApp(QAction*)) );
- //Now setup the action button
- ui->tool_install_performaction->setMenu(actionMenu);
- ui->tool_install_performaction->setPopupMode(QToolButton::InstantPopup);
- //Now setup any defaults for the installed tab
- ui->tool_install_gotobrowserpage->setEnabled(FALSE); //disable it until the browser is ready
- ui->tree_install_apps->setIconSize(QSize(22,22));
- slotRefreshInstallTab();
+ //Now setup the action button
+ ui->tool_install_performaction->setMenu(actionMenu);
+ ui->tool_install_performaction->setPopupMode(QToolButton::InstantPopup);
+ //Now setup any defaults for the installed tab
+ ui->tool_install_gotobrowserpage->setEnabled(FALSE); //disable it until the browser is ready
+ ui->tree_install_apps->setIconSize(QSize(22,22));
+ slotRefreshInstallTab();
}
void MainUI::formatInstalledItemDisplay(QTreeWidgetItem *item){
@@ -491,7 +491,7 @@ void MainUI::slotUpdateSelectedPBI(bool statusonly){
else{ shortcuts = tr("None"); }
//Now display that info on the UI
ui->label_install_app->setText(vals[0]);
- ui->tool_install_icon->setIcon( QIcon(vals[1]) );
+ ui->label_install_icon->setPixmap( QPixmap(vals[1]) );
if(vals[3].isEmpty()){
ui->label_install_author->setText(vals[2]);
ui->label_install_author->setToolTip("");
@@ -510,6 +510,7 @@ void MainUI::slotUpdateSelectedPBI(bool statusonly){
ui->tool_install_cancel->setVisible(TRUE);
ui->tool_install_remove->setVisible(FALSE);
ui->tool_install_update->setVisible(FALSE);
+ ui->tool_install_startApp->setVisible(FALSE);
}else{
//Nothing pending
ui->tool_install_cancel->setVisible(FALSE);
@@ -525,9 +526,21 @@ void MainUI::slotUpdateSelectedPBI(bool statusonly){
if(rootonly){ ui->tool_install_update->setIcon(QIcon(":icons/app_upgrade_small-root.png")); }
else{ ui->tool_install_update->setIcon(QIcon(":icons/app_upgrade_small.png")); }
}
+ //Start Application binaries
+ QStringList bins = PBI->pbiBinList(appID);
+ appBinMenu->clear();
+ for(int i=0; i<bins.length(); i++){
+ QAction *act = new QAction(this);
+ act->setText(bins[i].section("::::",0,0)); //set name
+ act->setWhatsThis(bins[i].section("::::",1,10)); //set command string
+ appBinMenu->addAction(act);
+ }
+ if(appBinMenu->isEmpty()){ ui->tool_install_startApp->setVisible(FALSE); }
+ else{ ui->tool_install_startApp->setVisible(TRUE); }
}else{
ui->tool_install_remove->setVisible(FALSE);
ui->tool_install_update->setVisible(FALSE);
+ ui->tool_install_startApp->setVisible(FALSE);
}
}
}
@@ -563,22 +576,6 @@ void MainUI::slotUpdateSelectedPBI(bool statusonly){
ui->progress_install_DL->setVisible(FALSE);
ui->label_install_DL->setVisible(FALSE);
}
- if(!statusonly){
- //Get the application binaries and set the icon to start them
- QStringList bins = PBI->pbiBinList(appID);
- appBinMenu->clear();
- if(bins.isEmpty()){
- ui->tool_install_icon->setAutoRaise(false);
- }else{
- ui->tool_install_icon->setAutoRaise(true);
- for(int i=0; i<bins.length(); i++){
- QAction *act = new QAction(this);
- act->setText(bins[i].section("::::",0,0)); //set name
- act->setWhatsThis(bins[i].section("::::",1,10)); //set command string
- appBinMenu->addAction(act);
- }
- }
- }
}
// ==========================
@@ -202,6 +202,18 @@ border-radius: 5px;
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<item row="1" column="1" rowspan="2">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
@@ -274,38 +286,22 @@ border-radius: 5px;
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
- <widget class="QToolButton" name="tool_install_icon">
+ <widget class="QLabel" name="label_install_icon">
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
- <property name="statusTip">
- <string>Start the application</string>
- </property>
<property name="text">
<string/>
</property>
- <property name="icon">
- <iconset resource="SoftwareManager.qrc">
- <normaloff>:/icons/appcafe.png</normaloff>:/icons/appcafe.png</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- <property name="popupMode">
- <enum>QToolButton::InstantPopup</enum>
+ <property name="pixmap">
+ <pixmap resource="SoftwareManager.qrc">:/icons/appcafe.png</pixmap>
</property>
- <property name="autoRaise">
+ <property name="scaledContents">
<bool>true</bool>
</property>
- <property name="arrowType">
- <enum>Qt::NoArrow</enum>
- </property>
</widget>
</item>
</layout>
@@ -315,13 +311,30 @@ border-radius: 5px;
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
+ <widget class="QToolButton" name="tool_install_startApp">
+ <property name="statusTip">
+ <string>Start the application</string>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset resource="SoftwareManager.qrc">
+ <normaloff>:/icons/application.png</normaloff>:/icons/application.png</iconset>
+ </property>
+ <property name="popupMode">
+ <enum>QToolButton::InstantPopup</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>10</width>
+ <width>0</width>
<height>20</height>
</size>
</property>
@@ -1211,8 +1224,8 @@ spacing: 1px;
<rect>
<x>0</x>
<y>0</y>
- <width>447</width>
- <height>61</height>
+ <width>98</width>
+ <height>28</height>
</rect>
</property>
</widget>
@@ -188,38 +188,6 @@ QString ProcessManager::parseDlLine(QString line){
}else{
out.append("??");
}
- /*
- int i=0;
- QStringList lab; lab << "KB" <<"MB"<<"GB"<<"TB"<<"PB";
- while( (tot>1000) && (i<lab.length()) ){
- cur=cur/1024; tot=tot/1024; i++;
- }
-
- cur = int(cur*10)/10.0;
- tot = int(tot*10)/10.0;
- if(totErr){ // cur==tot
- //Percentage unknown (since fetch is not done)
- out.append("??::"+QString::number(tot)+" "+lab[i]+"::");
- //stats = QString::number(tot)+" "+lab[i];
- }else{
- out.append(QString::number(percent)+"::"+QString::number(tot)+" "+lab[i]+"::");
- //stats = QString::number(cur)+"/"+QString::number(tot)+" "+lab[i]+" ("+QString::number(percent)+"%)";
- }
- // Format: <current>/<total> <size label> (<percent>%)
- }else if(curok){
- stats = Extras::sizeKToDisplay(QString::number(cur));
- }
- QString speed;
- if(spdok){
- speed = Extras::sizeKToDisplay(QString::number(spd))+"/s";
- }
- //Now put the output string together and return it
- if(stats.isEmpty() && speed.isEmpty()){}
- else if(stats.isEmpty()){ out = speed; }
- else if(speed.isEmpty()){ out = stats; }
- else{ out = QString( tr("%1 at %2") ).arg(stats,speed); }
- */
- //qDebug() << " - Result:" << out;
return out;
}

0 comments on commit 80faf74

Please sign in to comment.