1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
From 6b161fa314ee5948a7ebde5d4320d669041e831e Mon Sep 17 00:00:00 2001
From: Hermann Meyer <brummer-@web.de>
Date: Mon, 9 Nov 2015 09:46:54 +0100
Subject: [PATCH 2/3] * set wscript to versio 0.34.0git * make webkit
optional * add filebrowser for upload preset banks
---
trunk/src/gx_head/gui/gx_preset_window.cpp | 34 +++++++++++++++++++++++++++++-
trunk/src/headers/gx_preset_window.h | 8 ++++++-
trunk/wscript | 5 +++--
3 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/trunk/src/gx_head/gui/gx_preset_window.cpp b/trunk/src/gx_head/gui/gx_preset_window.cpp
index ead8c93..1050a9d 100644
--- a/trunk/src/gx_head/gui/gx_preset_window.cpp
+++ b/trunk/src/gx_head/gui/gx_preset_window.cpp
@@ -81,10 +81,13 @@ PresetWindow::PresetWindow(Glib::RefPtr<gx_gui::GxBuilder> bld, gx_engine::GxMac
//actiongroup->add(act, sigc::mem_fun(*this, &PresetWindow::on_presets_close));
//gtk_activatable_set_related_action(GTK_ACTIVATABLE(close_preset->gobj()), act->gobj());
close_preset->hide(); // disable (maybe remove later)
+#ifdef HAVE_WEBKIT
actions.online_preset_bank = Gtk::Action::create("OnlineBank");
actions.group->add(actions.online_preset_bank, sigc::mem_fun(*this, &PresetWindow::on_online_preset));
gtk_activatable_set_related_action(GTK_ACTIVATABLE(online_preset->gobj()), actions.online_preset_bank->gobj());
-
+#else
+ online_preset->set_sensitive(false);
+#endif
bank_treeview->set_model(Gtk::ListStore::create(bank_col));
bank_treeview->set_name("PresetView");
bank_treeview->get_selection()->set_select_function(
@@ -686,6 +689,7 @@ void PresetWindow::on_new_bank() {
start_edit(m->get_path(edit_iter), *bank_treeview->get_column(1), *bank_cellrenderer);
}
+#ifdef HAVE_WEBKIT
bool PresetWindow::insertRequested(const char *ur, gpointer data)
{
@@ -748,6 +752,31 @@ bool PresetWindow::downloadRequested(WebKitWebView* webView, WebKitDownload *dow
return TRUE;
}
+bool PresetWindow::uploadRequested(WebKitWebView* webView, WebKitFileChooserRequest *request,gpointer data )
+{
+ Gtk::FileChooserDialog d( "Select upload file");
+ d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
+ d.add_shortcut_folder(string(getenv("HOME")) + string("/.config/guitarix/bamks"));
+ Gtk::FileFilter banks;
+ banks.set_name("Bank Files");
+ banks.add_pattern("*.gx");
+ d.add_filter(banks);
+ Gtk::FileFilter all;
+ all.add_pattern("*");
+ all.set_name("All Files");
+ d.add_filter(all);
+ d.set_current_folder(string(getenv("HOME")) + string("/.config/guitarix/banks"));
+
+ if (d.run() != Gtk::RESPONSE_OK) {
+ return FALSE;
+ }
+ Glib::ustring filename = d.get_filename();
+ const gchar* f[2] = {filename.c_str(),0};
+ webkit_file_chooser_request_select_files (request, f);
+ return TRUE;
+}
+
void PresetWindow::show_online_preset() {
Gtk::Window *window = new Gtk::Window();
@@ -760,6 +789,7 @@ void PresetWindow::show_online_preset() {
window->add(*Gtk::manage(scrollbox));
webkit_web_view_load_uri(web_view, "https://musical-artifacts.com/?apps=guitarix");
g_signal_connect(G_OBJECT (web_view), "download-requested", G_CALLBACK(downloadRequested), this);
+ g_signal_connect(G_OBJECT (web_view), "run-file-chooser", G_CALLBACK(uploadRequested), this);
window->show_all();
}
@@ -767,6 +797,8 @@ void PresetWindow::on_online_preset() {
Glib::signal_idle().connect_once(sigc::mem_fun(*this, &PresetWindow::show_online_preset));
}
+#endif
+
bool PresetWindow::on_bank_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint timestamp) {
Gtk::Widget *source_widget = Gtk::Widget::drag_get_source_widget(context);
if (!source_widget) {
diff --git a/trunk/src/headers/gx_preset_window.h b/trunk/src/headers/gx_preset_window.h
index a009670..48a9801 100644
--- a/trunk/src/headers/gx_preset_window.h
+++ b/trunk/src/headers/gx_preset_window.h
@@ -24,7 +24,10 @@
/****************************************************************
** class PresetWindow
*/
+
+#ifdef HAVE_WEBKIT
#include <webkit/webkit.h>
+#endif
class PresetStore: public Gtk::ListStore {
public:
@@ -141,12 +144,15 @@ private:
bool is_row_separator(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::iterator& iter);
void on_new_bank();
void on_preset_save();
+ const std::string pdir() { return options.get_preset_dir();}
+#ifdef HAVE_WEBKIT
void on_online_preset();
void show_online_preset();
- const std::string pdir() { return options.get_preset_dir();}
static bool downloadRequested(WebKitWebView* webView, WebKitDownload *download,gpointer data );
+ static bool uploadRequested(WebKitWebView* webView, WebKitFileChooserRequest *request,gpointer data );
static bool insertRequested(const char* uri, gpointer data );
static void download_status(GObject* object, GParamSpec* pspec, gpointer data);
+#endif
bool on_bank_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint timestamp);
void on_bank_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint timestamp);
void on_bank_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection, int info, int timestamp);
diff --git a/trunk/wscript b/trunk/wscript
index 9c0e41b..99cab29 100644
--- a/trunk/wscript
+++ b/trunk/wscript
@@ -24,7 +24,7 @@ blddir = 'build'
use_2to3 = True
# used by waf dist and waf build
-VERSION='0.34.0'
+VERSION='0.34.0git'
APPNAME='guitarix'
good_faust_versions = ['0.9.58','0.9.65']
@@ -649,7 +649,7 @@ def configure(conf):
conf.check_cfg(package='lrdf', args='--cflags --libs', uselib_store='LRDF', mandatory=1)
conf.check(header_name='ladspa.h', mandatory=1)
conf.check_cfg(package='lilv-0', args='--cflags --libs', uselib_store='LILV', mandatory=1)
- conf.check_cfg(package='webkit-1.0', args='--cflags --libs', uselib_store='WEBKIT', mandatory=1)
+ conf.check_cfg(package='webkit-1.0', args='--cflags --libs', uselib_store='WEBKIT', mandatory=0, define_name='HAVE_WEBKIT')
check_boost(conf)
conf.check_cfg(package='lv2', atleast_version='1.2.0',args='--cflags --libs', uselib_store='LV2CORE', mandatory=1)
@@ -811,6 +811,7 @@ def configure(conf):
display_feature("Use prebuild gperf files", not conf.env["HAVE_GPERF"])
display_feature("Avahi service discovery", conf.env["HAVE_AVAHI"])
display_feature("Bluetooth rfcomm", conf.env["HAVE_BLUEZ"])
+ display_feature("Use Webkit", conf.env["HAVE_WEBKIT"])
display_feature("Use internal zita-resampler", not conf.env['ZITA_RESAMPLER'])
if conf.env['CONVOLVER_FFMPEG']:
display_feature("Use zita-convolver-ffmpeg", True)
--
1.8.4
|