mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-18 20:01:15 +01:00
Started working on #12.
This commit is contained in:
parent
a8b8d830b4
commit
f719803140
@ -341,6 +341,7 @@ set(APP_SOURCES
|
||||
src/gui/dialogs/formdatabasecleanup.cpp
|
||||
src/gui/dialogs/formbackupdatabasesettings.cpp
|
||||
src/gui/dialogs/formrestoredatabasesettings.cpp
|
||||
src/gui/notifications/notification.cpp
|
||||
src/gui/systemtrayicon.cpp
|
||||
src/gui/baselineedit.cpp
|
||||
src/gui/locationlineedit.cpp
|
||||
@ -454,6 +455,7 @@ set(APP_HEADERS
|
||||
src/gui/dialogs/formrestoredatabasesettings.h
|
||||
src/gui/dialogs/formdatabasecleanup.h
|
||||
src/gui/dialogs/formupdate.h
|
||||
src/gui/notifications/notification.h
|
||||
src/gui/systemtrayicon.h
|
||||
src/gui/baselineedit.h
|
||||
src/gui/locationlineedit.h
|
||||
@ -700,6 +702,7 @@ include_directories (
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/gui
|
||||
${CMAKE_SOURCE_DIR}/src/gui/dialogs
|
||||
${CMAKE_SOURCE_DIR}/src/gui/notifications
|
||||
${CMAKE_SOURCE_DIR}/src/network-web
|
||||
${CMAKE_SOURCE_DIR}/src/network-web/adblock
|
||||
${CMAKE_SOURCE_DIR}/src/dynamic-shortcuts
|
||||
|
68
src/gui/notifications/notification.cpp
Normal file
68
src/gui/notifications/notification.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "gui/notifications/notification.h"
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
|
||||
Notification::Notification() : QWidget(0) {
|
||||
setupWidget();
|
||||
}
|
||||
|
||||
Notification::~Notification() {
|
||||
}
|
||||
|
||||
void Notification::setupWidget() {
|
||||
// Set window flags.
|
||||
Qt::WindowFlags window_flags = Qt::FramelessWindowHint | Qt::WindowSystemMenuHint |
|
||||
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint |
|
||||
Qt::WindowDoesNotAcceptFocus;
|
||||
|
||||
#if defined (Q_OS_MAC)
|
||||
window_flags |= Qt::SubWindow;
|
||||
#else
|
||||
window_flags |= Qt::Tool;
|
||||
#endif
|
||||
|
||||
setWindowFlags(window_flags);
|
||||
|
||||
// Set widget attributes.
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
setAttribute(Qt::WA_X11DoNotAcceptFocus);
|
||||
setAttribute(Qt::WA_ShowWithoutActivating);
|
||||
|
||||
#if defined (Q_OS_MAC)
|
||||
winId();
|
||||
|
||||
int setAttr[] = {kHIWindowBitDoesNotHide, kHIWindowBitDoesNotCycle, kHIWindowBitNoShadow, 0};
|
||||
int clearAttr[] = {0};
|
||||
HIWindowChangeAttributes(qt_mac_window_for(this), setAttr, clearAttr);
|
||||
#endif
|
||||
|
||||
// Window will be meant to be on top, but should not steal focus.
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
// TODO: pokracovat
|
||||
// https://github.com/binaryking/QNotify/blob/master/QNotify.cpp
|
||||
// http://stackoverflow.com/questions/5823700/notification-window-in-mac-with-or-without-qt
|
||||
// quiterss
|
||||
// a odkazy z issue
|
||||
// promyslet esli tam dat jen ciste label a ikonu, nebo i seznam nejnovesich zprav atp.
|
||||
}
|
40
src/gui/notifications/notification.h
Normal file
40
src/gui/notifications/notification.h
Normal file
@ -0,0 +1,40 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2015 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NOTIFICATION_H
|
||||
#define NOTIFICATION_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class Notification : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Notification();
|
||||
virtual ~Notification();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
void setupWidget();
|
||||
|
||||
};
|
||||
|
||||
#endif // NOTIFICATION_H
|
Loading…
Reference in New Issue
Block a user