From a713e8258acc3f0e960c4e87ba8684902d29a591 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 5 Jan 2020 15:25:58 +0100 Subject: [PATCH] Move credentials settings into certificate download dialogue (#1480). --- doc/manual/dcpomatic.xml | 27 --- graphics/osx/preferences/accounts.png | Bin 2057 -> 0 bytes graphics/src/accounts.svg | 179 ------------------ graphics/update | 2 +- platform/osx/make_dmg.sh | 1 - src/wx/barco_alchemy_certificate_panel.cc | 19 +- src/wx/barco_alchemy_certificate_panel.h | 4 +- src/wx/christie_certificate_panel.cc | 19 +- src/wx/christie_certificate_panel.h | 6 +- .../credentials_download_certificate_panel.cc | 92 +++++++++ .../credentials_download_certificate_panel.h | 59 ++++++ src/wx/download_certificate_dialog.h | 1 + src/wx/download_certificate_panel.h | 2 +- src/wx/full_config_dialog.cc | 140 -------------- src/wx/gdc_certificate_panel.cc | 18 +- src/wx/gdc_certificate_panel.h | 6 +- src/wx/wscript | 1 + 17 files changed, 194 insertions(+), 382 deletions(-) delete mode 100644 graphics/osx/preferences/accounts.png delete mode 100644 graphics/src/accounts.svg create mode 100644 src/wx/credentials_download_certificate_panel.cc create mode 100644 src/wx/credentials_download_certificate_panel.h diff --git a/doc/manual/dcpomatic.xml b/doc/manual/dcpomatic.xml index 18fe753b5..3e4e1eadd 100644 --- a/doc/manual/dcpomatic.xml +++ b/doc/manual/dcpomatic.xml @@ -3018,33 +3018,6 @@ The Reset to default text will replace the current KDM emai - - -
-Accounts - - -The Accounts tab is shown in . - - -
- Accounts preferences - - - - - -
- - -DCP-o-matic can download projector certificates from the Barco, -Christie and GDC websites if you have the appropriate credentials. -Enter your usernames and passwords. - - -
- -
Notifications diff --git a/graphics/osx/preferences/accounts.png b/graphics/osx/preferences/accounts.png deleted file mode 100644 index f9909b7a57e1fa8d4542d79e06e2ebab18a4579f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2057 zcma)-X;c$g7RO6K44WW}27*vVk%$n$1UqbD5fErVmPA077?KJJOA;#uC=xbVjf!mT zG>d|bFfAQyL19p&nMMRfg9AczfVLHdVT7oyfT#mq!TvDImwD&hy7lh6ukQc-?mMT7 zgM;?#XqspO0HEXN>lKQ6P-z%-^eIYDe~&sfk*6OGgN_Ugy9k|Y2z?_(sC%rmb^Udn zQZ#6cct;>%0uGYKgdrd;Ese-+NIPY0?|`~!6|V`JQnCBKt=MM{!eK>FmxmZ;v-4N z7#^ZTh|LH|fkevFinh}rI9bFHa2RwEL?rqAk6s^-kTuN;wU8#1<~Aj+eK5pS?gnYR zWC++}XK!a?N3z-DNVB6j*^!;>_wod{v(V%NU;2{*vmii;PK2@(2q8Wzi6>;j$Qm^^ zgrKx-Ne+AL9ln6I;qeg&=0nI@A8g`|+5CIkh?KR<60xR3AUp>1;<*U0Z=cLaA^0C80A^{O3rSm*Il?ot?b4udtj?l6E|s6 zi+<4k#zck6RTW>o=Dk?I?fcO!5^m;%Z`6|=oK;SnTWzhgyiif_KoK+?Xf!mU$e3|{ z+PRdubW_cFKeneCpkzk^g9qwI^<8qo0ROTIjG9V`N{+i%l@bkE0#b z)Y)MR3zO4(Cu;+p^-lY^c1A0{rqeg&6Vs>sWBY(KD`x#~9 z*w`2+d7K&%=^HFx(4f;V#GiVyoUyXsuZ&6&e|-O4!kLKOhpVQyh{a;duGlNVo90gU zPlW;M>xBNij;JF*T}7^*e#?rSJfD!2wfZa}2(4MtKc&|53FkO!Ucmf74s;H+i8Y#2 zC^8-Oi%r)9vSpw9IyItA0KRmc%EP$suuFMajCw2?Pi^X{C9Hswq?bjs+J0haY+^6^f5_u=vO#JB!Q zEoB||v59wf+21*c)5aEDWmirA>ti0xsuFk;W3kK{A@3$w z|2ANHsHLUlDNY;swJ+{%G`{qMM6?kY;Iwh}R@a&u8yAOD(yRxo$bqEshNENc^BRC# z_~vUhgD;6qBeO_l+l?Dlgw2u*=bcg#rU+j-j7p*-I`Tv+#JHxS)*G(==NgNuiZ(v;!cYfKXejZvG%HzsB$uagx!j@<0BdfZ)hw0H&wqRlfG6>biplYCt4gAQ zCx=F#*U0z8_2u-x^Bf_YXse6!&I+2En%rK`&OQlem;#30_0NPK`p{95?Qf9oa(>{v z>v7M87gp@Zonc{N0^c&j;grdRzVaO!H(HKgiMg3NjNXo}Ep)XL9{Hi^`au26&;{M* z%YP3n`qWEtb1UiWbYw(DRX1~uE?*8EY`q;}-ELv4hfy0k?|QQYmg%ln$&pD13=9m; zLdH?IRIj71yuAF+u``^9DXu#(Kfj{s<*Bw>AD=Axo~F5^m^?8ge`pqEGVl_PICKbp z>09PSxb%szjeQRM%TM-gZEeByh2n5V7(gPCT8@MmdSGVjfC{NBD?QyLs&5j+s3?B9 z^~%IDFIx{U0nXlK2OpOvY%1xmC-@JlyO`;kQ8S9F{JJzoSM+QKKfd_ui4Eb^r3Vil ze3U_5t!(7k2yzG~f3zMf?u#>DTwLTt2UsUtW(4cy;bLN9Ru1X_J@@Y2b7IXAvd8%~ z^G?mRde7$?C;$y!kW$8tAMUy&O*>5ge57TOtp1s88D5v`uLv`Kv!bOQT{uyW{V??Q zCmfe5P6)QDeBp(E%XN+=31uB(*A8dKR`>p(lk&ql*|VEJZ}88?PU@)CVbR|L;O8CW J)#7 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Openclipart - - - - 2010-03-29T08:04:16 - "E-mail" icon from <a href="http://tango.freedesktop.org/Tango_Desktop_Project"> Tango Project </a> -\n<br><br> -\nSince version 0.8.90 Tango Project icons are Public Domain: <a href="http://tango.freedesktop.org/Frequently_Asked_Questions#Terms_of_Use.3F"> Tango Project FAQ </a> - https://openclipart.org/detail/35215/tango-internet-mail-by-warszawianka - - - warszawianka - - - - - email - envelope - externalsource - icon - letter - tango - - - - - - - - - - - diff --git a/graphics/update b/graphics/update index f0d91bf89..2e5bccd17 100755 --- a/graphics/update +++ b/graphics/update @@ -63,7 +63,7 @@ else # OS X preferences icons # servers.png does not have an SVG version mkdir -p osx/preferences - for i in colour_conversions defaults email kdm_email cover_sheet keys tms notifications accounts locations sound; do + for i in colour_conversions defaults email kdm_email cover_sheet keys tms notifications locations sound; do $INKSCAPE osx/preferences/$i.png src/$i.svg -w 32 -h 32 done diff --git a/platform/osx/make_dmg.sh b/platform/osx/make_dmg.sh index fa9240050..7a9542fd7 100644 --- a/platform/osx/make_dmg.sh +++ b/platform/osx/make_dmg.sh @@ -195,7 +195,6 @@ function copy_resources { cp $prefix/src/dcpomatic/graphics/osx/preferences/keys.png "$dest" cp $prefix/src/dcpomatic/graphics/osx/preferences/cover_sheet.png "$dest" cp $prefix/src/dcpomatic/graphics/osx/preferences/notifications.png "$dest" - cp $prefix/src/dcpomatic/graphics/osx/preferences/accounts.png "$dest" cp $prefix/src/dcpomatic/graphics/osx/preferences/locations.png "$dest" cp $prefix/src/dcpomatic/fonts/LiberationSans-Regular.ttf "$dest" cp $prefix/src/dcpomatic/fonts/LiberationSans-Italic.ttf "$dest" diff --git a/src/wx/barco_alchemy_certificate_panel.cc b/src/wx/barco_alchemy_certificate_panel.cc index 84048c65c..47dd85e07 100644 --- a/src/wx/barco_alchemy_certificate_panel.cc +++ b/src/wx/barco_alchemy_certificate_panel.cc @@ -29,7 +29,15 @@ using std::string; using boost::optional; BarcoAlchemyCertificatePanel::BarcoAlchemyCertificatePanel (DownloadCertificateDialog* dialog) - : DownloadCertificatePanel (dialog) + : CredentialsDownloadCertificatePanel ( + dialog, + boost::bind(&Config::barco_username, Config::instance()), + boost::bind(&Config::set_barco_username, Config::instance(), _1), + boost::bind(&Config::unset_barco_username, Config::instance()), + boost::bind(&Config::barco_password, Config::instance()), + boost::bind(&Config::set_barco_password, Config::instance(), _1), + boost::bind(&Config::unset_barco_password, Config::instance()) + ) { } @@ -37,19 +45,12 @@ BarcoAlchemyCertificatePanel::BarcoAlchemyCertificatePanel (DownloadCertificateD bool BarcoAlchemyCertificatePanel::ready_to_download () const { - return _serial->GetValue().Length() == 10; + return CredentialsDownloadCertificatePanel::ready_to_download() && _serial->GetValue().Length() == 10; } void BarcoAlchemyCertificatePanel::do_download () { - Config* config = Config::instance (); - if (!config->barco_username() || !config->barco_password()) { - _dialog->message()->SetLabel(wxT("")); - error_dialog (this, _("No Barco username/password configured. Add your account details to the Accounts page in Preferences.")); - return; - } - string const serial = wx_to_std (_serial->GetValue()); string const url = String::compose ( "ftp://%1:%2@certificates.barco.com/%3xxx/%4/Barco-ICMP.%5_cert.pem", diff --git a/src/wx/barco_alchemy_certificate_panel.h b/src/wx/barco_alchemy_certificate_panel.h index 83a74fa21..fce7d3f5d 100644 --- a/src/wx/barco_alchemy_certificate_panel.h +++ b/src/wx/barco_alchemy_certificate_panel.h @@ -18,9 +18,9 @@ */ -#include "download_certificate_panel.h" +#include "credentials_download_certificate_panel.h" -class BarcoAlchemyCertificatePanel : public DownloadCertificatePanel +class BarcoAlchemyCertificatePanel : public CredentialsDownloadCertificatePanel { public: BarcoAlchemyCertificatePanel (DownloadCertificateDialog* dialog); diff --git a/src/wx/christie_certificate_panel.cc b/src/wx/christie_certificate_panel.cc index 9e95aa994..7db3fef25 100644 --- a/src/wx/christie_certificate_panel.cc +++ b/src/wx/christie_certificate_panel.cc @@ -27,9 +27,19 @@ using std::string; using boost::optional; +using boost::bind; ChristieCertificatePanel::ChristieCertificatePanel (DownloadCertificateDialog* dialog) - : DownloadCertificatePanel (dialog) + : CredentialsDownloadCertificatePanel ( + dialog, + bind(&Config::christie_username, Config::instance()), + bind(&Config::set_christie_username, Config::instance(), _1), + bind(&Config::unset_christie_username, Config::instance()), + bind(&Config::christie_password, Config::instance()), + bind(&Config::set_christie_password, Config::instance(), _1), + bind(&Config::unset_christie_password, Config::instance()) + ) + { } @@ -37,13 +47,6 @@ ChristieCertificatePanel::ChristieCertificatePanel (DownloadCertificateDialog* d void ChristieCertificatePanel::do_download () { - Config* config = Config::instance (); - if (!config->christie_username() || !config->christie_password()) { - _dialog->message()->SetLabel(wxT("")); - error_dialog (this, _("No Christie username/password configured. Add your account details to the Accounts page in Preferences.")); - return; - } - string const prefix = String::compose( "ftp://%1:%2@certificates.christiedigital.com/Certificates/", Config::instance()->christie_username().get(), diff --git a/src/wx/christie_certificate_panel.h b/src/wx/christie_certificate_panel.h index 0c9a64d46..41278cb7c 100644 --- a/src/wx/christie_certificate_panel.h +++ b/src/wx/christie_certificate_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -18,9 +18,9 @@ */ -#include "download_certificate_panel.h" +#include "credentials_download_certificate_panel.h" -class ChristieCertificatePanel : public DownloadCertificatePanel +class ChristieCertificatePanel : public CredentialsDownloadCertificatePanel { public: ChristieCertificatePanel (DownloadCertificateDialog* dialog); diff --git a/src/wx/credentials_download_certificate_panel.cc b/src/wx/credentials_download_certificate_panel.cc new file mode 100644 index 000000000..fb4908269 --- /dev/null +++ b/src/wx/credentials_download_certificate_panel.cc @@ -0,0 +1,92 @@ +/* + Copyright (C) 2020 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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 2 of the License, or + (at your option) any later version. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#include "download_certificate_dialog.h" +#include "credentials_download_certificate_panel.h" +#include "password_entry.h" +#include "wx_util.h" + +using std::string; +using boost::function; +using boost::optional; + +CredentialsDownloadCertificatePanel::CredentialsDownloadCertificatePanel ( + DownloadCertificateDialog* dialog, + function ()> get_username, + function set_username, + function unset_username, + function ()> get_password, + function set_password, + function unset_password + ) + : DownloadCertificatePanel (dialog) + , _get_username (get_username) + , _set_username (set_username) + , _unset_username (unset_username) + , _get_password (get_password) + , _set_password (set_password) + , _unset_password (unset_password) +{ + add_label_to_sizer (_table, this, _("User name"), true); + _username = new wxTextCtrl (this, wxID_ANY, std_to_wx(_get_username().get_value_or("")), wxDefaultPosition, wxSize(300, -1)); + _table->Add (_username, 1, wxEXPAND); + + add_label_to_sizer (_table, this, _("Password"), true); + _password = new PasswordEntry (this); + _password->set (_get_password().get_value_or("")); + _table->Add (_password->get_panel(), 1, wxEXPAND); + + _username->Bind (wxEVT_TEXT, boost::bind(&CredentialsDownloadCertificatePanel::username_changed, this)); + _password->Changed.connect (boost::bind(&CredentialsDownloadCertificatePanel::password_changed, this)); + + _overall_sizer->Layout (); + _overall_sizer->SetSizeHints (this); +} + +bool +CredentialsDownloadCertificatePanel::ready_to_download () const +{ + return DownloadCertificatePanel::ready_to_download() && static_cast(_get_username()) && _get_username().get() != "" && static_cast(_get_password()) && _get_password().get() != ""; +} + +void +CredentialsDownloadCertificatePanel::username_changed () +{ + wxString const s = _username->GetValue(); + if (!s.IsEmpty()) { + _set_username (wx_to_std(s)); + } else { + _unset_username (); + } + _dialog->setup_sensitivity (); +} + +void +CredentialsDownloadCertificatePanel::password_changed () +{ + string const s = _password->get(); + if (!s.empty()) { + _set_password (s); + } else { + _unset_password (); + } + _dialog->setup_sensitivity (); +} + diff --git a/src/wx/credentials_download_certificate_panel.h b/src/wx/credentials_download_certificate_panel.h new file mode 100644 index 000000000..68472462a --- /dev/null +++ b/src/wx/credentials_download_certificate_panel.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2020 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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 2 of the License, or + (at your option) any later version. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + +#ifndef CREDENTIALS_DOWNLOAD_CERTIFICATE_PANEL_H +#define CREDENTIALS_DOWNLOAD_CERTIFICATE_PANEL_H + +#include "download_certificate_panel.h" +#include + +class PasswordEntry; + +class CredentialsDownloadCertificatePanel : public DownloadCertificatePanel +{ +public: + CredentialsDownloadCertificatePanel ( + DownloadCertificateDialog* dialog, + boost::function ()> get_username, + boost::function set_username, + boost::function unset_username, + boost::function ()> get_password, + boost::function set_password, + boost::function unset_password + ); + + virtual bool ready_to_download () const; + +private: + void username_changed (); + void password_changed (); + + boost::function (void)> _get_username; + boost::function _set_username; + boost::function _unset_username; + boost::function (void)> _get_password; + boost::function _set_password; + boost::function _unset_password; + + wxTextCtrl* _username; + PasswordEntry* _password; +}; + +#endif diff --git a/src/wx/download_certificate_dialog.h b/src/wx/download_certificate_dialog.h index 180c13278..a2fbf808f 100644 --- a/src/wx/download_certificate_dialog.h +++ b/src/wx/download_certificate_dialog.h @@ -18,6 +18,7 @@ */ +#include #include #include diff --git a/src/wx/download_certificate_panel.h b/src/wx/download_certificate_panel.h index 55594c74c..d1f0bf4de 100644 --- a/src/wx/download_certificate_panel.h +++ b/src/wx/download_certificate_panel.h @@ -44,9 +44,9 @@ protected: DownloadCertificateDialog* _dialog; wxFlexGridSizer* _table; wxTextCtrl* _serial; + wxSizer* _overall_sizer; private: - wxSizer* _overall_sizer; boost::optional _certificate; }; diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index f586672a8..ce199e58a 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -981,145 +981,6 @@ private: wxButton* _reset_email; }; -class AccountsPage : public StandardPage -{ -public: - AccountsPage (wxSize panel_size, int border) - : StandardPage (panel_size, border) - {} - - wxString GetName () const - { - return _("Accounts"); - } - -#ifdef DCPOMATIC_OSX - wxBitmap GetLargeIcon () const - { - return wxBitmap ("accounts", wxBITMAP_TYPE_PNG_RESOURCE); - } -#endif - - void setup () - { - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - _panel->GetSizer()->Add (table, 1, wxEXPAND | wxALL, _border); - - add_label_to_sizer (table, _panel, _("certificates.barco.com user name"), true); - _barco_username = new wxTextCtrl (_panel, wxID_ANY); - table->Add (_barco_username, 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _panel, _("certificates.barco.com password"), true); - _barco_password = new PasswordEntry (_panel); - table->Add (_barco_password->get_panel(), 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _panel, _("certificates.christiedigital.com user name"), true); - _christie_username = new wxTextCtrl (_panel, wxID_ANY); - table->Add (_christie_username, 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _panel, _("certificates.christiedigital.com password"), true); - _christie_password = new PasswordEntry (_panel); - table->Add (_christie_password->get_panel(), 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _panel, _("GDC user name"), true); - _gdc_username = new wxTextCtrl (_panel, wxID_ANY); - table->Add (_gdc_username, 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _panel, _("GDC password"), true); - _gdc_password = new PasswordEntry (_panel); - table->Add (_gdc_password->get_panel(), 1, wxEXPAND | wxALL); - - _barco_username->Bind (wxEVT_TEXT, boost::bind(&AccountsPage::barco_username_changed, this)); - _barco_password->Changed.connect (boost::bind(&AccountsPage::barco_password_changed, this)); - _christie_username->Bind (wxEVT_TEXT, boost::bind(&AccountsPage::christie_username_changed, this)); - _christie_password->Changed.connect (boost::bind(&AccountsPage::christie_password_changed, this)); - _gdc_username->Bind (wxEVT_TEXT, boost::bind(&AccountsPage::gdc_username_changed, this)); - _gdc_password->Changed.connect (boost::bind(&AccountsPage::gdc_password_changed, this)); - } - - void config_changed () - { - Config* config = Config::instance (); - - checked_set (_barco_username, config->barco_username().get_value_or("")); - checked_set (_barco_password, config->barco_password().get_value_or("")); - checked_set (_christie_username, config->christie_username().get_value_or("")); - checked_set (_christie_password, config->christie_password().get_value_or("")); - checked_set (_gdc_username, config->gdc_username().get_value_or("")); - checked_set (_gdc_password, config->gdc_password().get_value_or("")); - } - - void barco_username_changed () - { - wxString const s = _barco_username->GetValue(); - if (!s.IsEmpty()) { - Config::instance()->set_barco_username (wx_to_std(s)); - } else { - Config::instance()->unset_barco_username (); - } - } - - void barco_password_changed () - { - string const s = _barco_password->get(); - if (!s.empty()) { - Config::instance()->set_barco_password(s); - } else { - Config::instance()->unset_barco_password(); - } - } - - void christie_username_changed () - { - wxString const s = _christie_username->GetValue(); - if (!s.IsEmpty()) { - Config::instance()->set_christie_username (wx_to_std(s)); - } else { - Config::instance()->unset_christie_username (); - } - } - - void christie_password_changed () - { - string const s = _christie_password->get(); - if (!s.empty()) { - Config::instance()->set_christie_password(s); - } else { - Config::instance()->unset_christie_password(); - } - } - - void gdc_username_changed () - { - wxString const s = _gdc_username->GetValue(); - if (!s.IsEmpty()) { - Config::instance()->set_gdc_username (wx_to_std(s)); - } else { - Config::instance()->unset_gdc_username (); - } - } - - void gdc_password_changed () - { - string const s = _gdc_password->get(); - if (!s.empty()) { - Config::instance()->set_gdc_password(s); - } else { - Config::instance()->unset_gdc_password(); - } - } - -private: - wxTextCtrl* _barco_username; - PasswordEntry* _barco_password; - wxTextCtrl* _christie_username; - PasswordEntry* _christie_password; - wxTextCtrl* _gdc_username; - PasswordEntry* _gdc_password; -}; - - class NotificationsPage : public StandardPage { public: @@ -1683,7 +1544,6 @@ create_full_config_dialog () e->AddPage (new TMSPage (ps, border)); e->AddPage (new EmailPage (ps, border)); e->AddPage (new KDMEmailPage (ps, border)); - e->AddPage (new AccountsPage (ps, border)); e->AddPage (new NotificationsPage (ps, border)); e->AddPage (new CoverSheetPage (ps, border)); e->AddPage (new AdvancedPage (ps, border)); diff --git a/src/wx/gdc_certificate_panel.cc b/src/wx/gdc_certificate_panel.cc index b0bb31674..a4301087d 100644 --- a/src/wx/gdc_certificate_panel.cc +++ b/src/wx/gdc_certificate_panel.cc @@ -27,9 +27,18 @@ using std::string; using boost::optional; +using boost::bind; GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog) - : DownloadCertificatePanel (dialog) + : CredentialsDownloadCertificatePanel ( + dialog, + bind(&Config::gdc_username, Config::instance()), + bind(&Config::set_gdc_username, Config::instance(), _1), + bind(&Config::unset_gdc_username, Config::instance()), + bind(&Config::gdc_password, Config::instance()), + bind(&Config::set_gdc_password, Config::instance(), _1), + bind(&Config::unset_gdc_password, Config::instance()) + ) { } @@ -37,13 +46,6 @@ GDCCertificatePanel::GDCCertificatePanel (DownloadCertificateDialog* dialog) void GDCCertificatePanel::do_download () { - Config* config = Config::instance (); - if (!config->gdc_username() || !config->gdc_password()) { - _dialog->message()->SetLabel(wxT("")); - error_dialog (this, _("No GDC username/password configured. Add your account details to the Accounts page in Preferences.")); - return; - } - string const url = String::compose( "ftp://%1:%2@ftp.gdc-tech.com/SHA256/A%3.crt.pem", Config::instance()->gdc_username().get(), diff --git a/src/wx/gdc_certificate_panel.h b/src/wx/gdc_certificate_panel.h index 18a78e586..b69c7a51f 100644 --- a/src/wx/gdc_certificate_panel.h +++ b/src/wx/gdc_certificate_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2020 Carl Hetherington This file is part of DCP-o-matic. @@ -18,9 +18,9 @@ */ -#include "download_certificate_panel.h" +#include "credentials_download_certificate_panel.h" -class GDCCertificatePanel : public DownloadCertificatePanel +class GDCCertificatePanel : public CredentialsDownloadCertificatePanel { public: GDCCertificatePanel (DownloadCertificateDialog* dialog); diff --git a/src/wx/wscript b/src/wx/wscript index b04054a77..f4fc4927e 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -48,6 +48,7 @@ sources = """ content_view.cc controls.cc closed_captions_dialog.cc + credentials_download_certificate_panel.cc dcp_panel.cc dcpomatic_button.cc email_dialog.cc -- 2.30.2