source: psi/trunk/src/options/opt_events.cpp@ 20

Last change on this file since 20 was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 4.7 KB
Line 
1#include "opt_events.h"
2#include "common.h"
3#include "iconwidget.h"
4
5#include <qbuttongroup.h>
6#include <qwhatsthis.h>
7#include <qcheckbox.h>
8#include <qradiobutton.h>
9#include <qlabel.h>
10#include <qcombobox.h>
11#include <qlineedit.h>
12
13#include "opt_events-ui.h"
14
15//----------------------------------------------------------------------------
16// OptionsTabEvents
17//----------------------------------------------------------------------------
18
19OptionsTabEvents::OptionsTabEvents(QObject *parent)
20: OptionsTab(parent, "events", "", tr("Events"), tr("The events behaviour"), "psi/events")
21{
22 w = 0;
23}
24
25QWidget *OptionsTabEvents::widget()
26{
27 if ( w )
28 return 0;
29
30 w = new OptEventsUI();
31 OptEventsUI *d = (OptEventsUI *)w;
32 connect(d->bg_alerts, SIGNAL(clicked(int)), SLOT(selectAlertStyle(int)));
33
34 QWhatsThis::add(d->ck_popupMsgs,
35 tr("Makes new incoming message windows pop up automatically when received."));
36 QWhatsThis::add(d->ck_popupHeadlines,
37 tr("Makes new incoming headlines pop up automatically when received."));
38 QWhatsThis::add(d->ck_popupFiles,
39 tr("Makes new incoming file requests pop up automatically when received."));
40 QWhatsThis::add(d->ck_allowAwayPopup,
41 tr("Normally, Psi will not autopopup events when you are away. "
42 "Set this option if you want them to popup anyway."));
43 QWhatsThis::add(d->ck_allowUnlistedPopup,
44 tr("Normally, Psi will not autopopup events from users not in your roster. "
45 "Set this option if you want them to popup anyway."));
46 QWhatsThis::add(d->ck_raise,
47 tr("Makes new incoming events bring the main window to the foreground."));
48 QWhatsThis::add(d->ck_ignoreNonRoster,
49 tr("Makes Psi ignore all incoming events from contacts"
50 " not already in your list of contacts."));
51 QWhatsThis::add(d->rb_aSolid,
52 tr("Does not animate or blink incoming event icons on the main window as they are received."));
53 QWhatsThis::add(d->rb_aBlink,
54 tr("Makes all incoming event icons blink on the main window as events are received."));
55 QWhatsThis::add(d->rb_aAnimate,
56 tr("Animates incoming event icons on the main window as events are recieved."));
57 QWhatsThis::add(d->ck_autoAuth,
58 tr("Makes Psi automatically accept all authorization requests from <b>anyone</b>."));
59 QWhatsThis::add(d->ck_notifyAuth,
60 tr("Makes Psi notify you when your authorization request was approved."));
61
62#ifndef Q_WS_MAC
63 d->cb_bounce->hide();
64 d->lb_bounce->hide();
65#endif
66
67 return w;
68}
69
70void OptionsTabEvents::applyOptions(Options *opt)
71{
72 if ( !w )
73 return;
74
75 OptEventsUI *d = (OptEventsUI *)w;
76 opt->popupMsgs = d->ck_popupMsgs->isChecked();
77 opt->popupChats = d->ck_popupMsgs->isChecked();
78 opt->popupHeadlines = d->ck_popupHeadlines->isChecked();
79 opt->popupFiles = d->ck_popupFiles->isChecked();
80 opt->noAwayPopup = !d->ck_allowAwayPopup->isChecked();
81 opt->noUnlistedPopup = !d->ck_allowUnlistedPopup->isChecked();
82 opt->raise = d->ck_raise->isChecked();
83 opt->ignoreNonRoster = d->ck_ignoreNonRoster->isChecked();
84 opt->alertStyle = alertStyle;
85 opt->autoAuth = d->ck_autoAuth->isChecked();
86 opt->notifyAuth = d->ck_notifyAuth->isChecked();
87 opt->bounceDock = (Options::BounceDockSetting) d->cb_bounce->currentItem();
88
89 opt->ppIsOn = d->ck_popupOn->isChecked();
90 opt->ppMessage = d->ck_popupOnMessage->isChecked();
91 opt->ppChat = d->ck_popupOnMessage->isChecked();
92 opt->ppHeadline = d->ck_popupOnHeadline->isChecked();
93 opt->ppFile = d->ck_popupOnFile->isChecked();
94 opt->ppOnline = d->ck_popupOnOnline->isChecked();
95 opt->ppOffline = d->ck_popupOnOffline->isChecked();
96 opt->ppStatus = d->ck_popupOnStatus->isChecked();
97}
98
99void OptionsTabEvents::restoreOptions(const Options *opt)
100{
101 if ( !w )
102 return;
103
104 OptEventsUI *d = (OptEventsUI *)w;
105 d->ck_popupMsgs->setChecked( opt->popupMsgs || opt->popupChats );
106 d->ck_popupHeadlines->setChecked( opt->popupHeadlines );
107 d->ck_popupFiles->setChecked( opt->popupFiles );
108 d->ck_allowAwayPopup->setChecked( !opt->noAwayPopup );
109 d->ck_allowUnlistedPopup->setChecked( !opt->noUnlistedPopup );
110 d->ck_raise->setChecked( opt->raise );
111 d->ck_ignoreNonRoster->setChecked( opt->ignoreNonRoster );
112 alertStyle = opt->alertStyle;
113 d->bg_alerts->setButton( alertStyle );
114 d->ck_autoAuth->setChecked( opt->autoAuth );
115 d->ck_notifyAuth->setChecked( opt->notifyAuth );
116 d->cb_bounce->setCurrentItem( opt->bounceDock );
117
118 d->ck_popupOn->setChecked( true );
119 d->ck_popupOn->setChecked( opt->ppIsOn );
120 d->ck_popupOnMessage->setChecked( opt->ppMessage || opt->ppChat );
121 d->ck_popupOnHeadline->setChecked( opt->ppHeadline );
122 d->ck_popupOnFile->setChecked( opt->ppFile );
123 d->ck_popupOnOnline->setChecked( opt->ppOnline );
124 d->ck_popupOnOffline->setChecked( opt->ppOffline );
125 d->ck_popupOnStatus->setChecked( opt->ppStatus );
126}
127
128void OptionsTabEvents::selectAlertStyle(int a)
129{
130 alertStyle = a;
131}
Note: See TracBrowser for help on using the repository browser.