-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #75 wip play sound notification with gsound
- Loading branch information
1 parent
8bfb1f2
commit dbbb057
Showing
13 changed files
with
158 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,37 @@ | ||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ | ||
/*! | ||
* dialog_preferences.cc | ||
* Copyright (C) Diego Rubin 2011 <[email protected]> | ||
* | ||
* Gnomato 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. | ||
* | ||
* Gnomato 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Author: Diego Rubin <[email protected]> | ||
* | ||
*/ | ||
* dialog_preferences.cc | ||
* Copyright (C) Diego Rubin 2011 <[email protected]> | ||
* | ||
* Gnomato 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. | ||
* | ||
* Gnomato 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Author: Diego Rubin <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <gdkmm/rgba.h> | ||
#include "dialog_preferences.h" | ||
|
||
DialogPreferences::DialogPreferences(BaseObjectType* cobject, | ||
const Glib::RefPtr<Gtk::Builder>& refGlade) | ||
: Gtk::Dialog(cobject), | ||
m_refGlade(refGlade) | ||
{ | ||
DialogPreferences::DialogPreferences(BaseObjectType *cobject, | ||
const Glib::RefPtr<Gtk::Builder> &refGlade) | ||
: Gtk::Dialog(cobject), m_refGlade(refGlade) { | ||
configs.load(); | ||
|
||
// buttons | ||
m_refGlade->get_widget("btnOk", btnOk); | ||
m_refGlade->get_widget("btnCancel", btnCancel); | ||
|
||
// page 1 - intervals | ||
// page 1 - intervals | ||
m_refGlade->get_widget("spnWork", spnWork); | ||
m_refGlade->get_widget("spnShortBreak", spnShortBreak); | ||
m_refGlade->get_widget("spnLongBreak", spnLongBreak); | ||
|
@@ -47,35 +44,29 @@ DialogPreferences::DialogPreferences(BaseObjectType* cobject, | |
// page 2 - colors | ||
m_refGlade->get_widget("clrTimer", clrTimer); | ||
Gdk::RGBA timer; | ||
timer.set_rgba( | ||
configs.colorTimerRed, | ||
configs.colorTimerGreen, | ||
configs.colorTimerBlue); | ||
timer.set_rgba(configs.colorTimerRed, configs.colorTimerGreen, | ||
configs.colorTimerBlue); | ||
clrTimer->set_rgba(timer); | ||
|
||
// connect signals | ||
btnCancel->signal_clicked().connect(sigc::mem_fun(*this,&DialogPreferences::on_button_cancel_clicked)); | ||
btnOk->signal_clicked().connect(sigc::mem_fun(*this,&DialogPreferences::on_button_ok_clicked)); | ||
btnCancel->signal_clicked().connect( | ||
sigc::mem_fun(*this, &DialogPreferences::on_button_cancel_clicked)); | ||
btnOk->signal_clicked().connect( | ||
sigc::mem_fun(*this, &DialogPreferences::on_button_ok_clicked)); | ||
|
||
show_all(); | ||
} | ||
|
||
DialogPreferences::~DialogPreferences() | ||
{ | ||
} | ||
DialogPreferences::~DialogPreferences() {} | ||
|
||
void DialogPreferences::on_button_cancel_clicked() | ||
{ | ||
hide(); | ||
} | ||
void DialogPreferences::on_button_cancel_clicked() { hide(); } | ||
|
||
void DialogPreferences::on_button_ok_clicked() | ||
{ | ||
void DialogPreferences::on_button_ok_clicked() { | ||
configs.work_interval = spnWork->get_text(); | ||
configs.break_interval = spnShortBreak->get_text(); | ||
configs.long_interval = spnLongBreak->get_text(); | ||
configs.inactive_interval = spnInactiveInterval->get_text(); | ||
|
||
Gdk::RGBA timer = clrTimer->get_rgba(); | ||
configs.colorTimerRed = timer.get_red(); | ||
configs.colorTimerGreen = timer.get_green(); | ||
|
@@ -84,4 +75,3 @@ void DialogPreferences::on_button_ok_clicked() | |
configs.save(); | ||
hide(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,43 @@ | ||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ | ||
/*! | ||
* dialog_preferences.h | ||
* Copyright (C) Diego Rubin 2011 <[email protected]> | ||
* | ||
* Gnomato 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. | ||
* | ||
* Gnomato 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Author: Diego Rubin <[email protected]> | ||
* | ||
*/ | ||
* dialog_preferences.h | ||
* Copyright (C) Diego Rubin 2011 <[email protected]> | ||
* | ||
* Gnomato 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. | ||
* | ||
* Gnomato 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Author: Diego Rubin <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef _WIN_PREFERENCES_H_ | ||
#define _WIN_PREFERENCES_H_ | ||
|
||
#include <gdkmm/rgba.h> | ||
#include <gtkmm.h> | ||
|
||
#include "config.h" | ||
|
||
using namespace Gtk; | ||
|
||
class DialogPreferences: public Gtk::Dialog | ||
{ | ||
class DialogPreferences : public Gtk::Dialog { | ||
public: | ||
DialogPreferences(BaseObjectType* cobject, | ||
const Glib::RefPtr<Gtk::Builder>& refGlade); | ||
DialogPreferences(BaseObjectType *cobject, | ||
const Glib::RefPtr<Gtk::Builder> &refGlade); | ||
|
||
virtual ~DialogPreferences(); | ||
protected: | ||
virtual ~DialogPreferences(); | ||
|
||
protected: | ||
private: | ||
// attributes | ||
Config configs; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ | ||
/*! | ||
* dialog_preferences.cc | ||
* dialog_work_log_entries.cc | ||
* Copyright (C) Diego Rubin 2020 <[email protected]> | ||
* | ||
* Gnomato is free software: you can redistribute it and/or modify it | ||
|
@@ -21,7 +21,6 @@ | |
*/ | ||
|
||
#include "dialog_work_log_entries.h" | ||
#include <gdkmm/rgba.h> | ||
|
||
DialogWorkLogEntries::DialogWorkLogEntries( | ||
BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &refGlade) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ | ||
/*! | ||
* dialog_preferences.h | ||
* dialog_work_log_entries.h | ||
* Copyright (C) Diego Rubin 2020 <[email protected]> | ||
* | ||
* Gnomato is free software: you can redistribute it and/or modify it | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ | ||
/*! | ||
* sound_player.cc | ||
* Copyright (C) Diego Rubin 2020 <[email protected]> | ||
* | ||
* Gnomato 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. | ||
* | ||
* Gnomato 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Author: Diego Rubin <[email protected]> | ||
* | ||
*/ | ||
|
||
#include "sound_player.h" | ||
|
||
SoundPlayer::SoundPlayer(string file) : file(file) { | ||
gsound = gsound_context_new(NULL, NULL); | ||
} | ||
|
||
SoundPlayer::SoundPlayer() : SoundPlayer(GNOMATO_DATADIR "/alert.ogg") {} | ||
|
||
SoundPlayer::~SoundPlayer() {} | ||
|
||
void SoundPlayer::play() { | ||
if (!gsound) { | ||
cout << _("Error on load gsound context") << endl; | ||
return; | ||
} | ||
|
||
gsound_context_play_simple(gsound, NULL, NULL, GSOUND_ATTR_MEDIA_FILENAME, | ||
"phone-incoming-call", NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ | ||
/*! | ||
* sound_player.h | ||
* Copyright (C) Diego Rubin 2020 <[email protected]> | ||
* | ||
* Gnomato 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. | ||
* | ||
* Gnomato 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 this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Author: Diego Rubin <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef _SOUND_PLAYER_H_ | ||
#define _SOUND_PLAYER_H_ | ||
|
||
#include <glibmm/i18n.h> | ||
#include <gsound.h> | ||
#include <iostream> | ||
#include <sstream> | ||
|
||
using namespace std; | ||
|
||
class SoundPlayer { | ||
public: | ||
SoundPlayer(string file); | ||
SoundPlayer(); | ||
|
||
virtual ~SoundPlayer(); | ||
|
||
// methods | ||
void play(); | ||
|
||
private: | ||
// attributes | ||
string file; | ||
GSoundContext *gsound; | ||
}; | ||
|
||
#endif // SOUND_PLAYER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters