SoftwareUpdater fixes and features added
Changes: Fixed window resizing bug that happens after packages start downloading Application icon and left stripe are sized relative to font size Added alert window dialog to display BPackageManager warnings Added tooltips to the packages in the list view
This commit is contained in:
parent
663a6ac2f9
commit
3d18f37d46
@ -43,14 +43,16 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
|
|||||||
fCurrentState(STATE_HEAD),
|
fCurrentState(STATE_HEAD),
|
||||||
fWaitingSem(-1),
|
fWaitingSem(-1),
|
||||||
fWaitingForButton(false),
|
fWaitingForButton(false),
|
||||||
fUserCancelRequested(false)
|
fUserCancelRequested(false),
|
||||||
|
fWarningAlertCount(0)
|
||||||
{
|
{
|
||||||
fIcon = new BBitmap(BRect(0, 0, 31, 31), 0, B_RGBA32);
|
int32 iconSize = int(be_plain_font->Size() * 32.0 / 12.0);
|
||||||
|
fIcon = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32);
|
||||||
team_info teamInfo;
|
team_info teamInfo;
|
||||||
get_team_info(B_CURRENT_TEAM, &teamInfo);
|
get_team_info(B_CURRENT_TEAM, &teamInfo);
|
||||||
app_info appInfo;
|
app_info appInfo;
|
||||||
be_roster->GetRunningAppInfo(teamInfo.team, &appInfo);
|
be_roster->GetRunningAppInfo(teamInfo.team, &appInfo);
|
||||||
BNodeInfo::GetTrackerIcon(&appInfo.ref, fIcon, B_LARGE_ICON);
|
BNodeInfo::GetTrackerIcon(&appInfo.ref, fIcon, icon_size(iconSize));
|
||||||
|
|
||||||
fStripeView = new StripeView(fIcon);
|
fStripeView = new StripeView(fIcon);
|
||||||
|
|
||||||
@ -127,6 +129,8 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
|
|||||||
|
|
||||||
fCancelAlertResponse.SetMessage(new BMessage(kMsgCancelResponse));
|
fCancelAlertResponse.SetMessage(new BMessage(kMsgCancelResponse));
|
||||||
fCancelAlertResponse.SetTarget(this);
|
fCancelAlertResponse.SetTarget(this);
|
||||||
|
fWarningAlertDismissed.SetMessage(new BMessage(kMsgWarningDismissed));
|
||||||
|
fWarningAlertDismissed.SetTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -236,6 +240,10 @@ SoftwareUpdaterWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case kMsgWarningDismissed:
|
||||||
|
fWarningAlertCount--;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
}
|
}
|
||||||
@ -293,6 +301,19 @@ SoftwareUpdaterWindow::AddPackageInfo(uint32 install_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SoftwareUpdaterWindow::ShowWarningAlert(const char* text)
|
||||||
|
{
|
||||||
|
BAlert* alert = new BAlert("warning", text, B_TRANSLATE("OK"), NULL, NULL,
|
||||||
|
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
|
alert->Go(&fWarningAlertDismissed);
|
||||||
|
alert->CenterIn(Frame());
|
||||||
|
// Offset multiple alerts
|
||||||
|
alert->MoveBy(fWarningAlertCount * 15, fWarningAlertCount * 15);
|
||||||
|
fWarningAlertCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BLayoutItem*
|
BLayoutItem*
|
||||||
SoftwareUpdaterWindow::layout_item_for(BView* view)
|
SoftwareUpdaterWindow::layout_item_for(BView* view)
|
||||||
{
|
{
|
||||||
@ -342,9 +363,10 @@ SoftwareUpdaterWindow::_SetState(uint32 state)
|
|||||||
if (fCurrentState == STATE_GET_CONFIRMATION) {
|
if (fCurrentState == STATE_GET_CONFIRMATION) {
|
||||||
fPackagesLayoutItem->SetVisible(true);
|
fPackagesLayoutItem->SetVisible(true);
|
||||||
// Re-enable resizing
|
// Re-enable resizing
|
||||||
SetSizeLimits(fDefaultRect.Width(), 9999,
|
float defaultWidth = fDefaultRect.Width();
|
||||||
fDefaultRect.Height() + fListView->MinSize().Height() + 30, 9999);
|
SetSizeLimits(defaultWidth, 9999,
|
||||||
ResizeTo(Bounds().Width(), 400);
|
fDefaultRect.Height() + 4 * fListView->ItemHeight(), 9999);
|
||||||
|
ResizeTo(defaultWidth, .75 * defaultWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Progress bar and string view
|
// Progress bar and string view
|
||||||
@ -455,11 +477,19 @@ PackageItem::PackageItem(const char* name, const char* version,
|
|||||||
fName(name),
|
fName(name),
|
||||||
fVersion(version),
|
fVersion(version),
|
||||||
fSummary(summary),
|
fSummary(summary),
|
||||||
fTooltip(tooltip),
|
fToolTip(NULL),
|
||||||
fSuperItem(super)
|
fSuperItem(super)
|
||||||
{
|
{
|
||||||
fLabelOffset = be_control_look->DefaultLabelSpacing();
|
fLabelOffset = be_control_look->DefaultLabelSpacing();
|
||||||
// SetToolTip(fTooltip);
|
if (tooltip != NULL)
|
||||||
|
fToolTip = new BTextToolTip(tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PackageItem::~PackageItem()
|
||||||
|
{
|
||||||
|
if (fToolTip != NULL)
|
||||||
|
fToolTip->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,6 +608,21 @@ PackageListView::FrameResized(float newWidth, float newHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
PackageListView::GetToolTipAt(BPoint point, BToolTip** _tip)
|
||||||
|
{
|
||||||
|
BListItem* item = ItemAt(IndexOf(point));
|
||||||
|
if (item == NULL)
|
||||||
|
return false;
|
||||||
|
PackageItem* pItem = dynamic_cast<PackageItem*>(item);
|
||||||
|
if (pItem != NULL) {
|
||||||
|
*_tip = pItem->ToolTip();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PackageListView::AddPackage(uint32 install_type, const char* name,
|
PackageListView::AddPackage(uint32 install_type, const char* name,
|
||||||
const char* cur_ver, const char* new_ver, const char* summary,
|
const char* cur_ver, const char* new_ver, const char* summary,
|
||||||
@ -585,21 +630,23 @@ PackageListView::AddPackage(uint32 install_type, const char* name,
|
|||||||
{
|
{
|
||||||
SuperItem* super;
|
SuperItem* super;
|
||||||
BString version;
|
BString version;
|
||||||
BString tooltip;
|
BString tooltip(B_TRANSLATE_COMMENT("Package:", "Tooltip text"));
|
||||||
|
tooltip.Append(" ").Append(name).Append("\n")
|
||||||
|
.Append(B_TRANSLATE_COMMENT("Repository:", "Tooltip text"))
|
||||||
|
.Append(" ").Append(repository).Append("\n");
|
||||||
switch (install_type) {
|
switch (install_type) {
|
||||||
case PACKAGE_UPDATE:
|
case PACKAGE_UPDATE:
|
||||||
{
|
{
|
||||||
if (fSuperUpdateItem == NULL) {
|
if (fSuperUpdateItem == NULL) {
|
||||||
fSuperUpdateItem = new SuperItem(
|
fSuperUpdateItem = new SuperItem(B_TRANSLATE_COMMENT(
|
||||||
B_TRANSLATE("Packages to be updated"));
|
"Packages to be updated", "List super item label"));
|
||||||
AddItem(fSuperUpdateItem);
|
AddItem(fSuperUpdateItem);
|
||||||
}
|
}
|
||||||
super = fSuperUpdateItem;
|
super = fSuperUpdateItem;
|
||||||
|
|
||||||
version.SetTo(new_ver);
|
version.SetTo(new_ver);
|
||||||
tooltip.SetTo(B_TRANSLATE("Repository:"));
|
tooltip.Append(B_TRANSLATE_COMMENT("Updating version",
|
||||||
tooltip.Append(" ").Append(repository)
|
"Tooltip text"))
|
||||||
.Append("\n").Append(B_TRANSLATE("Update version"))
|
|
||||||
.Append(" ").Append(cur_ver)
|
.Append(" ").Append(cur_ver)
|
||||||
.Append(" ").Append(B_TRANSLATE("to"))
|
.Append(" ").Append(B_TRANSLATE("to"))
|
||||||
.Append(" ").Append(new_ver);
|
.Append(" ").Append(new_ver);
|
||||||
@ -609,16 +656,15 @@ PackageListView::AddPackage(uint32 install_type, const char* name,
|
|||||||
case PACKAGE_INSTALL:
|
case PACKAGE_INSTALL:
|
||||||
{
|
{
|
||||||
if (fSuperInstallItem == NULL) {
|
if (fSuperInstallItem == NULL) {
|
||||||
fSuperInstallItem = new SuperItem(
|
fSuperInstallItem = new SuperItem(B_TRANSLATE_COMMENT(
|
||||||
B_TRANSLATE("New packages to be installed"));
|
"New packages to be installed", "List super item label"));
|
||||||
AddItem(fSuperInstallItem);
|
AddItem(fSuperInstallItem);
|
||||||
}
|
}
|
||||||
super = fSuperInstallItem;
|
super = fSuperInstallItem;
|
||||||
|
|
||||||
version.SetTo(new_ver);
|
version.SetTo(new_ver);
|
||||||
tooltip.SetTo(B_TRANSLATE("Repository:"));
|
tooltip.Append(B_TRANSLATE_COMMENT("Installing version",
|
||||||
tooltip.Append(" ").Append(repository)
|
"Tooltip text"))
|
||||||
.Append("\n").Append(B_TRANSLATE("Install version"))
|
|
||||||
.Append(" ").Append(new_ver);
|
.Append(" ").Append(new_ver);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -626,16 +672,15 @@ PackageListView::AddPackage(uint32 install_type, const char* name,
|
|||||||
case PACKAGE_UNINSTALL:
|
case PACKAGE_UNINSTALL:
|
||||||
{
|
{
|
||||||
if (fSuperUninstallItem == NULL) {
|
if (fSuperUninstallItem == NULL) {
|
||||||
fSuperUninstallItem = new SuperItem(
|
fSuperUninstallItem = new SuperItem(B_TRANSLATE_COMMENT(
|
||||||
B_TRANSLATE("Packages to be uninstalled"));
|
"Packages to be uninstalled", "List super item label"));
|
||||||
AddItem(fSuperUninstallItem);
|
AddItem(fSuperUninstallItem);
|
||||||
}
|
}
|
||||||
super = fSuperUninstallItem;
|
super = fSuperUninstallItem;
|
||||||
|
|
||||||
version.SetTo("");
|
version.SetTo("");
|
||||||
tooltip.SetTo(B_TRANSLATE("Repository:"));
|
tooltip.Append(B_TRANSLATE_COMMENT("Uninstalling version",
|
||||||
tooltip.Append(" ").Append(repository)
|
"Tooltip text"))
|
||||||
.Append("\n").Append(B_TRANSLATE("Uninstall version"))
|
|
||||||
.Append(" ").Append(new_ver);
|
.Append(" ").Append(new_ver);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -657,34 +702,18 @@ PackageListView::SortItems()
|
|||||||
SortItemsUnder(fSuperUpdateItem, true, SortPackageItems);
|
SortItemsUnder(fSuperUpdateItem, true, SortPackageItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
BSize
|
|
||||||
PackageListView::PreferredSize()
|
|
||||||
{
|
|
||||||
return BSize(B_SIZE_UNSET, 200);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
float
|
||||||
void
|
PackageListView::ItemHeight()
|
||||||
PackageListView::GetPreferredSize(float* _width, float* _height)
|
|
||||||
{
|
{
|
||||||
// TODO: Something more nice as default? I need to see how this looks
|
if (fSuperUpdateItem != NULL)
|
||||||
// when there are actually any packages...
|
return fSuperUpdateItem->GetPackageItemHeight();
|
||||||
if (_width != NULL)
|
if (fSuperInstallItem != NULL)
|
||||||
*_width = 400.0;
|
return fSuperInstallItem->GetPackageItemHeight();
|
||||||
|
if (fSuperUninstallItem != NULL)
|
||||||
if (_height != NULL)
|
return fSuperUninstallItem->GetPackageItemHeight();
|
||||||
*_height = 200.0;
|
return 0;
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
BSize
|
|
||||||
PackageListView::MaxSize()
|
|
||||||
{
|
|
||||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
|
|
||||||
BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
FinalWindow::FinalWindow(BRect rect, BPoint location, const char* header,
|
FinalWindow::FinalWindow(BRect rect, BPoint location, const char* header,
|
||||||
@ -698,12 +727,13 @@ FinalWindow::FinalWindow(BRect rect, BPoint location, const char* header,
|
|||||||
fDetailView(NULL),
|
fDetailView(NULL),
|
||||||
fCancelButton(NULL)
|
fCancelButton(NULL)
|
||||||
{
|
{
|
||||||
fIcon = new BBitmap(BRect(0, 0, 31, 31), 0, B_RGBA32);
|
int32 iconSize = int(be_plain_font->Size() * 32.0 / 12.0);
|
||||||
|
fIcon = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32);
|
||||||
team_info teamInfo;
|
team_info teamInfo;
|
||||||
get_team_info(B_CURRENT_TEAM, &teamInfo);
|
get_team_info(B_CURRENT_TEAM, &teamInfo);
|
||||||
app_info appInfo;
|
app_info appInfo;
|
||||||
be_roster->GetRunningAppInfo(teamInfo.team, &appInfo);
|
be_roster->GetRunningAppInfo(teamInfo.team, &appInfo);
|
||||||
BNodeInfo::GetTrackerIcon(&appInfo.ref, fIcon, B_LARGE_ICON);
|
BNodeInfo::GetTrackerIcon(&appInfo.ref, fIcon, icon_size(iconSize));
|
||||||
|
|
||||||
SetSizeLimits(rect.Width(), B_SIZE_UNLIMITED, 0, B_SIZE_UNLIMITED);
|
SetSizeLimits(rect.Width(), B_SIZE_UNLIMITED, 0, B_SIZE_UNLIMITED);
|
||||||
fStripeView = new StripeView(fIcon);
|
fStripeView = new StripeView(fIcon);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <StatusBar.h>
|
#include <StatusBar.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
#include <ToolTip.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "StripeView.h"
|
#include "StripeView.h"
|
||||||
@ -62,16 +63,18 @@ public:
|
|||||||
const char* summary,
|
const char* summary,
|
||||||
const char* tooltip,
|
const char* tooltip,
|
||||||
SuperItem* super);
|
SuperItem* super);
|
||||||
|
~PackageItem();
|
||||||
virtual void DrawItem(BView*, BRect, bool);
|
virtual void DrawItem(BView*, BRect, bool);
|
||||||
virtual void Update(BView *owner, const BFont *font);
|
virtual void Update(BView *owner, const BFont *font);
|
||||||
void SetItemHeight(const BFont* font);
|
void SetItemHeight(const BFont* font);
|
||||||
int ICompare(PackageItem* item);
|
int ICompare(PackageItem* item);
|
||||||
|
BTextToolTip* ToolTip() { return fToolTip; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BString fName;
|
BString fName;
|
||||||
BString fVersion;
|
BString fVersion;
|
||||||
BString fSummary;
|
BString fSummary;
|
||||||
BString fTooltip;
|
BTextToolTip* fToolTip;
|
||||||
BFont fRegularFont;
|
BFont fRegularFont;
|
||||||
BFont fSmallFont;
|
BFont fSmallFont;
|
||||||
font_height fSmallFontHeight;
|
font_height fSmallFontHeight;
|
||||||
@ -85,9 +88,6 @@ class PackageListView : public BOutlineListView {
|
|||||||
public:
|
public:
|
||||||
PackageListView();
|
PackageListView();
|
||||||
virtual void FrameResized(float newWidth, float newHeight);
|
virtual void FrameResized(float newWidth, float newHeight);
|
||||||
// virtual BSize PreferredSize();
|
|
||||||
// virtual void GetPreferredSize(float* _width, float* _height);
|
|
||||||
// virtual BSize MaxSize();
|
|
||||||
void AddPackage(uint32 install_type,
|
void AddPackage(uint32 install_type,
|
||||||
const char* name,
|
const char* name,
|
||||||
const char* cur_ver,
|
const char* cur_ver,
|
||||||
@ -95,6 +95,10 @@ public:
|
|||||||
const char* summary,
|
const char* summary,
|
||||||
const char* repository);
|
const char* repository);
|
||||||
void SortItems();
|
void SortItems();
|
||||||
|
float ItemHeight();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool GetToolTipAt(BPoint point, BToolTip** _tip);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SuperItem* fSuperUpdateItem;
|
SuperItem* fSuperUpdateItem;
|
||||||
@ -119,6 +123,7 @@ public:
|
|||||||
const char* new_ver,
|
const char* new_ver,
|
||||||
const char* summary,
|
const char* summary,
|
||||||
const char* repository);
|
const char* repository);
|
||||||
|
void ShowWarningAlert(const char* text);
|
||||||
const BBitmap* GetIcon() { return fIcon; };
|
const BBitmap* GetIcon() { return fIcon; };
|
||||||
BRect GetDefaultRect() { return fDefaultRect; };
|
BRect GetDefaultRect() { return fDefaultRect; };
|
||||||
BPoint GetLocation() { return Frame().LeftTop(); };
|
BPoint GetLocation() { return Frame().LeftTop(); };
|
||||||
@ -154,6 +159,8 @@ private:
|
|||||||
uint32 fButtonResult;
|
uint32 fButtonResult;
|
||||||
bool fUserCancelRequested;
|
bool fUserCancelRequested;
|
||||||
BInvoker fCancelAlertResponse;
|
BInvoker fCancelAlertResponse;
|
||||||
|
int32 fWarningAlertCount;
|
||||||
|
BInvoker fWarningAlertDismissed;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,33 +6,28 @@
|
|||||||
* Ryan Leavengood <leavengood@gmail.com>
|
* Ryan Leavengood <leavengood@gmail.com>
|
||||||
* John Scipione <jscipione@gmail.com>
|
* John Scipione <jscipione@gmail.com>
|
||||||
* Joseph Groover <looncraz@looncraz.net>
|
* Joseph Groover <looncraz@looncraz.net>
|
||||||
|
* Brian Hill <supernova@warpmail.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "StripeView.h"
|
#include "StripeView.h"
|
||||||
|
|
||||||
|
#include <LayoutUtils.h>
|
||||||
static const float kStripeWidth = 30.0;
|
|
||||||
|
|
||||||
|
|
||||||
StripeView::StripeView(BBitmap* icon)
|
StripeView::StripeView(BBitmap* icon)
|
||||||
:
|
:
|
||||||
BView("StripeView", B_WILL_DRAW),
|
BView("StripeView", B_WILL_DRAW),
|
||||||
fIcon(icon)
|
fIcon(icon),
|
||||||
|
fWidth(0.0),
|
||||||
|
fStripeWidth(0.0)
|
||||||
{
|
{
|
||||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
|
||||||
float width = 0.0f;
|
if (icon != NULL) {
|
||||||
if (icon != NULL)
|
fStripeWidth = icon->Bounds().Width();
|
||||||
width += icon->Bounds().Width() + 32.0f;
|
fWidth = 2 * fStripeWidth + 2.0f;
|
||||||
|
}
|
||||||
SetExplicitSize(BSize(width, B_SIZE_UNSET));
|
|
||||||
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
StripeView::~StripeView()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,28 +41,37 @@ StripeView::Draw(BRect updateRect)
|
|||||||
FillRect(updateRect);
|
FillRect(updateRect);
|
||||||
|
|
||||||
BRect stripeRect = Bounds();
|
BRect stripeRect = Bounds();
|
||||||
stripeRect.right = kStripeWidth;
|
stripeRect.right = fStripeWidth;
|
||||||
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
|
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
|
||||||
FillRect(stripeRect);
|
FillRect(stripeRect);
|
||||||
|
|
||||||
SetDrawingMode(B_OP_ALPHA);
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||||
DrawBitmapAsync(fIcon, BPoint(15.0f, 10.0f));
|
DrawBitmapAsync(fIcon, BPoint(fStripeWidth / 2.0f, 10.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSize
|
||||||
|
StripeView::PreferredSize()
|
||||||
|
{
|
||||||
|
return BSize(fWidth, B_SIZE_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
StripeView::SetIcon(BBitmap* icon)
|
StripeView::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
if (fIcon != NULL)
|
if (_width != NULL)
|
||||||
delete fIcon;
|
*_width = fWidth;
|
||||||
|
|
||||||
fIcon = icon;
|
if (_height != NULL)
|
||||||
|
*_height = fStripeWidth + 20.0f;
|
||||||
float width = 0.0f;
|
}
|
||||||
if (icon != NULL)
|
|
||||||
width += icon->Bounds().Width() + 32.0f;
|
|
||||||
|
BSize
|
||||||
SetExplicitSize(BSize(width, B_SIZE_UNSET));
|
StripeView::MaxSize()
|
||||||
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
|
{
|
||||||
|
return BLayoutUtils::ComposeSize(ExplicitMaxSize(),
|
||||||
|
BSize(fWidth, B_SIZE_UNLIMITED));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
* Ryan Leavengood <leavengood@gmail.com>
|
* Ryan Leavengood <leavengood@gmail.com>
|
||||||
* John Scipione <jscipione@gmail.com>
|
* John Scipione <jscipione@gmail.com>
|
||||||
* Joseph Groover <looncraz@looncraz.net>
|
* Joseph Groover <looncraz@looncraz.net>
|
||||||
|
* Brian Hill <supernova@warpmail.net>
|
||||||
*/
|
*/
|
||||||
#ifndef _STRIPE_VIEW_H
|
#ifndef _STRIPE_VIEW_H
|
||||||
#define _STRIPE_VIEW_H
|
#define _STRIPE_VIEW_H
|
||||||
@ -18,15 +19,16 @@
|
|||||||
class StripeView : public BView {
|
class StripeView : public BView {
|
||||||
public:
|
public:
|
||||||
StripeView(BBitmap* icon);
|
StripeView(BBitmap* icon);
|
||||||
~StripeView();
|
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
virtual BSize PreferredSize();
|
||||||
BBitmap* Icon() const { return fIcon; };
|
virtual void GetPreferredSize(float* _width, float* _height);
|
||||||
void SetIcon(BBitmap* icon);
|
virtual BSize MaxSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BBitmap* fIcon;
|
BBitmap* fIcon;
|
||||||
|
float fWidth;
|
||||||
|
float fStripeWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "UpdateAction.h"
|
#include "UpdateAction.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <package/manager/Exceptions.h>
|
#include <package/manager/Exceptions.h>
|
||||||
@ -42,11 +41,11 @@ UpdateAction::~UpdateAction()
|
|||||||
status_t
|
status_t
|
||||||
UpdateAction::Perform()
|
UpdateAction::Perform()
|
||||||
{
|
{
|
||||||
fUpdateManager->Init(BPackageManager::B_ADD_INSTALLED_REPOSITORIES
|
|
||||||
| BPackageManager::B_ADD_REMOTE_REPOSITORIES
|
|
||||||
| BPackageManager::B_REFRESH_REPOSITORIES);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
fUpdateManager->Init(BPackageManager::B_ADD_INSTALLED_REPOSITORIES
|
||||||
|
| BPackageManager::B_ADD_REMOTE_REPOSITORIES
|
||||||
|
| BPackageManager::B_REFRESH_REPOSITORIES);
|
||||||
|
|
||||||
// These values indicate that all updates should be installed
|
// These values indicate that all updates should be installed
|
||||||
int packageCount = 0;
|
int packageCount = 0;
|
||||||
const char* const packages = "";
|
const char* const packages = "";
|
||||||
@ -55,16 +54,6 @@ UpdateAction::Perform()
|
|||||||
// fUpdateManager->SetDebugLevel(1);
|
// fUpdateManager->SetDebugLevel(1);
|
||||||
fUpdateManager->Update(&packages, packageCount);
|
fUpdateManager->Update(&packages, packageCount);
|
||||||
} catch (BFatalErrorException ex) {
|
} catch (BFatalErrorException ex) {
|
||||||
BString errorString;
|
|
||||||
errorString.SetToFormat(
|
|
||||||
"Fatal error occurred while updating packages: "
|
|
||||||
"%s (%s)\n", ex.Message().String(),
|
|
||||||
ex.Details().String());
|
|
||||||
BAlert* alert(new(std::nothrow) BAlert(B_TRANSLATE("Fatal error"),
|
|
||||||
errorString, B_TRANSLATE("Close"), NULL, NULL,
|
|
||||||
B_WIDTH_AS_USUAL, B_STOP_ALERT));
|
|
||||||
if (alert != NULL)
|
|
||||||
alert->Go();
|
|
||||||
fUpdateManager->FinalUpdate(B_TRANSLATE("Updates did not complete"),
|
fUpdateManager->FinalUpdate(B_TRANSLATE("Updates did not complete"),
|
||||||
ex.Message());
|
ex.Message());
|
||||||
return ex.Error();
|
return ex.Error();
|
||||||
|
@ -79,7 +79,6 @@ UpdateManager::JobFailed(BSupportKit::BJob* job)
|
|||||||
void
|
void
|
||||||
UpdateManager::JobAborted(BSupportKit::BJob* job)
|
UpdateManager::JobAborted(BSupportKit::BJob* job)
|
||||||
{
|
{
|
||||||
//DIE(job->Result(), "aborted");
|
|
||||||
printf("Job aborted\n");
|
printf("Job aborted\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,15 +218,27 @@ UpdateManager::ConfirmChanges(bool fromMostSpecific)
|
|||||||
void
|
void
|
||||||
UpdateManager::Warn(status_t error, const char* format, ...)
|
UpdateManager::Warn(status_t error, const char* format, ...)
|
||||||
{
|
{
|
||||||
|
char buffer[256];
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vfprintf(stderr, format, args);
|
vfprintf(stderr, format, args);
|
||||||
|
vsnprintf(buffer, 256, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (error == B_OK)
|
if (error == B_OK)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
else
|
else
|
||||||
printf(": %s\n", strerror(error));
|
printf(": %s\n", strerror(error));
|
||||||
|
|
||||||
|
if (fStatusWindow != NULL)
|
||||||
|
fStatusWindow->ShowWarningAlert(buffer);
|
||||||
|
else {
|
||||||
|
BString text("SoftwareUpdater:\n");
|
||||||
|
text.Append(buffer);
|
||||||
|
BAlert* alert = new BAlert("warning", text, B_TRANSLATE("OK"), NULL,
|
||||||
|
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||||
|
alert->Go(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -531,6 +542,9 @@ UpdateManager::_UpdateDownloadProgress(const char* header,
|
|||||||
void
|
void
|
||||||
UpdateManager::_FinalUpdate(const char* header, const char* text)
|
UpdateManager::_FinalUpdate(const char* header, const char* text)
|
||||||
{
|
{
|
||||||
|
if (fFinalWindow != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
BNotification notification(B_INFORMATION_NOTIFICATION);
|
BNotification notification(B_INFORMATION_NOTIFICATION);
|
||||||
notification.SetGroup("SoftwareUpdater");
|
notification.SetGroup("SoftwareUpdater");
|
||||||
notification.SetTitle(header);
|
notification.SetTitle(header);
|
||||||
|
@ -32,9 +32,7 @@ static const uint32 kMsgProgressUpdate = 'iPRO';
|
|||||||
static const uint32 kMsgCancel = 'iCAN';
|
static const uint32 kMsgCancel = 'iCAN';
|
||||||
static const uint32 kMsgCancelResponse = 'iCRE';
|
static const uint32 kMsgCancelResponse = 'iCRE';
|
||||||
static const uint32 kMsgUpdateConfirmed = 'iCON';
|
static const uint32 kMsgUpdateConfirmed = 'iCON';
|
||||||
static const uint32 kMsgClose = 'iCLO';
|
static const uint32 kMsgWarningDismissed = 'iWDI';
|
||||||
static const uint32 kMsgShow = 'iSHO';
|
|
||||||
static const uint32 kMsgShowInfo = 'iSHI';
|
|
||||||
static const uint32 kMsgRegister = 'iREG';
|
static const uint32 kMsgRegister = 'iREG';
|
||||||
static const uint32 kMsgFinalQuit = 'iFIN';
|
static const uint32 kMsgFinalQuit = 'iFIN';
|
||||||
|
|
||||||
@ -44,7 +42,6 @@ static const uint32 kMsgFinalQuit = 'iFIN';
|
|||||||
#define kKeyPackageName "key_packagename"
|
#define kKeyPackageName "key_packagename"
|
||||||
#define kKeyPackageCount "key_packagecount"
|
#define kKeyPackageCount "key_packagecount"
|
||||||
#define kKeyPercentage "key_percentage"
|
#define kKeyPercentage "key_percentage"
|
||||||
#define kKeyFrame "key_frame"
|
|
||||||
#define kKeyMessenger "key_messenger"
|
#define kKeyMessenger "key_messenger"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user