aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/notifier
diff options
context:
space:
mode:
authorGravatar Fabio Bas2009-07-09 16:42:36 +0000
committerGravatar Fabio Bas2009-07-09 16:42:36 +0000
commitb394f4cdf67119c0027318773a6ce9b005a06a30 (patch)
tree994c1ed1ac43bb302acc388e5594950a1fdf8475 /src/modules/notifier
parent[KVIrc] (trunk) It's qtsoftware.com since they were bought by Nokia. (diff)
downloadKVIrc-b394f4cdf67119c0027318773a6ce9b005a06a30.tar.gz
KVIrc-b394f4cdf67119c0027318773a6ce9b005a06a30.tar.bz2
KVIrc-b394f4cdf67119c0027318773a6ce9b005a06a30.zip
notifer second round: get rid of old options file and added a new menu entry + misc fixes
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3326 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/notifier')
-rw-r--r--src/modules/notifier/libkvinotifier.kvc28
-rw-r--r--src/modules/notifier/notifierwindow.cpp64
-rw-r--r--src/modules/notifier/notifierwindow.h24
3 files changed, 25 insertions, 91 deletions
diff --git a/src/modules/notifier/libkvinotifier.kvc b/src/modules/notifier/libkvinotifier.kvc
deleted file mode 100644
index 4625fe3b1..000000000
--- a/src/modules/notifier/libkvinotifier.kvc
+++ /dev/null
@@ -1,28 +0,0 @@
-[NotifierSkin]
-CloseX=233
-CloseY=5
-PrevX=233
-PrevY=26
-NextX=233
-NextY=82
-WriteX=233
-WriteY=103
-TextRect=6,22,223,97
-TitleRect=6,5,223,20
-TextFontFamily=Arial
-TextFontSize=9
-TitleFontFamily=Arial
-TitleFontSize=9
-CurTextColor=45,0,0
-OldTextColor1=40,20,20
-OldTextColor2=40,40,40
-OldTextColor3=60,60,60
-OldTextColor4=85,85,85
-OldTextColor5=90,90,90
-OldTextColor6=95,95,95
-HistoricTextColor=125,125,125
-TitleColor=120,70,70
-InputFontFamily=Arial
-InputFontSize=9
-InputHeight=19
-BlinkTimeout=650
diff --git a/src/modules/notifier/notifierwindow.cpp b/src/modules/notifier/notifierwindow.cpp
index 6f1462d28..e837225fc 100644
--- a/src/modules/notifier/notifierwindow.cpp
+++ b/src/modules/notifier/notifierwindow.cpp
@@ -87,37 +87,6 @@ KviNotifierWindow::KviNotifierWindow()
m_pWndBorder = new KviNotifierWindowBorder();
- reloadImages();
-
- QString buffer;
- g_pApp->getReadOnlyConfigPath(buffer,"libkvinotifier.kvc",KviApp::ConfigPlugins,true);
-
- KviConfig cfg(buffer,KviConfig::Read);
-
- cfg.setGroup("NotifierSkin");
-
- QString szFamily = cfg.readEntry("TextFontFamily","Arial");
- m_pDefaultFont = new QFont(szFamily,cfg.readIntEntry("TextFontSize",9));
- setFont(*m_pDefaultFont);
-
- szFamily = cfg.readEntry("TitleFontFamily","Arial");
- m_pTitleFont = new QFont(szFamily,cfg.readIntEntry("TitleFontSize",9));
-
- m_clrCurText = cfg.readColorEntry("CurTextColor",QColor(40,0,0));
- m_clrHistoricText = cfg.readColorEntry("HistoricTextColor",QColor(125,125,125));
- m_clrTitle = QColor(255,255,255);
- for(int i=0;i<NUM_OLD_COLORS;i++)
- {
- KviStr szKey;
- szKey.sprintf("OldTextColor%d",i + 1);
- m_clrOldText[i] = cfg.readColorEntry(szKey.ptr(),QColor(90,90,90));
- }
-
- m_iBlinkTimeout = cfg.readIntEntry("BlinkTimeout",650);
- if(m_iBlinkTimeout < 100)m_iBlinkTimeout = 100;
- m_iInputHeight = cfg.readIntEntry("InputHeight",20);
- if(m_iInputHeight < 10)m_iInputHeight = 10;
-
setFocusPolicy(Qt::NoFocus);
setMouseTracking(true);
@@ -169,8 +138,7 @@ KviNotifierWindow::KviNotifierWindow()
m_pLineEdit->installEventFilter(this);
connect(m_pLineEdit,SIGNAL(returnPressed()),this,SLOT(returnPressed()));
- szFamily = cfg.readEntry("InputFontFamily","Arial");
- m_pLineEdit->setFont(QFont(szFamily,cfg.readIntEntry("InputFontSize",9)));
+ updateGui();
QGridLayout *layout = new QGridLayout;
layout->addWidget(m_pProgressBar, 0,0,2,1);
@@ -182,7 +150,7 @@ KviNotifierWindow::KviNotifierWindow()
layout->setContentsMargins(5,25,5,5);
setLayout(layout);
- connect(g_pApp,SIGNAL(reloadImages()),this,SLOT(reloadImages()));
+ connect(g_pApp,SIGNAL(updateNotifier()),this,SLOT(updateGui()));
}
KviNotifierWindow::~KviNotifierWindow()
@@ -190,14 +158,20 @@ KviNotifierWindow::~KviNotifierWindow()
stopShowHideTimer();
stopBlinkTimer();
stopAutoHideTimer();
- delete m_pDefaultFont;
- delete m_pTitleFont;
delete m_pWndBorder;
delete m_pWndTabs;
}
-void KviNotifierWindow::reloadImages()
+void KviNotifierWindow::updateGui()
{
+ setFont(KVI_OPTION_FONT(KviOption_fontNotifier));
+ QPalette pal = palette();
+ pal.setColor(QPalette::Foreground, KVI_OPTION_COLOR(KviOption_colorNotifierForeground));
+ setPalette(pal);
+ QPalette palette=m_pLineEdit->palette();
+ palette.setColor(m_pLineEdit->foregroundRole(), KVI_OPTION_COLOR(KviOption_colorNotifierForeground));
+ m_pLineEdit->setPalette(palette);
+ m_pLineEdit->setFont(KVI_OPTION_FONT(KviOption_fontNotifier));
}
void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime)
@@ -516,7 +490,7 @@ void KviNotifierWindow::startBlinking()
m_pBlinkTimer = new QTimer();
connect(m_pBlinkTimer,SIGNAL(timeout()),this,SLOT(blink()));
m_iBlinkCount = 0;
- m_pBlinkTimer->start(m_iBlinkTimeout);
+ m_pBlinkTimer->start(1000);
}
}
@@ -578,9 +552,16 @@ void KviNotifierWindow::paintEvent(QPaintEvent *e)
{
QPoint pnt = mapToGlobal(e->rect().topLeft());
p.drawTiledPixmap(e->rect(),*(g_pShadedChildGlobalDesktopBackground), pnt);
- }
+ } else {
#endif
+ QPixmap * pPix = KVI_OPTION_PIXMAP(KviOption_pixmapNotifierBackground).pixmap();
+ p.fillRect(rect(),KVI_OPTION_COLOR(KviOption_colorNotifierBackground));
+ if(pPix)
+ KviPixmapUtils::drawPixmapWithPainter(&p,pPix,KVI_OPTION_UINT(KviOption_uintNotifierPixmapAlign),rect(),width(),height());
+#ifdef COMPILE_PSEUDO_TRANSPARENCY
+ }
+#endif
if(m_wndRect.width()!=m_pWndBorder->width() || m_wndRect.height()!=m_pWndBorder->height())
m_pWndBorder->resize( m_wndRect.size() );
@@ -591,8 +572,9 @@ void KviNotifierWindow::paintEvent(QPaintEvent *e)
m_pWndBorder->draw(&p);
}
- p.setPen(QPen(m_clrTitle));
- p.setFont(*m_pTitleFont);
+ p.setPen(KVI_OPTION_COLOR(KviOption_colorNotifierTitleForeground));
+ p.setFont(KVI_OPTION_FONT(KviOption_fontNotifierTitle));
+
QString title = "KVIrc - ";
KviNotifierWindowTab *tab = (KviNotifierWindowTab *)m_pWndTabs->currentWidget();
if(tab)
diff --git a/src/modules/notifier/notifierwindow.h b/src/modules/notifier/notifierwindow.h
index bd6104aa2..1a030d53d 100644
--- a/src/modules/notifier/notifierwindow.h
+++ b/src/modules/notifier/notifierwindow.h
@@ -37,7 +37,6 @@
#include <QColor>
#include <QCursor>
#include <QDateTime>
-#include <QFont>
#include <QImage>
#include <QLineEdit>
#include <QPixmap>
@@ -69,30 +68,15 @@ protected:
State m_eState;
bool m_bBlinkOn;
double m_dOpacity;
-// QImage m_imgDesktop; // the desktop screenshot
-// QPixmap m_pixBackground; // our background image
-// QPixmap m_pixBackgroundHighlighted;
-// QPixmap m_pixForeground; // we paint the stuff HERE
-//
-// // Notifier graphic layout
-// QPixmap m_pixBckgrnd;
bool m_bCloseDown;
bool m_bPrevDown;
bool m_bNextDown;
bool m_bWriteDown;
- bool m_bCrashShowWorkAround;
-
- QFont * m_pDefaultFont;
- QFont * m_pTitleFont;
+ bool m_bCrashShowWorkAround;
QRect m_wndRect;
- QColor m_clrCurText;
- QColor m_clrOldText[NUM_OLD_COLORS];
- QColor m_clrHistoricText;
- QColor m_clrTitle;
-
KviNotifierMessage * m_pCurrentMessage;
QLineEdit * m_pLineEdit;
@@ -106,8 +90,6 @@ protected:
QPoint m_pntDrag;
QPoint m_pntPos;
QPoint m_pntClick;
- int m_iInputHeight;
- int m_iBlinkTimeout;
int m_iBlinkCount;
KviTalPopupMenu * m_pContextPopup;
KviTalPopupMenu * m_pDisablePopup;
@@ -116,7 +98,6 @@ protected:
kvi_time_t m_tStartedAt;
QTime m_qtStartedAt;
bool m_bDisableHideOnMainWindowGotAttention;
- //bool m_bForceShowing;
QCursor m_cursor;
@@ -126,7 +107,6 @@ protected:
public:
void doShow(bool bDoAnimate);
void doHide(bool bDoAnimate);
- const QFont & defaultFont(){ return *m_pDefaultFont; };
int textWidth();
void addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime);
void setDisableHideOnMainWindowGotAttention(bool b){ m_bDisableHideOnMainWindowGotAttention = b; };
@@ -151,7 +131,7 @@ protected slots:
void blink();
void heartbeat();
void returnPressed();
- void reloadImages();
+ void updateGui();
void fillContextPopup();
void disableFor1Minute();
void disableFor5Minutes();