Show error status icon in feed list
This commit is contained in:
parent
c80fd94452
commit
2834ed4227
2
Makefile
2
Makefile
|
@ -53,6 +53,8 @@ RDEFS = \
|
|||
src/Pogger.rdef \
|
||||
art/FeedIcon.rdef \
|
||||
art/EntryIcon.rdef \
|
||||
art/DownloadStatus.rdef \
|
||||
art/ErrorStatus.rdef \
|
||||
|
||||
|
||||
# Specify the resource files to use. Full or relative paths can be used.
|
||||
|
|
2
TODO.txt
2
TODO.txt
|
@ -1,5 +1,4 @@
|
|||
Important Features:
|
||||
* Show progress in FeedView's feedlist as icons
|
||||
* Show in desktray
|
||||
* Make archivable
|
||||
* Get menu working
|
||||
|
@ -19,6 +18,7 @@ Important improvements:
|
|||
* General input sanitization
|
||||
* File error-handling
|
||||
* e.g., Utils.cpp's userFileError
|
||||
* Fix background of Feeds List error status icon (it's black, not transparent)
|
||||
* Check if arg is a file or not (treat appropriately)
|
||||
* Make UI friendly to whatever font-size you throw at it
|
||||
* Give a max size to the progress label in FeedsView
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,8 @@
|
|||
|
||||
resource(3, "download-status") #'VICN' array {
|
||||
$"6E6369660304006603BB5205020006020000003C6000C000000000004C000048"
|
||||
$"A00000D58E05FFFFD27C010A07352248363E363E482C482C362236030A000100"
|
||||
$"12C0A3232D8566AD8573C0A32D4BF6834BD6C801178322040A01010012C0A323"
|
||||
$"2D8566AD8573C0A32D4BD0C34BD0ED01178322040A02010002C0A3232D8566AD"
|
||||
$"8573C0A32D4BD0C34BD0ED"
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
resource(2, "entry-type-icon") #'VICN' array {
|
||||
resource(2, "entry-type") #'VICN' array {
|
||||
$"6E636966090401740501020106023B32F3BB51843CAA363C91AA45272C4AD4C6"
|
||||
$"00FCFAF4FF808076020116023B32F3BB51843CAA363C91AA45272C4AD4C600AC"
|
||||
$"FF01020106023B32F3BB51843CAA363C91AA45272C4AD4C600FF90AAFB6D021B"
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
|
||||
resource(4, "error-status") #'VICN' array {
|
||||
$"6E6369660304006603800000020006020000003C2000C000000000004C000048"
|
||||
$"E00000FFABABFFD90000010A0C482A4022352D2A22222A2D3522402A48353D40"
|
||||
$"4848403D35030A000100302C2C01178322040A010100302A2A01178322040A02"
|
||||
$"0100202A2A"
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
resource(1, "feed-type-icon") #'VICN' array {
|
||||
resource(1, "feed-type") #'VICN' array {
|
||||
$"6E6369660603010000020006023CC7EE389BC0BA16573E39B04977C842ADC700"
|
||||
$"FFE2BAFFFF9500020016023CC7EE389BC0BA16573E39B04977C842ADC700FFFF"
|
||||
$"E7020006023C96323A4D3FBAFC013D5A974B57A549844D00992600FFBF500002"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
These cons are copied over from Haiku's source tree at
|
||||
The mimetype icons (FeedIcon and EntryIcon) and status icons (DownloadStatus,
|
||||
ErrorStatus) are all copied over from Haiku's source tree at:
|
||||
haiku/data/artwork/icons/File_RSS_Feed
|
||||
haiku/data/artwork/icons/Server_NewsFeed
|
||||
haiku/data/artwork/icons/Action_GoDown_3
|
||||
haiku/data/artwork/icons/Action_Stop_1
|
||||
|
||||
As far as I can tell, they aren't included in base installs. We just use them
|
||||
as the mimetype icons for application/x-feed-source and text/x-feed-entry.
|
||||
|
||||
They're under the MIT license, as per haiku/data/artwork/ReadMe
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <View.h>
|
||||
|
||||
#include "Feed.h"
|
||||
#include "Util.h"
|
||||
|
||||
|
||||
FeedListItem::FeedListItem(Feed* feed)
|
||||
|
@ -25,22 +26,23 @@ FeedListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
|||
{
|
||||
BStringItem::DrawItem(owner, frame, complete);
|
||||
|
||||
owner->MovePenTo(frame.right - 20, frame.top + BaselineOffset());
|
||||
font_height fontHeight;
|
||||
owner->GetFontHeight(&fontHeight);
|
||||
int16 imageHeight = int16(fontHeight.ascent + fontHeight.descent + 6);
|
||||
|
||||
switch (fStatus) {
|
||||
case kDownloadingStatus:
|
||||
{
|
||||
owner->DrawString("…");
|
||||
break;
|
||||
}
|
||||
case kParsingStatus:
|
||||
{
|
||||
owner->DrawString("―");
|
||||
owner->MovePenTo(frame.right - 20, frame.top + BaselineOffset());
|
||||
owner->DrawString("…");
|
||||
break;
|
||||
}
|
||||
case kErrorStatus:
|
||||
{
|
||||
owner->DrawString("X");
|
||||
owner->MovePenTo(frame.right - imageHeight, frame.top);
|
||||
owner->DrawBitmap(loadVectorIcon("error-status", imageHeight,
|
||||
imageHeight));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ feedMimeType()
|
|||
|
||||
BResources* res = BApplication::AppResources();
|
||||
size_t length = 0;
|
||||
const void* data = res->LoadResource(B_VECTOR_ICON_TYPE, "feed-type-icon", &length);
|
||||
const void* data = res->LoadResource(B_VECTOR_ICON_TYPE, "feed-type", &length);
|
||||
mime.SetIcon((uint8*)data, length);
|
||||
|
||||
mime.SetPreferredApp("application/x-vnd.Pogger");
|
||||
|
@ -61,7 +61,7 @@ feedEntryMimeType()
|
|||
|
||||
BResources* res = BApplication::AppResources();
|
||||
size_t length = 0;
|
||||
const void* data = res->LoadResource(B_VECTOR_ICON_TYPE, "entry-type-icon", &length);
|
||||
const void* data = res->LoadResource(B_VECTOR_ICON_TYPE, "entry-type", &length);
|
||||
mime.SetIcon((uint8*)data, length);
|
||||
|
||||
mime.SetPreferredApp("application/x-vnd.Pogger");
|
||||
|
|
30
src/Util.cpp
30
src/Util.cpp
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
|
||||
* Copyight 2017 Akshay Agarwal, agarwal.akshay.akshay8@gmail.com
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
*/
|
||||
|
||||
|
@ -8,9 +9,13 @@
|
|||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <Application.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Directory.h>
|
||||
#include <File.h>
|
||||
#include <IconUtils.h>
|
||||
#include <OS.h>
|
||||
#include <Resources.h>
|
||||
#include <Url.h>
|
||||
#include <UrlProtocolRoster.h>
|
||||
#include <UrlRequest.h>
|
||||
|
@ -191,3 +196,28 @@ tempHtmlFile(entry_ref* ref, const char* title)
|
|||
}
|
||||
|
||||
|
||||
BBitmap*
|
||||
loadVectorIcon(const char* name, int32 iconSize, int32 cropSize)
|
||||
{
|
||||
BResources* res = BApplication::AppResources();
|
||||
size_t length = 0;
|
||||
const void* data = res->LoadResource(B_VECTOR_ICON_TYPE, name, &length);
|
||||
BBitmap* temp = new BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1),
|
||||
B_BITMAP_NO_SERVER_LINK, B_RGBA32);
|
||||
BBitmap* dest = new BBitmap(BRect(0, 0, cropSize - 1, cropSize - 1),
|
||||
B_RGBA32);
|
||||
if (data != NULL
|
||||
&& BIconUtils::GetVectorIcon((uint8*)data, length, temp)
|
||||
== B_OK
|
||||
&& dest->ImportBits(temp, BPoint(0, 0), BPoint(0, 0),
|
||||
cropSize, cropSize) == B_OK) {
|
||||
delete temp;
|
||||
return dest;
|
||||
}
|
||||
|
||||
delete temp;
|
||||
delete dest;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
|
||||
* Copyight 2017 Akshay Agarwal, agarwal.akshay.akshay8@gmail.com
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
*/
|
||||
#ifndef UTIL_H
|
||||
|
@ -9,6 +10,7 @@
|
|||
|
||||
#include "ProtocolListener.h"
|
||||
|
||||
class BBitmap;
|
||||
class BUrl;
|
||||
|
||||
|
||||
|
@ -34,6 +36,9 @@ void userFileError(status_t status, const char* path);
|
|||
// temporary copy. Returns an entry_ref to said temporary copy.
|
||||
entry_ref tempHtmlFile(entry_ref* ref, const char* title);
|
||||
|
||||
// Ripped from Calendar (utils/ResourceLoader.cpp)
|
||||
BBitmap* loadVectorIcon(const char* name, int32 iconSize = 32,
|
||||
int32 cropSize = 22);
|
||||
|
||||
#endif // UTIL_H
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue