Notifications preflet and notification_server

Notifications preflet:
-Use sliders instead of text fields for width and timeout
-Remove icon size choice (mini icon looks horrible)
-Consolidate both "Enable" checkboxes into one
-Fix Revert button, remove Apply button, add Defaults button
-All changes to settings saved immediately
-Live example notification message shown when settings changes are made
-Add setting for individual apps to specify whether their notifications
	should be muted
-Remove history list (to be implemented later)

BNotification class:
-BNotification records the signature and name of application that
	created it
-New functions to get source application signature and name

Notification Server:
-Notification pop up view layout fixes and bold font size fix
-Remove notifications history from AppUsage class (will be saved in
	cache instead)
-Remove vector of NotificationView objects which isn't needed
-Get source application info from notification object, not the received
	message which is not reliable
This commit is contained in:
Brian Hill
2017-09-23 11:41:33 -04:00
parent 7cb920e579
commit 6aa0587222
31 changed files with 1045 additions and 880 deletions
+6 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, Haiku, Inc. All Rights Reserved.
* Copyright 2010-2017, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFICATION_H
@@ -34,6 +34,9 @@ public:
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive, bool deep = true) const;
const char* SourceSignature() const;
const char* SourceName() const;
notification_type Type() const;
const char* Group() const;
@@ -73,6 +76,8 @@ public:
private:
status_t fInitStatus;
BString fSourceSignature;
BString fSourceName;
notification_type fType;
BString fGroup;
BString fTitle;
+7 -12
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, Haiku, Inc. All Rights Reserved.
* Copyright 2010-2017, 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.
@@ -17,16 +17,13 @@
#include <String.h>
class BMessage;
class NotificationReceived;
typedef std::map<BString, NotificationReceived*> notification_t;
class AppUsage : public BFlattenable {
public:
AppUsage();
AppUsage(const char* name,
const char* signature,
bool allow = true);
~AppUsage();
virtual bool AllowsTypeCode(type_code code) const;
virtual status_t Flatten(void* buffer, ssize_t numBytes) const;
@@ -36,17 +33,15 @@ public:
virtual status_t Unflatten(type_code code, const void* buffer,
ssize_t numBytes);
const char* Name();
bool Allowed(const char* title, notification_type type);
const char* AppName();
const char* Signature();
bool Allowed();
NotificationReceived* NotificationAt(int32 index);
int32 Notifications();
void AddNotification(NotificationReceived* notification);
void SetAllowed(bool allow);
private:
BString fName;
BString fAppName;
BString fSignature;
bool fAllow;
notification_t fNotifications;
};
#endif // _APP_USAGE_H
+9 -8
View File
@@ -1,11 +1,12 @@
/*
* Copyright 2010-2014, Haiku, Inc. All Rights Reserved.
* Copyright 2010-2017, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFICATIONS_H
#define _NOTIFICATIONS_H
#include <Mime.h>
#include <String.h>
#define kNotificationServerSignature "application/x-vnd.Haiku-notification_server"
@@ -18,18 +19,18 @@ extern const char* kSettingsFile;
// General settings
extern const char* kAutoStartName;
extern const char* kTimeoutName;
extern const char* kWidthName;
extern const char* kIconSizeName;
// General default settings
const bool kDefaultAutoStart = true;
const int32 kDefaultTimeout = 10;
// Display settings
extern const char* kWidthName;
extern const char* kIconSizeName;
extern const char* kLayoutName;
// Display default settings
const int32 kMinimumTimeout = 3;
const int32 kMaximumTimeout = 30;
const float kDefaultWidth = 300.0f;
const float kMinimumWidth = 300.0f;
const float kMaximumWidth = 1000.0f;
const int32 kWidthStep = 50;
const icon_size kDefaultIconSize = B_LARGE_ICON;
#endif // _NOTIFICATIONS_H