Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 1 commit
  • 10 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 14, 2018
* Fixes #16
* Fixes #56
@@ -13,7 +13,7 @@ bool CheckMIME(BString mime,BNode* node);

BBitmap* LoadIcon(const char* name);
void AddIcon(const char* name,BBitmap*);

BBitmap* ResourceVectorToBitmap(const char *resName, float iconSize);


status_t ReadAttributeData(BNode* node,const char *name, char **buffer, int32 *size);
@@ -1,7 +1,9 @@
#include "Utils.h"
#include <Roster.h>
#include <Application.h>
#include <IconUtils.h>
#include <Path.h>
#include <Resources.h>
#include <View.h>

#include <Screen.h>
@@ -70,6 +72,29 @@ AddIcon(const char* name,BBitmap* icon){
}


BBitmap* ResourceVectorToBitmap(const char *resName, float iconSize)
{
BResources res;
size_t size;
app_info appInfo;

be_app->GetAppInfo(&appInfo);
BFile appFile(&appInfo.ref, B_READ_ONLY);
res.SetTo(&appFile);
BBitmap *aBmp = NULL;
const uint8* iconData = (const uint8*) res.LoadResource('VICN', resName, &size);

if (size > 0 ) {
aBmp = new BBitmap (BRect(0,0, iconSize, iconSize), 0, B_RGBA32);
status_t result = BIconUtils::GetVectorIcon(iconData, size, aBmp);
if (result != B_OK) {
delete aBmp;
aBmp = NULL;
}
}
return aBmp;
}

bool
CheckMIME(BString mime,BNode* node){

@@ -13,7 +13,7 @@ bool CheckMIME(BString mime,BNode* node);

BBitmap* LoadIcon(const char* name);
void AddIcon(const char* name,BBitmap*);

BBitmap* ResourceVectorToBitmap(const char *resName, float iconSize);


status_t ReadAttributeData(BNode* node,const char *name, char **buffer, int32 *size);
@@ -30,6 +30,8 @@ IABPChannelAddRequest::IABPChannelAddRequest(MainController* controller, MainWin

SetIcon(IAction::SIZE_16,LoadIcon("emblem-add.png"));
SetIcon(IAction::SIZE_48,LoadIcon("add-channel-file.png"));

SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("add-channel-file", 24));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("add-channel-file-down.png"));

SetLabel(B_TRANSLATE("Add channel"));
@@ -62,8 +64,8 @@ IABPChannelRemove::IABPChannelRemove(MainController* controller ,MainWindow* vie

SetIcon(IAction::SIZE_16,LoadIcon("delete-micro.png"));
SetIcon(IAction::SIZE_48,LoadIcon("delete-channel-file.png"));
SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("delete-channel-file", 24));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("delete-channel-file-down.png"));

SetLabel(B_TRANSLATE("Remove channel"));

}
@@ -85,14 +87,15 @@ IABPChannelRemove::Perform(BMessage*){

//TODO: studiare la disposizione dei pulsanti!
//TODO FIX THIS LOCALE
BBitmap *bitmap=new BBitmap( ((SubscriptionField*)row->GetField(0))->GetBitmap() );

BString text;

text << B_TRANSLATE("\nYou are going to remove the channel:\n\n");
text << row->GetTitle();
text << B_TRANSLATE("\n\nWould you like just to archive this channel (keeping all the files and enclosures downloaded so far) or do you want to DELETE the whole channel from you computer?");

BPAlert* remove = new BPAlert("Remove a channel", text.String(),B_TRANSLATE("Delete"),B_TRANSLATE("Archive"),B_TRANSLATE("Cancel"),B_WIDTH_AS_USUAL,LoadIcon("delete-channel-file.png"));
BPAlert* remove = new BPAlert("Remove a channel", text.String(),B_TRANSLATE("Delete"),B_TRANSLATE("Archive"),B_TRANSLATE("Cancel"),B_WIDTH_AS_USUAL,bitmap);
int32 result=remove->Go();

LOCKWINDOW
@@ -102,7 +105,7 @@ IABPChannelRemove::Perform(BMessage*){
if(result==0){
BPAlert* wait = new BPAlert(B_TRANSLATE("Remove a channel"),
B_TRANSLATE("\nRemoving" B_UTF8_ELLIPSIS),NULL,NULL,NULL,
B_WIDTH_AS_USUAL,LoadIcon("delete-channel-file.png"));
B_WIDTH_AS_USUAL,bitmap);
fView->UpdateIfNeeded();
wait->Go(NULL);

@@ -114,15 +117,12 @@ IABPChannelRemove::Perform(BMessage*){
wait = new BPAlert(B_TRANSLATE("Remove a channel"),
B_TRANSLATE("\nAn error occured while removing!"),
B_TRANSLATE("OK"),NULL,NULL,B_WIDTH_AS_USUAL,
LoadIcon("delete-channel-file.png"));

bitmap);
wait->Go();
}


}
UNLOCKWINDOW

delete bitmap;
return B_OK;
}

@@ -138,6 +138,9 @@ IABPChannelRemove::Shortcut(uint32 *modifiers) const {
IABPChannelCheck::IABPChannelCheck(MainController* controller,MainWindow* view):IActionBP(controller,view){

SetIcon(IAction::SIZE_16,LoadIcon("refresh-micro.png"));

SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("refresh-channel-file", 24));

SetIcon(IAction::SIZE_48,LoadIcon("refresh-channel-file.png"));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("refresh-channel-file-down.png"));

@@ -174,6 +177,9 @@ IABPChannelCheck::Shortcut(uint32 *modifiers) const {
IABPChannelWWW::IABPChannelWWW(MainController* controller,MainWindow* view):IActionBP(controller,view){

SetIcon(IAction::SIZE_16,LoadIcon("www-micro.png"));

SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("www-channel-file", 24));

SetIcon(IAction::SIZE_48,LoadIcon("www-channel-file.png"));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("www-channel-file-down.png"));

@@ -19,10 +19,11 @@
#define B_TRANSLATION_CONTEXT "IABPItem"

IABPItemRemove::IABPItemRemove(MainController* controller,MainWindow* view):IActionBP(controller,view){

SetIcon(IAction::SIZE_16,LoadIcon("delete-micro.png"));

SetIcon(IAction::SIZE_48,LoadIcon("emblem-delete.png"));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("emblem-delete-down.png"));
SetIcon(IAction::SIZE_16,ResourceVectorToBitmap("emblem-delete", 16));
SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("emblem-delete", 24));

SetLabel(B_TRANSLATE("Remove item"));
}
@@ -105,10 +106,12 @@ IABPItemRemove::Shortcut(uint32 *modifiers) const {


IABPItemStop::IABPItemStop(MainController* controller,MainWindow* view):IActionBP(controller,view){

SetIcon(IAction::SIZE_16,LoadIcon("stopped-micro.png"));

SetIcon(IAction::SIZE_48,LoadIcon("emblem-stop.png"));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("emblem-stop-down.png"));

SetIcon(IAction::SIZE_16,ResourceVectorToBitmap("emblem-stop", 16));
SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("emblem-stop", 24));

SetLabel(B_TRANSLATE("Stop download"));
}
@@ -146,10 +149,12 @@ IABPItemStop::Shortcut(uint32 *modifiers) const {

IABPItemDownload::IABPItemDownload(MainController* controller,MainWindow* view):IActionBP(controller,view){

SetIcon(IAction::SIZE_16,LoadIcon("download-micro.png"));

SetIcon(IAction::SIZE_16,ResourceVectorToBitmap("emblem-download", 16));

SetIcon(IAction::SIZE_48,LoadIcon("emblem-download.png"));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("emblem-download-down.png"));
SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("emblem-download", 24));
SetLabel(B_TRANSLATE("(Re)start download"));
}

@@ -185,9 +190,11 @@ IABPItemDownload::Shortcut(uint32 *modifiers) const {


IABPItemPlay::IABPItemPlay(MainController* controller,MainWindow* view):IActionBP(controller,view){

SetIcon(IAction::SIZE_16,LoadIcon("play-micro.png"));

SetIcon(IAction::SIZE_48,LoadIcon("emblem-play.png"));

SetIcon(IAction::SIZE_16,ResourceVectorToBitmap("emblem-play", 16));
SetIcon(IAction::SIZE_24,ResourceVectorToBitmap("emblem-play", 24));
SetIcon(IAction::SIZE_48_PRESSED,LoadIcon("emblem-play-down.png"));

SetLabel(B_TRANSLATE("Play enclosure"));
@@ -16,6 +16,7 @@ class IAction : public Action

enum IconType {
SIZE_16 = 0,
SIZE_24,
SIZE_48,
SIZE_48_PRESSED,
//.... add other there!

No commit comments for this range

You can’t perform that action at this time.