Patch by plfiorini: Integration of InfoPopper as a system service. See ticket

#1245. There are some TODOs outlined in the ticket, but they will be much
easier to review as individual patches against trunk, versus as a new version
of the huge patch.

I've messed a lot with src/servers/notification/NotificationsView.cpp in order
to resolve a crash I was getting when testing this thing (rewrote line
wrapping). I've also replaced the icons with the one that zuMi did long ago.

Thanks, plfiorini, for working on this code as much as you did!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36949 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-05-27 14:48:27 +00:00
parent 279d26af87
commit de9dcd41f8
50 changed files with 5460 additions and 4 deletions
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright 2010, Haiku, Inc. All Rights Reserved.
* Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
* Copyright 2004-2008, Michael Davidson. All Rights Reserved.
* Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _APP_USAGE_H
#define _APP_USAGE_H
#include <map>
#include <Entry.h>
#include <Flattenable.h>
#include <Notification.h>
#include <Roster.h>
#include <String.h>
class BMessage;
class NotificationReceived;
typedef std::map<BString, NotificationReceived*> notify_t;
class AppUsage : public BFlattenable {
public:
AppUsage();
AppUsage(entry_ref ref, const char* name,
bool allow = true);
~AppUsage();
virtual bool AllowsTypeCode(type_code code) const;
virtual status_t Flatten(void* buffer, ssize_t numBytes) const;
virtual ssize_t FlattenedSize() const;
virtual bool IsFixedSize() const;
virtual type_code TypeCode() const;
virtual status_t Unflatten(type_code code, const void* buffer,
ssize_t numBytes);
entry_ref Ref();
const char* Name();
bool Allowed(const char* title, notification_type type);
bool Allowed();
NotificationReceived* NotificationAt(int32 index);
int32 Notifications();
void AddNotification(NotificationReceived* notification);
private:
entry_ref fRef;
BString fName;
bool fAllow;
notify_t fNotifications;
};
#endif // _APP_USAGE_H
@@ -0,0 +1,46 @@
/*
* Copyright 2010, Haiku, Inc. All Rights Reserved.
* Copyright 2008-2009, Pier Luigi Fiorini. All Rights Reserved.
* Copyright 2004-2008, Michael Davidson. All Rights Reserved.
* Copyright 2004-2007, Mikael Eiman. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFICATION_RECEIVED_H
#define _NOTIFICATION_RECEIVED_H
#include <Flattenable.h>
#include <Roster.h>
#include <String.h>
class NotificationReceived : public BFlattenable {
public:
NotificationReceived();
NotificationReceived(const char* title, notification_type type,
bool enabled = true);
~NotificationReceived();
virtual bool AllowsTypeCode(type_code code) const;
virtual status_t Flatten(void *buffer, ssize_t numBytes) const;
virtual ssize_t FlattenedSize() const;
virtual bool IsFixedSize() const;
virtual type_code TypeCode() const;
virtual status_t Unflatten(type_code code, const void *buffer,
ssize_t numBytes);
const char* Title();
notification_type Type();
void SetType(notification_type type);
time_t LastReceived();
bool Allowed();
void SetTimeStamp(time_t time);
void UpdateTimeStamp();
private:
BString fTitle;
notification_type fType;
bool fEnabled;
time_t fLastReceived;
};
#endif // _NOTIFICATION_RECEIVED_H
@@ -0,0 +1,45 @@
/*
* Copyright 2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFICATIONS_H
#define _NOTIFICATIONS_H
#include <Mime.h>
#define kNotificationServerSignature "application/x-vnd.Haiku-notification_server"
// Messages
const uint32 kNotificationMessage = 'nssm';
// Notification layout
enum infoview_layout {
TitleAboveIcon = 0,
AllTextRightOfIcon = 1
};
// Settings constants
extern const char* kSettingsDirectory;
extern const char* kFiltersSettings;
extern const char* kGeneralSettings;
extern const char* kDisplaySettings;
// General settings
extern const char* kAutoStartName;
extern const char* kTimeoutName;
// General default settings
const float kDefaultAutoStart = false;
const int32 kDefaultTimeout = 10;
// Display settings
extern const char* kWidthName;
extern const char* kIconSizeName;
extern const char* kLayoutName;
// Display default settings
const float kDefaultWidth = 300.0f;
const icon_size kDefaultIconSize = B_LARGE_ICON;
const infoview_layout kDefaultLayout = TitleAboveIcon;
#endif // _NOTIFICATIONS_H