HaikuDepot: Show Publish Date
Add a column to the table to show the publish date. Also add text on the featured packages view to show the publish date. Supports sorting. Fixes #13006 Change-Id: I19d9bc5bf7f44b5673c2ade5d00de8fdadbe1b06 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4649 Reviewed-by: humdinger <[email protected]> Reviewed-by: Andrew Lindesay <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
@@ -105,6 +105,7 @@
|
|||||||
<li><p><span class="menu">Available</span>: The package exists in that repository and can be downloaded and installed. If there are any dependencies on other packages, you'll be informed of that while installing and get the choice of downloading/installing all that's necessary.</p></li>
|
<li><p><span class="menu">Available</span>: The package exists in that repository and can be downloaded and installed. If there are any dependencies on other packages, you'll be informed of that while installing and get the choice of downloading/installing all that's necessary.</p></li>
|
||||||
<li><p><span class="menu">Pending / %</span>: <i>Pending</i> is shown for a package that is queued for download/installation. While a package is downloaded, the progress is shown as percentage.</p></li>
|
<li><p><span class="menu">Pending / %</span>: <i>Pending</i> is shown for a package that is queued for download/installation. While a package is downloaded, the progress is shown as percentage.</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<p>The date column shows when the server system recorded the specific version of the package. Owing to possible delays in the publishing process, this date may not be entirely accurate.</p>
|
||||||
<p>You can grab the dotted line between the packages list and the info area to vertically resize the packages list.</p>
|
<p>You can grab the dotted line between the packages list and the info area to vertically resize the packages list.</p>
|
||||||
|
|
||||||
<h2><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
|
<h2><a href="#"><img src="../../images/up.png" style="border:none;float:right" alt="index" /></a>
|
||||||
|
|||||||
@@ -455,7 +455,8 @@ PackageInfo::PackageInfo()
|
|||||||
fDepotName(""),
|
fDepotName(""),
|
||||||
fViewed(false),
|
fViewed(false),
|
||||||
fIsCollatingChanges(false),
|
fIsCollatingChanges(false),
|
||||||
fCollatedChanges(0)
|
fCollatedChanges(0),
|
||||||
|
fVersionCreateTimestamp(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,7 +487,8 @@ PackageInfo::PackageInfo(const BPackageInfo& info)
|
|||||||
fDepotName(""),
|
fDepotName(""),
|
||||||
fViewed(false),
|
fViewed(false),
|
||||||
fIsCollatingChanges(false),
|
fIsCollatingChanges(false),
|
||||||
fCollatedChanges(0)
|
fCollatedChanges(0),
|
||||||
|
fVersionCreateTimestamp(0)
|
||||||
{
|
{
|
||||||
BString publisherURL;
|
BString publisherURL;
|
||||||
if (info.URLList().CountStrings() > 0)
|
if (info.URLList().CountStrings() > 0)
|
||||||
@@ -533,7 +535,8 @@ PackageInfo::PackageInfo(const BString& name,
|
|||||||
fDepotName(""),
|
fDepotName(""),
|
||||||
fViewed(false),
|
fViewed(false),
|
||||||
fIsCollatingChanges(false),
|
fIsCollatingChanges(false),
|
||||||
fCollatedChanges(0)
|
fCollatedChanges(0),
|
||||||
|
fVersionCreateTimestamp(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,7 +569,8 @@ PackageInfo::PackageInfo(const PackageInfo& other)
|
|||||||
fDepotName(other.fDepotName),
|
fDepotName(other.fDepotName),
|
||||||
fViewed(other.fViewed),
|
fViewed(other.fViewed),
|
||||||
fIsCollatingChanges(false),
|
fIsCollatingChanges(false),
|
||||||
fCollatedChanges(0)
|
fCollatedChanges(0),
|
||||||
|
fVersionCreateTimestamp(other.fVersionCreateTimestamp)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,6 +603,7 @@ PackageInfo::operator=(const PackageInfo& other)
|
|||||||
fSize = other.fSize;
|
fSize = other.fSize;
|
||||||
fDepotName = other.fDepotName;
|
fDepotName = other.fDepotName;
|
||||||
fViewed = other.fViewed;
|
fViewed = other.fViewed;
|
||||||
|
fVersionCreateTimestamp = other.fVersionCreateTimestamp;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -628,7 +633,8 @@ PackageInfo::operator==(const PackageInfo& other) const
|
|||||||
&& fArchitecture == other.fArchitecture
|
&& fArchitecture == other.fArchitecture
|
||||||
&& fLocalFilePath == other.fLocalFilePath
|
&& fLocalFilePath == other.fLocalFilePath
|
||||||
&& fFileName == other.fFileName
|
&& fFileName == other.fFileName
|
||||||
&& fSize == other.fSize;
|
&& fSize == other.fSize
|
||||||
|
&& fVersionCreateTimestamp == other.fVersionCreateTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1007,6 +1013,13 @@ PackageInfo::SetViewed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageInfo::SetVersionCreateTimestamp(uint64 value)
|
||||||
|
{
|
||||||
|
fVersionCreateTimestamp = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PackageInfo::SetDepotName(const BString& depotName)
|
PackageInfo::SetDepotName(const BString& depotName)
|
||||||
{
|
{
|
||||||
@@ -1315,5 +1328,6 @@ const char* package_state_to_string(PackageState state)
|
|||||||
return "PENDING";
|
return "PENDING";
|
||||||
default:
|
default:
|
||||||
debugger("unknown package state");
|
debugger("unknown package state");
|
||||||
|
return "???";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,6 +345,10 @@ public:
|
|||||||
bool Viewed() const
|
bool Viewed() const
|
||||||
{ return fViewed; }
|
{ return fViewed; }
|
||||||
|
|
||||||
|
void SetVersionCreateTimestamp(uint64 value);
|
||||||
|
uint64 VersionCreateTimestamp() const
|
||||||
|
{ return fVersionCreateTimestamp; }
|
||||||
|
|
||||||
void SetDepotName(const BString& depotName);
|
void SetDepotName(const BString& depotName);
|
||||||
const BString& DepotName() const
|
const BString& DepotName() const
|
||||||
{ return fDepotName; }
|
{ return fDepotName; }
|
||||||
@@ -400,6 +404,9 @@ private:
|
|||||||
|
|
||||||
bool fIsCollatingChanges;
|
bool fIsCollatingChanges;
|
||||||
uint32 fCollatedChanges;
|
uint32 fCollatedChanges;
|
||||||
|
|
||||||
|
uint64 fVersionCreateTimestamp;
|
||||||
|
// milliseconds since epoc
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ PackageFillingPkgListener::ConsumePackage(const PackageInfoRef& package,
|
|||||||
|
|
||||||
if (!pkgVersion->PayloadLengthIsNull())
|
if (!pkgVersion->PayloadLengthIsNull())
|
||||||
package->SetSize(pkgVersion->PayloadLength());
|
package->SetSize(pkgVersion->PayloadLength());
|
||||||
|
|
||||||
|
if (!pkgVersion->CreateTimestampIsNull())
|
||||||
|
package->SetVersionCreateTimestamp(pkgVersion->CreateTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 countPkgCategories = pkg->CountPkgCategories();
|
int32 countPkgCategories = pkg->CountPkgCategories();
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"createTimestamp": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"modifyTimestamp": {
|
"modifyTimestamp": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
@@ -62,6 +65,12 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"javaType": "org.haiku.haikudepotserver.pkg.model.dumpexport.DumpExportPkgVersion",
|
"javaType": "org.haiku.haikudepotserver.pkg.model.dumpexport.DumpExportPkgVersion",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"createTimestamp": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"modifyTimestamp": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
"major": {
|
"major": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "BitmapView.h"
|
#include "BitmapView.h"
|
||||||
#include "HaikuDepotConstants.h"
|
#include "HaikuDepotConstants.h"
|
||||||
|
#include "LocaleUtils.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "MarkupTextView.h"
|
#include "MarkupTextView.h"
|
||||||
@@ -41,8 +42,9 @@
|
|||||||
#define X_POSITION_RATING 350.0f
|
#define X_POSITION_RATING 350.0f
|
||||||
#define X_POSITION_SUMMARY 500.0f
|
#define X_POSITION_SUMMARY 500.0f
|
||||||
#define WIDTH_RATING 100.0f
|
#define WIDTH_RATING 100.0f
|
||||||
#define Y_PROPORTION_TITLE 0.4f
|
#define Y_PROPORTION_TITLE 0.35f
|
||||||
#define Y_PROPORTION_PUBLISHER 0.7f
|
#define Y_PROPORTION_PUBLISHER 0.60f
|
||||||
|
#define Y_PROPORTION_CHRONOLOGICAL_DATA 0.75f
|
||||||
#define PADDING 8.0f
|
#define PADDING 8.0f
|
||||||
|
|
||||||
|
|
||||||
@@ -407,6 +409,7 @@ public:
|
|||||||
_DrawPackageIcon(updateRect, pkg, y, selected);
|
_DrawPackageIcon(updateRect, pkg, y, selected);
|
||||||
_DrawPackageTitle(updateRect, pkg, y, selected);
|
_DrawPackageTitle(updateRect, pkg, y, selected);
|
||||||
_DrawPackagePublisher(updateRect, pkg, y, selected);
|
_DrawPackagePublisher(updateRect, pkg, y, selected);
|
||||||
|
_DrawPackageCronologicalInfo(updateRect, pkg, y, selected);
|
||||||
_DrawPackageRating(updateRect, pkg, y, selected);
|
_DrawPackageRating(updateRect, pkg, y, selected);
|
||||||
_DrawPackageSummary(updateRect, pkg, y, selected);
|
_DrawPackageSummary(updateRect, pkg, y, selected);
|
||||||
}
|
}
|
||||||
@@ -468,8 +471,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _DrawPackagePublisher(BRect updateRect, PackageInfoRef pkg, float y,
|
void _DrawPackageGenericTextSlug(BRect updateRect, PackageInfoRef pkg,
|
||||||
bool selected)
|
const BString& text, float y, float yProportion, bool selected)
|
||||||
{
|
{
|
||||||
static BFont* sFont = NULL;
|
static BFont* sFont = NULL;
|
||||||
|
|
||||||
@@ -488,11 +491,33 @@ public:
|
|||||||
SetFont(sFont);
|
SetFont(sFont);
|
||||||
|
|
||||||
float maxTextWidth = (X_POSITION_RATING - HEIGHT_PACKAGE) - PADDING;
|
float maxTextWidth = (X_POSITION_RATING - HEIGHT_PACKAGE) - PADDING;
|
||||||
BString publisherName(pkg->Publisher().Name());
|
BString renderedText(text);
|
||||||
TruncateString(&publisherName, B_TRUNCATE_END, maxTextWidth);
|
TruncateString(&renderedText, B_TRUNCATE_END, maxTextWidth);
|
||||||
|
|
||||||
DrawString(publisherName, BPoint(HEIGHT_PACKAGE,
|
DrawString(renderedText, BPoint(HEIGHT_PACKAGE,
|
||||||
y + (HEIGHT_PACKAGE * Y_PROPORTION_PUBLISHER)));
|
y + (HEIGHT_PACKAGE * yProportion)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _DrawPackagePublisher(BRect updateRect, PackageInfoRef pkg, float y,
|
||||||
|
bool selected)
|
||||||
|
{
|
||||||
|
_DrawPackageGenericTextSlug(updateRect, pkg, pkg->Publisher().Name(), y,
|
||||||
|
Y_PROPORTION_PUBLISHER, selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _DrawPackageCronologicalInfo(BRect updateRect, PackageInfoRef pkg,
|
||||||
|
float y, bool selected)
|
||||||
|
{
|
||||||
|
BString versionCreateTimestampPresentation
|
||||||
|
= B_TRANSLATE("%VersionCreateDate%");
|
||||||
|
versionCreateTimestampPresentation.ReplaceAll("%VersionCreateDate%",
|
||||||
|
LocaleUtils::TimestampToDateString(
|
||||||
|
pkg->VersionCreateTimestamp()));
|
||||||
|
_DrawPackageGenericTextSlug(updateRect, pkg,
|
||||||
|
versionCreateTimestampPresentation, y,
|
||||||
|
Y_PROPORTION_CHRONOLOGICAL_DATA, selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <package/hpkg/Strings.h>
|
#include <package/hpkg/Strings.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
#include "LocaleUtils.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "WorkStatusView.h"
|
#include "WorkStatusView.h"
|
||||||
@@ -112,6 +113,23 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class DateField : public BStringField {
|
||||||
|
public:
|
||||||
|
DateField(uint64 millisSinceEpoc);
|
||||||
|
virtual ~DateField();
|
||||||
|
|
||||||
|
void SetMillisSinceEpoc(uint64 millisSinceEpoc);
|
||||||
|
uint64 MillisSinceEpoc() const
|
||||||
|
{ return fMillisSinceEpoc; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _SetMillisSinceEpoc(uint64 millisSinceEpoc);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint64 fMillisSinceEpoc;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// BColumn for PackageListView which knows how to render
|
// BColumn for PackageListView which knows how to render
|
||||||
// a PackageIconAndTitleField
|
// a PackageIconAndTitleField
|
||||||
class PackageColumn : public BTitledColumn {
|
class PackageColumn : public BTitledColumn {
|
||||||
@@ -159,6 +177,7 @@ public:
|
|||||||
void UpdateSize();
|
void UpdateSize();
|
||||||
void UpdateRepository();
|
void UpdateRepository();
|
||||||
void UpdateVersion();
|
void UpdateVersion();
|
||||||
|
void UpdateVersionCreateTimestamp();
|
||||||
|
|
||||||
PackageRow*& NextInHash()
|
PackageRow*& NextInHash()
|
||||||
{ return fNextInHash; }
|
{ return fNextInHash; }
|
||||||
@@ -297,6 +316,47 @@ SizeField::SetSize(double size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - DateField
|
||||||
|
|
||||||
|
|
||||||
|
DateField::DateField(uint64 millisSinceEpoc)
|
||||||
|
:
|
||||||
|
BStringField(""),
|
||||||
|
fMillisSinceEpoc(0)
|
||||||
|
{
|
||||||
|
_SetMillisSinceEpoc(millisSinceEpoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DateField::~DateField()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DateField::SetMillisSinceEpoc(uint64 millisSinceEpoc)
|
||||||
|
{
|
||||||
|
if (millisSinceEpoc == fMillisSinceEpoc)
|
||||||
|
return;
|
||||||
|
_SetMillisSinceEpoc(millisSinceEpoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DateField::_SetMillisSinceEpoc(uint64 millisSinceEpoc)
|
||||||
|
{
|
||||||
|
BString dateString;
|
||||||
|
|
||||||
|
if (millisSinceEpoc == 0)
|
||||||
|
dateString = B_TRANSLATE_CONTEXT("-", "no package publish");
|
||||||
|
else
|
||||||
|
dateString = LocaleUtils::TimestampToDateString(millisSinceEpoc);
|
||||||
|
|
||||||
|
fMillisSinceEpoc = millisSinceEpoc;
|
||||||
|
SetString(dateString.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - PackageColumn
|
// #pragma mark - PackageColumn
|
||||||
|
|
||||||
|
|
||||||
@@ -455,6 +515,16 @@ PackageColumn::DrawField(BField* field, BRect rect, BView* parent)
|
|||||||
int
|
int
|
||||||
PackageColumn::CompareFields(BField* field1, BField* field2)
|
PackageColumn::CompareFields(BField* field1, BField* field2)
|
||||||
{
|
{
|
||||||
|
DateField* dateField1 = dynamic_cast<DateField*>(field1);
|
||||||
|
DateField* dateField2 = dynamic_cast<DateField*>(field2);
|
||||||
|
if (dateField1 != NULL && dateField2 != NULL) {
|
||||||
|
if (dateField1->MillisSinceEpoc() > dateField2->MillisSinceEpoc())
|
||||||
|
return -1;
|
||||||
|
else if (dateField1->MillisSinceEpoc() < dateField2->MillisSinceEpoc())
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SizeField* sizeField1 = dynamic_cast<SizeField*>(field1);
|
SizeField* sizeField1 = dynamic_cast<SizeField*>(field1);
|
||||||
SizeField* sizeField2 = dynamic_cast<SizeField*>(field2);
|
SizeField* sizeField2 = dynamic_cast<SizeField*>(field2);
|
||||||
if (sizeField1 != NULL && sizeField2 != NULL) {
|
if (sizeField1 != NULL && sizeField2 != NULL) {
|
||||||
@@ -541,6 +611,7 @@ enum {
|
|||||||
kStatusColumn,
|
kStatusColumn,
|
||||||
kRepositoryColumn,
|
kRepositoryColumn,
|
||||||
kVersionColumn,
|
kVersionColumn,
|
||||||
|
kVersionCreateTimestampColumn,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -561,23 +632,13 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef,
|
|||||||
// NOTE: The icon BBitmap is referenced by the fPackage member.
|
// NOTE: The icon BBitmap is referenced by the fPackage member.
|
||||||
UpdateIconAndTitle();
|
UpdateIconAndTitle();
|
||||||
|
|
||||||
// Rating
|
|
||||||
UpdateRating();
|
UpdateRating();
|
||||||
|
|
||||||
// Summary
|
|
||||||
UpdateSummary();
|
UpdateSummary();
|
||||||
|
|
||||||
// Size
|
|
||||||
UpdateSize();
|
UpdateSize();
|
||||||
|
|
||||||
// Status
|
|
||||||
UpdateState();
|
UpdateState();
|
||||||
|
|
||||||
// Repository
|
|
||||||
UpdateRepository();
|
UpdateRepository();
|
||||||
|
|
||||||
// Version
|
|
||||||
UpdateVersion();
|
UpdateVersion();
|
||||||
|
UpdateVersionCreateTimestamp();
|
||||||
|
|
||||||
package.AddListener(fPackageListener);
|
package.AddListener(fPackageListener);
|
||||||
}
|
}
|
||||||
@@ -595,7 +656,6 @@ PackageRow::UpdateIconAndTitle()
|
|||||||
{
|
{
|
||||||
if (!fPackage.IsSet())
|
if (!fPackage.IsSet())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetField(new PackageIconAndTitleField(
|
SetField(new PackageIconAndTitleField(
|
||||||
fPackage->Name(), fPackage->Title()), kTitleColumn);
|
fPackage->Name(), fPackage->Title()), kTitleColumn);
|
||||||
}
|
}
|
||||||
@@ -606,7 +666,6 @@ PackageRow::UpdateState()
|
|||||||
{
|
{
|
||||||
if (!fPackage.IsSet())
|
if (!fPackage.IsSet())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetField(new BStringField(package_state_to_string(fPackage)),
|
SetField(new BStringField(package_state_to_string(fPackage)),
|
||||||
kStatusColumn);
|
kStatusColumn);
|
||||||
}
|
}
|
||||||
@@ -617,7 +676,6 @@ PackageRow::UpdateSummary()
|
|||||||
{
|
{
|
||||||
if (!fPackage.IsSet())
|
if (!fPackage.IsSet())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetField(new BStringField(fPackage->ShortDescription()),
|
SetField(new BStringField(fPackage->ShortDescription()),
|
||||||
kDescriptionColumn);
|
kDescriptionColumn);
|
||||||
}
|
}
|
||||||
@@ -638,7 +696,6 @@ PackageRow::UpdateSize()
|
|||||||
{
|
{
|
||||||
if (!fPackage.IsSet())
|
if (!fPackage.IsSet())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetField(new SizeField(fPackage->Size()), kSizeColumn);
|
SetField(new SizeField(fPackage->Size()), kSizeColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,7 +705,6 @@ PackageRow::UpdateRepository()
|
|||||||
{
|
{
|
||||||
if (!fPackage.IsSet())
|
if (!fPackage.IsSet())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetField(new BStringField(fPackage->DepotName()), kRepositoryColumn);
|
SetField(new BStringField(fPackage->DepotName()), kRepositoryColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -658,11 +714,20 @@ PackageRow::UpdateVersion()
|
|||||||
{
|
{
|
||||||
if (!fPackage.IsSet())
|
if (!fPackage.IsSet())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetField(new BStringField(fPackage->Version().ToString()), kVersionColumn);
|
SetField(new BStringField(fPackage->Version().ToString()), kVersionColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PackageRow::UpdateVersionCreateTimestamp()
|
||||||
|
{
|
||||||
|
if (!fPackage.IsSet())
|
||||||
|
return;
|
||||||
|
SetField(new DateField(fPackage->VersionCreateTimestamp()),
|
||||||
|
kVersionCreateTimestampColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - ItemCountView
|
// #pragma mark - ItemCountView
|
||||||
|
|
||||||
|
|
||||||
@@ -807,7 +872,7 @@ PackageListView::PackageListView(Model* model)
|
|||||||
300 * scale, 80 * scale, 1000 * scale,
|
300 * scale, 80 * scale, 1000 * scale,
|
||||||
B_TRUNCATE_MIDDLE), kDescriptionColumn);
|
B_TRUNCATE_MIDDLE), kDescriptionColumn);
|
||||||
PackageColumn* sizeColumn = new PackageColumn(fModel, B_TRANSLATE("Size"),
|
PackageColumn* sizeColumn = new PackageColumn(fModel, B_TRANSLATE("Size"),
|
||||||
spacing + StringWidth(B_TRANSLATE("9999.99 KiB")), 50 * scale,
|
spacing + StringWidth("9999.99 KiB"), 50 * scale,
|
||||||
140 * scale, B_TRUNCATE_END);
|
140 * scale, B_TRUNCATE_END);
|
||||||
sizeColumn->SetAlignment(B_ALIGN_RIGHT);
|
sizeColumn->SetAlignment(B_ALIGN_RIGHT);
|
||||||
AddColumn(sizeColumn, kSizeColumn);
|
AddColumn(sizeColumn, kSizeColumn);
|
||||||
@@ -821,10 +886,22 @@ PackageListView::PackageListView(Model* model)
|
|||||||
SetColumnVisible(kRepositoryColumn, false);
|
SetColumnVisible(kRepositoryColumn, false);
|
||||||
// invisible by default
|
// invisible by default
|
||||||
|
|
||||||
|
float widthWithPlacboVersion = spacing
|
||||||
|
+ StringWidth("8.2.3176-2");
|
||||||
|
// average sort of version length as model
|
||||||
AddColumn(new PackageColumn(fModel, B_TRANSLATE("Version"),
|
AddColumn(new PackageColumn(fModel, B_TRANSLATE("Version"),
|
||||||
50 * scale, 50 * scale, 200 * scale,
|
widthWithPlacboVersion, widthWithPlacboVersion,
|
||||||
|
widthWithPlacboVersion + (50 * scale),
|
||||||
B_TRUNCATE_MIDDLE), kVersionColumn);
|
B_TRUNCATE_MIDDLE), kVersionColumn);
|
||||||
|
|
||||||
|
float widthWithPlaceboDate = spacing
|
||||||
|
+ StringWidth(LocaleUtils::TimestampToDateString(
|
||||||
|
static_cast<uint64>(1000)));
|
||||||
|
AddColumn(new PackageColumn(fModel, B_TRANSLATE("Date"),
|
||||||
|
widthWithPlaceboDate, widthWithPlaceboDate,
|
||||||
|
widthWithPlaceboDate + (50 * scale),
|
||||||
|
B_TRUNCATE_END), kVersionCreateTimestampColumn);
|
||||||
|
|
||||||
fItemCountView = new ItemCountView();
|
fItemCountView = new ItemCountView();
|
||||||
AddStatusView(fItemCountView);
|
AddStatusView(fItemCountView);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <Collator.h>
|
#include <Collator.h>
|
||||||
|
#include <DateFormat.h>
|
||||||
#include <DateTimeFormat.h>
|
#include <DateTimeFormat.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <LocaleRoster.h>
|
#include <LocaleRoster.h>
|
||||||
@@ -54,7 +55,23 @@ LocaleUtils::TimestampToDateTimeString(uint64 millis)
|
|||||||
BDateTimeFormat format;
|
BDateTimeFormat format;
|
||||||
BString buffer;
|
BString buffer;
|
||||||
if (format.Format(buffer, millis / 1000, B_SHORT_DATE_FORMAT,
|
if (format.Format(buffer, millis / 1000, B_SHORT_DATE_FORMAT,
|
||||||
B_SHORT_TIME_FORMAT) != B_OK)
|
B_SHORT_TIME_FORMAT) != B_OK)
|
||||||
|
return "!";
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ BString
|
||||||
|
LocaleUtils::TimestampToDateString(uint64 millis)
|
||||||
|
{
|
||||||
|
if (millis == 0)
|
||||||
|
return "?";
|
||||||
|
|
||||||
|
BDateFormat format;
|
||||||
|
BString buffer;
|
||||||
|
if (format.Format(buffer, millis / 1000, B_SHORT_DATE_FORMAT)
|
||||||
|
!= B_OK)
|
||||||
return "!";
|
return "!";
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ class LocaleUtils {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static BCollator* GetSharedCollator();
|
static BCollator* GetSharedCollator();
|
||||||
|
|
||||||
static BString TimestampToDateTimeString(uint64 millis);
|
static BString TimestampToDateTimeString(uint64 millis);
|
||||||
|
static BString TimestampToDateString(uint64 millis);
|
||||||
|
|
||||||
static BString CreateTranslatedIAmMinimumAgeSlug(int minimumAge);
|
static BString CreateTranslatedIAmMinimumAgeSlug(int minimumAge);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user