diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/common.h psi-0.10-test3/src/common.h --- psi-0.10-test3-orig/src/common.h 2005-11-08 22:16:14.000000000 +0000 +++ psi-0.10-test3/src/common.h 2005-11-08 23:02:04.000000000 +0000 @@ -118,6 +118,7 @@ bool use_asMessage; QString asMessage; QString onevent[10]; + bool oneventIsActive[10]; int smChars; // int smChars, smLines; diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/options/optionstab.h psi-0.10-test3/src/options/optionstab.h --- psi-0.10-test3-orig/src/options/optionstab.h 2005-08-22 19:52:28.000000000 +0000 +++ psi-0.10-test3/src/options/optionstab.h 2005-11-08 23:02:04.000000000 +0000 @@ -5,6 +5,7 @@ #include #include #include +#include struct Options; class Icon; diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/options/opt_sound.cpp psi-0.10-test3/src/options/opt_sound.cpp --- psi-0.10-test3-orig/src/options/opt_sound.cpp 2005-08-22 19:52:28.000000000 +0000 +++ psi-0.10-test3/src/options/opt_sound.cpp 2005-11-08 23:02:04.000000000 +0000 @@ -21,7 +21,7 @@ : OptionsTab(parent, "sound", "", tr("Sound"), tr("Configure how Psi sounds"), "psi/playSounds") { w = 0; - bg_se = bg_sePlay = 0; + bg_chb = bg_se = bg_sePlay = 0; } OptionsTabSound::~OptionsTabSound() @@ -30,6 +30,8 @@ delete bg_se; if ( bg_sePlay ) delete bg_sePlay; + if ( bg_chb ) + delete bg_chb; } QWidget *OptionsTabSound::widget() @@ -40,6 +42,7 @@ w = new OptSoundUI(); OptSoundUI *d = (OptSoundUI *)w; + // textboxes array le_oe[0] = d->le_oeMessage; le_oe[1] = d->le_oeChat1; le_oe[2] = d->le_oeChat2; @@ -51,6 +54,23 @@ le_oe[8] = d->le_oeIncomingFT; le_oe[9] = d->le_oeFTComplete; + // checkboxes button group + // will keep them together and manages the signals + bg_chb = new QButtonGroup; + bg_chb->insert(d->chb_seMessage, 0); + bg_chb->insert(d->chb_seChat1, 1); + bg_chb->insert(d->chb_seChat2, 2); + bg_chb->insert(d->chb_seHeadline, 3); + bg_chb->insert(d->chb_seSystem, 4); + bg_chb->insert(d->chb_seOnline, 5); + bg_chb->insert(d->chb_seOffline, 6); + bg_chb->insert(d->chb_seSend, 7); + bg_chb->insert(d->chb_seIncomingFT, 8); + bg_chb->insert(d->chb_seFTComplete, 9); + connect(bg_chb, SIGNAL(clicked(int)), SLOT(disableSoundEvent(int))); + + // buttons for open file button group + // manages the signals of the buttons bg_se = new QButtonGroup; bg_se->insert(d->tb_seMessage, 0); bg_se->insert(d->tb_seChat1, 1); @@ -64,6 +84,8 @@ bg_se->insert(d->tb_seFTComplete, 9); connect(bg_se, SIGNAL(clicked(int)), SLOT(chooseSoundEvent(int))); + // buttons for play sound button group + // manages the signals of the buttons bg_sePlay = new QButtonGroup; bg_sePlay->insert(d->tb_seMessagePlay, 0); bg_sePlay->insert(d->tb_seChat1Play, 1); @@ -80,14 +102,13 @@ connect(d->pb_soundReset, SIGNAL(clicked()), SLOT(soundReset())); // set up proper tool button icons - int n; - for (n = 0; n < 10; n++) { + for (int n=0; n<10; n++) { IconToolButton *tb = (IconToolButton *)bg_se->find(n); tb->setIcon( IconsetFactory::iconPtr("psi/browse") ); tb = (IconToolButton *)bg_sePlay->find(n); tb->setIcon( IconsetFactory::iconPtr("psi/play") ); } - + // TODO: add QWhatsThis for all widgets QWhatsThis::add(d->le_player, @@ -119,8 +140,10 @@ opt->noAwaySound = !d->ck_awaySound->isChecked(); opt->noGCSound = !d->ck_gcSound->isChecked(); - for(int n = 0; n < 10; ++n) + for(int n = 0; n < 10; ++n) { opt->onevent[n] = le_oe[n]->text(); + opt->oneventIsActive[n] = ((QCheckBox*)bg_chb->find(n))->isChecked(); + } } void OptionsTabSound::restoreOptions(const Options *opt) @@ -141,8 +164,17 @@ d->ck_awaySound->setChecked( !opt->noAwaySound ); d->ck_gcSound->setChecked( !opt->noGCSound ); - for(int n = 0; n < 10; ++n) + // set the files in the textboxes and the state in the enable-sound-checkbuttons + for(int n = 0; n < 10; ++n) { le_oe[n]->setText(opt->onevent[n]); + ((QCheckBox*)bg_chb->find(n))->setChecked(opt->oneventIsActive[n]); + } + + // disable sound i line if opt->oneventIsActive[i] is false + // disableSounEvent makes it reading the state of the checkboxes + for(int i=0; i<10; i++) { + disableSoundEvent(i); + } } void OptionsTabSound::setData(PsiCon *, QWidget *p) @@ -168,6 +200,14 @@ soundPlay(le_oe[x]->text()); } +void OptionsTabSound::disableSoundEvent(int x) +{ + QCheckBox* check = (QCheckBox*) bg_chb->find(x); + le_oe[x]->setEnabled(check->isChecked()); + (bg_se->find(x))->setEnabled(check->isChecked()); + (bg_sePlay->find(x))->setEnabled(check->isChecked()); +} + void OptionsTabSound::soundReset() { Options opt; diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/options/opt_sound.h psi-0.10-test3/src/options/opt_sound.h --- psi-0.10-test3-orig/src/options/opt_sound.h 2005-08-22 19:52:28.000000000 +0000 +++ psi-0.10-test3/src/options/opt_sound.h 2005-11-08 23:02:04.000000000 +0000 @@ -22,13 +22,14 @@ private slots: void chooseSoundEvent(int x); void previewSoundEvent(int x); + void disableSoundEvent(int x); void soundReset(); void setData(PsiCon *, QWidget *); private: QWidget *w, *parentWidget; QLineEdit *le_oe[10]; - QButtonGroup *bg_se, *bg_sePlay; + QButtonGroup *bg_se, *bg_sePlay, *bg_chb; }; #endif diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/options/opt_sound-ui.ui psi-0.10-test3/src/options/opt_sound-ui.ui --- psi-0.10-test3-orig/src/options/opt_sound-ui.ui 2005-08-22 19:52:28.000000000 +0000 +++ psi-0.10-test3/src/options/opt_sound-ui.ui 2005-11-08 23:02:04.000000000 +0000 @@ -89,71 +89,167 @@ unnamed - + - tb_seFTCompletePlay + le_oeChat2 + + + Enter a filename or !beep for a system beep + + + + + chb_seChat1 + + + true + + + + + chb_seMessage + + + true + + + + + chb_seChat2 + + + true + + + + + chb_seHeadline + + + true + + + + + chb_seSystem + + + true + + + + + chb_seOnline + + + true + + + + + chb_seOffline + + + true + + + + + chb_seSend + + + true + + + + + chb_seFTComplete + + + true + + + + + chb_seIncomingFT + + + true + + + + + textLabel1 - + Incoming File Transfer: - + - le_oeFTComplete + textLabel2 + + + File Transfer Complete: + + + + + le_oeOffline Enter a filename or !beep for a system beep - + - TextLabel_Headline + le_oeSend - - Headline: + + Enter a filename or !beep for a system beep - + - le_oeChat1 + le_oeFTComplete Enter a filename or !beep for a system beep - + - TextLabel4_4_2 + TextLabel_Headline - Receive Online Status: + Headline: - + - le_oeOnline + le_oeChat1 Enter a filename or !beep for a system beep - + - tb_seOffline + TextLabel4_4_2 - + Receive Online Status: - + - tb_seMessage + le_oeOnline - - + + Enter a filename or !beep for a system beep - + le_oeIncomingFT @@ -161,7 +257,7 @@ Enter a filename or !beep for a system beep - + TextLabel4_6 @@ -169,244 +265,228 @@ Receive Message: - + - tb_seSend + le_oeMessage - - + + Enter a filename or !beep for a system beep - + - tb_seOfflinePlay + TextLabel4_5_2 - + Send Message: - + - tb_seOnline + le_oeHeadline - - + + Enter a filename or !beep for a system beep - + - tb_seSystem + TextLabel4_3_2 - + System Message: - + - le_oeMessage + le_oeSystem Enter a filename or !beep for a system beep - + - tb_seIncomingFTPlay - - - - - - - - TextLabel4_5_2 + TextLabel4_2_3 - Send Message: + Receive Next Chat: - + - tb_seHeadlinePlay + tb_seMessagePlay - + - le_oeHeadline + TextLabel4_2_2_2 - - Enter a filename or !beep for a system beep + + Receive First Chat: - + - TextLabel4_3_2 + TextLabel4_4_2_2 - System Message: + Receive Offline Status: - + - tb_seIncomingFT + tb_seFTComplete - + - tb_seOnlinePlay + tb_seHeadlinePlay - + - tb_seSystemPlay + tb_seIncomingFTPlay - + - tb_seChat2Play + tb_seOffline - + - tb_seHeadline + tb_seMessage - + - tb_seChat2 + tb_seFTCompletePlay - + - tb_seChat1Play + tb_seSend - + - tb_seChat1 + tb_seOfflinePlay - - - le_oeChat2 - - - Enter a filename or !beep for a system beep - - - + - textLabel1 + tb_seOnline - Incoming File Transfer: + - + - textLabel2 + tb_seSystem - File Transfer Complete: + - + - le_oeOffline + tb_seIncomingFT - - Enter a filename or !beep for a system beep + + - + - le_oeSend + tb_seOnlinePlay - - Enter a filename or !beep for a system beep + + - + - tb_seSendPlay + tb_seSystemPlay - + - le_oeSystem + tb_seChat2Play - - Enter a filename or !beep for a system beep + + - + - TextLabel4_2_3 + tb_seHeadline - Receive Next Chat: + - + - tb_seMessagePlay + tb_seChat2 - + - TextLabel4_2_2_2 + tb_seChat1Play - Receive First Chat: + - + - tb_seFTComplete + tb_seChat1 - + - TextLabel4_4_2_2 + tb_seSendPlay - Receive Offline Status: + diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/psiaccount.cpp psi-0.10-test3/src/psiaccount.cpp --- psi-0.10-test3-orig/src/psiaccount.cpp 2005-11-08 22:16:14.000000000 +0000 +++ psi-0.10-test3/src/psiaccount.cpp 2005-11-08 23:01:53.000000000 +0000 @@ -1893,18 +1893,50 @@ if(str.isEmpty()) return; - int s = STATUS_OFFLINE; - if(loggedIn()) - s = makeSTATUS(status()); + // removed with checkboxes-cousnd-options patch +// int s = STATUS_OFFLINE; +// if(loggedIn()) +// s = makeSTATUS(status()); - if(s == STATUS_DND) - return; +// if(s == STATUS_DND) +// return; // no away sounds? - if(option.noAwaySound && (s == STATUS_AWAY || s == STATUS_XA)) - return; +// if(option.noAwaySound && (s == STATUS_AWAY || s == STATUS_XA)) +// return; + +// d->psi->playSound(str); + + // find the position in opt.onevent to see if the sound is active + int i = 0; + bool found = false; + + do + { + if(str == option.onevent[i]) + // if found, exit + found = true; + else + // if not found, go on searching + i++; + } while (i<10 && !found); + + // afther this bucle i contains the position of the sound + // in opt.onevent (thus, in opt.oneventIsActive) + // (see applyOptions and restoreOptions methods in opt_sound.cpp) + + if(option.oneventIsActive[i]) + { + int s = STATUS_OFFLINE; + if(loggedIn()) + s = makeSTATUS(status()); + + // no away sounds? + if(option.noAwaySound && (s == STATUS_AWAY || s == STATUS_XA || s == STATUS_DND)) + return; - d->psi->playSound(str); + d->psi->playSound(str); + } } QWidget *PsiAccount::dialogFind(const char *className, const Jid &j) diff -Naur --exclude='*orig' psi-0.10-test3-orig/src/psi_profiles.cpp psi-0.10-test3/src/psi_profiles.cpp --- psi-0.10-test3-orig/src/psi_profiles.cpp 2005-11-08 22:16:14.000000000 +0000 +++ psi-0.10-test3/src/psi_profiles.cpp 2005-11-08 23:02:04.000000000 +0000 @@ -478,6 +478,9 @@ prefs.onevent[eSend] = g.pathBase + "/sound/send.wav"; prefs.onevent[eIncomingFT] = g.pathBase + "/sound/ft_incoming.wav"; prefs.onevent[eFTComplete] = g.pathBase + "/sound/ft_complete.wav"; + + for(int i=0; i<10; i++) + prefs.oneventIsActive[i] = true; // Added by Kiko 020621: sets up the default certificate store prefs.trustCertStoreDir = g.pathHome + "/certs"; @@ -1144,6 +1147,22 @@ p_onevent.appendChild(textTag(doc, "incoming_ft", prefs.onevent[eIncomingFT])); p_onevent.appendChild(textTag(doc, "ft_complete", prefs.onevent[eFTComplete])); } + + { + QDomElement p_oneventIsActive = doc.createElement("oneventIsActive"); + p_sound.appendChild(p_oneventIsActive); + + p_oneventIsActive.appendChild(textTag(doc, "message", prefs.oneventIsActive[eMessage])); + p_oneventIsActive.appendChild(textTag(doc, "chat1", prefs.oneventIsActive[eChat1])); + p_oneventIsActive.appendChild(textTag(doc, "chat2", prefs.oneventIsActive[eChat2])); + p_oneventIsActive.appendChild(textTag(doc, "system", prefs.oneventIsActive[eSystem])); + p_oneventIsActive.appendChild(textTag(doc, "headline", prefs.oneventIsActive[eHeadline])); + p_oneventIsActive.appendChild(textTag(doc, "online", prefs.oneventIsActive[eOnline])); + p_oneventIsActive.appendChild(textTag(doc, "offline", prefs.oneventIsActive[eOffline])); + p_oneventIsActive.appendChild(textTag(doc, "send", prefs.oneventIsActive[eSend])); + p_oneventIsActive.appendChild(textTag(doc, "incoming_ft", prefs.oneventIsActive[eIncomingFT])); + p_oneventIsActive.appendChild(textTag(doc, "ft_complete", prefs.oneventIsActive[eFTComplete])); + } } { @@ -1922,6 +1941,20 @@ readEntry(tag, "incoming_ft", &prefs.onevent[eIncomingFT]); readEntry(tag, "ft_complete", &prefs.onevent[eFTComplete]); } + + tag = findSubTag(p_sound, "oneventIsActive", &found); + if(found) { + readBoolEntry(tag, "message", &prefs.oneventIsActive[eMessage]); + readBoolEntry(tag, "chat1", &prefs.oneventIsActive[eChat1]); + readBoolEntry(tag, "chat2", &prefs.oneventIsActive[eChat2]); + readBoolEntry(tag, "system", &prefs.oneventIsActive[eSystem]); + readBoolEntry(tag, "headline", &prefs.oneventIsActive[eHeadline]); + readBoolEntry(tag, "online", &prefs.oneventIsActive[eOnline]); + readBoolEntry(tag, "offline", &prefs.oneventIsActive[eOffline]); + readBoolEntry(tag, "send", &prefs.oneventIsActive[eSend]); + readBoolEntry(tag, "incoming_ft", &prefs.oneventIsActive[eIncomingFT]); + readBoolEntry(tag, "ft_complete", &prefs.oneventIsActive[eFTComplete]); + } } QDomElement p_sizes = findSubTag(p, "sizes", &found);