first iteration of file upload window according to Charles' design
This commit is contained in:
parent
62ab3c8e24
commit
f687b00bc5
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.19 $
|
||||
Version : $Revision: 1.20 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -389,40 +389,40 @@ GLiveSupport :: showLoggedInUI(void) throw ()
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Determine the length of an audio file
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<time_duration>::Ref
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: getPlaylength(Ptr<const std::string>::Ref uri)
|
||||
throw (std::invalid_argument)
|
||||
{
|
||||
Ptr<time_duration>::Ref playlength;
|
||||
audioPlayer->open(*uri);
|
||||
playlength = audioPlayer->getPlaylength();
|
||||
audioPlayer->close();
|
||||
|
||||
return playlength;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Upload a file to the server.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Ptr<AudioClip>::Ref
|
||||
void
|
||||
LiveSupport :: GLiveSupport ::
|
||||
GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
|
||||
Ptr<const std::string>::Ref fileName)
|
||||
GLiveSupport :: uploadFile(Ptr<AudioClip>::Ref audioClip)
|
||||
throw (XmlRpcException)
|
||||
{
|
||||
// create a URI from the file name
|
||||
Ptr<std::string>::Ref uri(new std::string("file://"));
|
||||
*uri += *fileName;
|
||||
|
||||
// determine the playlength of the audio clip
|
||||
Ptr<time_duration>::Ref playlength;
|
||||
try {
|
||||
audioPlayer->open(*uri);
|
||||
playlength = audioPlayer->getPlaylength();
|
||||
audioPlayer->close();
|
||||
} catch (std::invalid_argument &e) {
|
||||
throw XmlRpcException(e.what());
|
||||
}
|
||||
|
||||
// create and upload an AudioClip object
|
||||
Ptr<AudioClip>::Ref audioClip(new AudioClip(title,
|
||||
playlength,
|
||||
uri));
|
||||
std::cerr << "GLiveSupport :: uploadFile #1" << std::endl;
|
||||
storage->storeAudioClip(sessionId, audioClip);
|
||||
std::cerr << "GLiveSupport :: uploadFile #2" << std::endl;
|
||||
|
||||
// add the uploaded file to the DJ Bag, and update it
|
||||
djBagContents->push_front(audioClip);
|
||||
std::cerr << "GLiveSupport :: uploadFile #3" << std::endl;
|
||||
masterPanel->updateDjBagWindow();
|
||||
|
||||
return audioClip;
|
||||
std::cerr << "GLiveSupport :: uploadFile #4" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.19 $
|
||||
Version : $Revision: 1.20 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -100,7 +100,7 @@ class MasterPanelWindow;
|
|||
* respective documentation.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.19 $
|
||||
* @version $Revision: 1.20 $
|
||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||
* @see AuthenticationClientFactory
|
||||
* @see StorageClientFactory
|
||||
|
@ -355,17 +355,26 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
void
|
||||
showLoggedInUI(void) throw ();
|
||||
|
||||
/**
|
||||
* Determine the length of an audio file, base on a URI to the file.
|
||||
*
|
||||
* @param uri an URI to a binary audio file
|
||||
* @return the length of the file
|
||||
* @exception std::invalid_argument if there is no file at the
|
||||
* specified URI
|
||||
*/
|
||||
Ptr<time_duration>::Ref
|
||||
getPlaylength(Ptr<const std::string>::Ref uri)
|
||||
throw (std::invalid_argument);
|
||||
|
||||
/**
|
||||
* Upload a file to the storage.
|
||||
*
|
||||
* @param title the title of the audio clip.
|
||||
* @param fileName the full filename of the audio clip.
|
||||
* @return the audio clip that was uploaded.
|
||||
* @param audioClip the file to upload
|
||||
* @exception XmlRpcException on upload failures.
|
||||
*/
|
||||
Ptr<AudioClip>::Ref
|
||||
uploadFile(Ptr<const Glib::ustring>::Ref title,
|
||||
Ptr<const std::string>::Ref fileName)
|
||||
void
|
||||
uploadFile(Ptr<AudioClip>::Ref audioClip)
|
||||
throw (XmlRpcException);
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -43,6 +43,7 @@
|
|||
using namespace Glib;
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
using namespace LiveSupport::GLiveSupport;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
@ -71,6 +72,8 @@ LoginWindow :: LoginWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
|
||||
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
||||
|
||||
set_default_size(350, 265);
|
||||
|
||||
try {
|
||||
set_title(*getResourceUstring("windowTitle"));
|
||||
loginLabel = Gtk::manage(
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.12 $
|
||||
Version : $Revision: 1.13 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -94,7 +94,6 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
vuMeterBin = Gtk::manage(widgetFactory->createBlueBin());
|
||||
vuMeterBin->add(*vuMeterWidget);
|
||||
vuMeterBin->set_size_request(400, 40);
|
||||
|
||||
// set up the next playing widget
|
||||
nextPlayingWidget = Gtk::manage(new Gtk::Label("next playing"));
|
||||
nextPlayingBin = Gtk::manage(widgetFactory->createBlueBin());
|
||||
|
@ -121,7 +120,6 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
bottomBar->attach(*userInfoAlignment, 1, 2, 0, 1,
|
||||
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
|
||||
5, 0);
|
||||
|
||||
// set up the main window, and show everything
|
||||
// all the localized widgets were set up in changeLanguage()
|
||||
set_border_width(10);
|
||||
|
@ -143,7 +141,6 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
layout->attach(*bottomBar, 0, 4, 2, 3,
|
||||
Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
|
||||
0, 0);
|
||||
|
||||
add(*layout);
|
||||
|
||||
// set the background to white
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.4 $
|
||||
Version : $Revision: 1.5 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -34,6 +34,8 @@
|
|||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <unicode/msgfmt.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
@ -43,6 +45,7 @@
|
|||
#include "UploadFileWindow.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::Widgets;
|
||||
using namespace LiveSupport::GLiveSupport;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
@ -62,50 +65,114 @@ using namespace LiveSupport::GLiveSupport;
|
|||
UploadFileWindow :: UploadFileWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||
Ptr<ResourceBundle>::Ref bundle)
|
||||
throw ()
|
||||
: LocalizedObject(bundle)
|
||||
: WhiteWindow("",
|
||||
0xffffff,
|
||||
WidgetFactory::getInstance()->getWhiteWindowCorners()),
|
||||
LocalizedObject(bundle)
|
||||
{
|
||||
this->gLiveSupport = gLiveSupport;
|
||||
fileName.reset(new std::string());
|
||||
isFileGood = false;
|
||||
|
||||
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
|
||||
|
||||
try {
|
||||
// generic resources
|
||||
set_title(*getResourceUstring("windowTitle"));
|
||||
chooseFileLabel.reset(new Gtk::Label(
|
||||
chooseFileLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("chooseFileLabel")));
|
||||
fileNameEntry.reset(new Gtk::Entry());
|
||||
chooseFileButton.reset(new Gtk::Button(
|
||||
fileNameEntryBin = Gtk::manage(wf->createEntryBin());
|
||||
fileNameEntry = fileNameEntryBin->getEntry();
|
||||
chooseFileButton = Gtk::manage(wf->createButton(
|
||||
*getResourceUstring("chooseFileButtonLabel")));
|
||||
nameLabel.reset(new Gtk::Label(
|
||||
*getResourceUstring("nameLabel")));
|
||||
nameEntry.reset(new Gtk::Entry());
|
||||
uploadButton.reset(new Gtk::Button(
|
||||
|
||||
// main section resources
|
||||
titleLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("titleLabel"),
|
||||
Gtk::ALIGN_RIGHT));
|
||||
titleEntryBin = Gtk::manage(wf->createEntryBin());
|
||||
titleEntry = titleEntryBin->getEntry();
|
||||
|
||||
creatorLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("creatorLabel"),
|
||||
Gtk::ALIGN_RIGHT));
|
||||
creatorEntryBin = Gtk::manage(wf->createEntryBin());
|
||||
creatorEntry = creatorEntryBin->getEntry();
|
||||
|
||||
genreLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("genreLabel"),
|
||||
Gtk::ALIGN_RIGHT));
|
||||
genreEntryBin = Gtk::manage(wf->createEntryBin());
|
||||
genreEntry = genreEntryBin->getEntry();
|
||||
|
||||
fileFormatLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("fileFormatLabel"),
|
||||
Gtk::ALIGN_RIGHT));
|
||||
fileFormatComboBox = Gtk::manage(wf->createComboBoxText());
|
||||
|
||||
lengthLabel = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("lengthLabel"),
|
||||
Gtk::ALIGN_RIGHT));
|
||||
lengthValueLabel = Gtk::manage(new Gtk::Label());
|
||||
|
||||
// build up the notepad for the different metadata sections
|
||||
mainSection = Gtk::manage(new Gtk::Alignment());
|
||||
metadataNotebook = Gtk::manage(new Notebook());
|
||||
metadataNotebook->appendPage(*mainSection,
|
||||
*getResourceUstring("mainSectionLabel"));
|
||||
|
||||
// buttons, etc.
|
||||
uploadButton = Gtk::manage(wf->createButton(
|
||||
*getResourceUstring("uploadButtonLabel")));
|
||||
closeButton.reset(new Gtk::Button(
|
||||
closeButton = Gtk::manage(wf->createButton(
|
||||
*getResourceUstring("closeButtonLabel")));
|
||||
statusBar.reset(new Gtk::Label(
|
||||
statusBar = Gtk::manage(new Gtk::Label(
|
||||
*getResourceUstring("statusBar")));
|
||||
} catch (std::invalid_argument &e) {
|
||||
// TODO: signal error
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
|
||||
// build up the main section
|
||||
// TODO: don't hard-code supported file format types
|
||||
fileFormatComboBox->append_text("mp3");
|
||||
fileFormatComboBox->set_active_text("mp3");
|
||||
mainLayout = Gtk::manage(new Gtk::Table());
|
||||
mainLayout->attach(*titleLabel, 0, 1, 0, 1);
|
||||
mainLayout->attach(*titleEntryBin, 1, 2, 0, 1);
|
||||
mainLayout->attach(*creatorLabel, 0, 1, 1, 2);
|
||||
mainLayout->attach(*creatorEntryBin, 1, 2, 1, 2);
|
||||
mainLayout->attach(*genreLabel, 0, 1, 2, 3);
|
||||
mainLayout->attach(*genreEntryBin, 1, 2, 2, 3);
|
||||
mainLayout->attach(*fileFormatLabel, 2, 3, 0, 1);
|
||||
mainLayout->attach(*fileFormatComboBox, 3, 4, 0, 1);
|
||||
mainLayout->attach(*lengthLabel, 2, 3, 1, 2);
|
||||
mainLayout->attach(*lengthValueLabel, 3, 4, 1, 2);
|
||||
mainSection->add(*mainLayout);
|
||||
|
||||
// build up the button bar
|
||||
buttonBar = Gtk::manage(new Gtk::HBox());
|
||||
buttonBar->add(*closeButton);
|
||||
buttonBar->add(*uploadButton);
|
||||
|
||||
// set up the layout, which is a button box
|
||||
layout.reset(new Gtk::Table());
|
||||
layout = Gtk::manage(new Gtk::Table());
|
||||
|
||||
// set up the main window, and show everything
|
||||
set_border_width(10);
|
||||
layout->attach(*chooseFileLabel, 0, 1, 0, 1);
|
||||
layout->attach(*fileNameEntry, 1, 2, 0, 1);
|
||||
layout->attach(*chooseFileButton, 2, 3, 0, 1);
|
||||
layout->attach(*nameLabel, 0, 1, 1, 2);
|
||||
layout->attach(*nameEntry, 1, 2, 1, 2);
|
||||
layout->attach(*uploadButton, 1, 2, 2, 3);
|
||||
layout->attach(*closeButton, 1, 2, 3, 4);
|
||||
layout->attach(*statusBar, 0, 3, 4, 5);
|
||||
layout->attach(*fileNameEntryBin, 0, 1, 1, 2);
|
||||
layout->attach(*chooseFileButton, 1, 2, 1, 2);
|
||||
layout->attach(*metadataNotebook, 0, 2, 2, 3);
|
||||
layout->attach(*buttonBar, 0, 2, 3, 4);
|
||||
layout->attach(*statusBar, 0, 2, 4, 5);
|
||||
|
||||
add(*layout);
|
||||
|
||||
// bind events
|
||||
chooseFileButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&UploadFileWindow::onChooseFileButtonClicked));
|
||||
fileNameEntry->signal_focus_out_event().connect(sigc::mem_fun(*this,
|
||||
&UploadFileWindow::onFileNameEntryLeave));
|
||||
uploadButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&UploadFileWindow::onUploadButtonClicked));
|
||||
closeButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||
|
@ -137,12 +204,60 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw ()
|
|||
int result = dialog->run();
|
||||
|
||||
if (result == Gtk::RESPONSE_OK) {
|
||||
fileName.reset(new std::string(dialog->get_filename()));
|
||||
fileNameEntry->set_text(*fileName);
|
||||
fileNameEntry->set_text(dialog->get_filename());
|
||||
updateFileInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Update the file information to upload.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
UploadFileWindow :: updateFileInfo(void) throw ()
|
||||
{
|
||||
std::string newFileName = fileNameEntry->get_text().raw();
|
||||
|
||||
if (*fileName != newFileName) {
|
||||
// see if the file exists, and is readable
|
||||
std::ifstream file(newFileName.c_str());
|
||||
if (!file.good()) {
|
||||
isFileGood = false;
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
isFileGood = true;
|
||||
fileName.reset(new std::string(newFileName));
|
||||
|
||||
fileURI.reset(new std::string("file://"));
|
||||
*fileURI += *fileName;
|
||||
|
||||
playlength = gLiveSupport->getPlaylength(fileURI);
|
||||
|
||||
// display the new play length
|
||||
std::ostringstream lengthStr;
|
||||
lengthStr << std::setfill('0')
|
||||
<< std::setw(2) << playlength->hours() << ":"
|
||||
<< std::setw(2) << playlength->minutes() << ":"
|
||||
<< std::setw(2) << playlength->seconds();
|
||||
lengthValueLabel->set_text(lengthStr.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The event when the user has left the file name entry box.
|
||||
*----------------------------------------------------------------------------*/
|
||||
bool
|
||||
UploadFileWindow :: onFileNameEntryLeave(GdkEventFocus * event)
|
||||
throw ()
|
||||
{
|
||||
updateFileInfo();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The event when the upload button has been clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -150,14 +265,32 @@ void
|
|||
UploadFileWindow :: onUploadButtonClicked(void) throw ()
|
||||
{
|
||||
try {
|
||||
Ptr<const Glib::ustring>::Ref title;
|
||||
Ptr<const std::string>::Ref fileName;
|
||||
Ptr<AudioClip>::Ref audioClip;
|
||||
|
||||
title.reset(new Glib::ustring(nameEntry->get_text()));
|
||||
fileName.reset(new std::string(fileNameEntry->get_text().raw()));
|
||||
|
||||
audioClip = gLiveSupport->uploadFile(title, fileName);
|
||||
updateFileInfo();
|
||||
if (!isFileGood) {
|
||||
// TODO: localize error message
|
||||
throw std::invalid_argument("file does not exist");
|
||||
}
|
||||
|
||||
Ptr<const Glib::ustring>::Ref ustrValue;
|
||||
|
||||
ustrValue.reset(new Glib::ustring(titleEntry->get_text()));
|
||||
|
||||
// create and upload an AudioClip object
|
||||
Ptr<AudioClip>::Ref audioClip(new AudioClip(ustrValue,
|
||||
playlength,
|
||||
fileURI));
|
||||
|
||||
// set the metadata available
|
||||
ustrValue.reset(new Glib::ustring(creatorEntry->get_text()));
|
||||
audioClip->setMetadata(ustrValue, "dc:creator");
|
||||
ustrValue.reset(new Glib::ustring(genreEntry->get_text()));
|
||||
audioClip->setMetadata(ustrValue, "dc:type");
|
||||
ustrValue.reset(new Glib::ustring(
|
||||
fileFormatComboBox->get_active_text()));
|
||||
audioClip->setMetadata(ustrValue, "dc:format");
|
||||
|
||||
// upload the audio clip
|
||||
gLiveSupport->uploadFile(audioClip);
|
||||
|
||||
// display success in the status bar
|
||||
Ptr<UnicodeString>::Ref uTitle = ustringToUnicodeString(
|
||||
|
@ -170,8 +303,10 @@ UploadFileWindow :: onUploadButtonClicked(void) throw ()
|
|||
statusBar->set_text(*statusText);
|
||||
|
||||
// clean the entry fields
|
||||
nameEntry->set_text("");
|
||||
fileNameEntry->set_text("");
|
||||
//titleEntry->set_text("");
|
||||
//fileNameEntry->set_text("");
|
||||
} catch (std::invalid_argument &e) {
|
||||
statusBar->set_text(e.what());
|
||||
} catch (XmlRpcException &e) {
|
||||
statusBar->set_text(e.what());
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.2 $
|
||||
Version : $Revision: 1.3 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -43,10 +43,17 @@
|
|||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/table.h>
|
||||
#include <gtkmm/entry.h>
|
||||
#include <gtkmm/alignment.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/window.h>
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Core/LocalizedObject.h"
|
||||
#include "LiveSupport/Widgets/Button.h"
|
||||
#include "LiveSupport/Widgets/EntryBin.h"
|
||||
#include "LiveSupport/Widgets/ComboBoxText.h"
|
||||
#include "LiveSupport/Widgets/Notebook.h"
|
||||
#include "LiveSupport/Widgets/WhiteWindow.h"
|
||||
|
||||
#include "GLiveSupport.h"
|
||||
#include "MasterPanelUserInfoWidget.h"
|
||||
|
@ -55,6 +62,7 @@ namespace LiveSupport {
|
|||
namespace GLiveSupport {
|
||||
|
||||
using namespace LiveSupport::Core;
|
||||
using namespace LiveSupport::Widgets;
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
@ -79,55 +87,135 @@ using namespace LiveSupport::Core;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.2 $
|
||||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
class UploadFileWindow : public Gtk::Window, public LocalizedObject
|
||||
class UploadFileWindow : public WhiteWindow, public LocalizedObject
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* The layout used in the window.
|
||||
*/
|
||||
Ptr<Gtk::Table>::Ref layout;
|
||||
Gtk::Table * layout;
|
||||
|
||||
/**
|
||||
* The choose file label
|
||||
*/
|
||||
Ptr<Gtk::Label>::Ref chooseFileLabel;
|
||||
Gtk::Label * chooseFileLabel;
|
||||
|
||||
/**
|
||||
* A container holding the file name entry field.
|
||||
*/
|
||||
EntryBin * fileNameEntryBin;
|
||||
|
||||
/**
|
||||
* The text entry for selecting a file name
|
||||
*/
|
||||
Ptr<Gtk::Entry>::Ref fileNameEntry;
|
||||
Gtk::Entry * fileNameEntry;
|
||||
|
||||
/**
|
||||
* The file browser button.
|
||||
*/
|
||||
Ptr<Gtk::Button>::Ref chooseFileButton;
|
||||
Button * chooseFileButton;
|
||||
|
||||
/**
|
||||
* The name label
|
||||
* The notepad holding the different sections of metadata.
|
||||
*/
|
||||
Ptr<Gtk::Label>::Ref nameLabel;
|
||||
Notebook * metadataNotebook;
|
||||
|
||||
/**
|
||||
* The text input for the name.
|
||||
* The main input section.
|
||||
*/
|
||||
Ptr<Gtk::Entry>::Ref nameEntry;
|
||||
Gtk::Alignment * mainSection;
|
||||
|
||||
/**
|
||||
* The layout of the main section.
|
||||
*/
|
||||
Gtk::Table * mainLayout;
|
||||
|
||||
/**
|
||||
* The title label
|
||||
*/
|
||||
Gtk::Label * titleLabel;
|
||||
|
||||
/**
|
||||
* A container holding the title entry field.
|
||||
*/
|
||||
EntryBin * titleEntryBin;
|
||||
|
||||
/**
|
||||
* The text input for the title.
|
||||
*/
|
||||
Gtk::Entry * titleEntry;
|
||||
|
||||
/**
|
||||
* The creator label
|
||||
*/
|
||||
Gtk::Label * creatorLabel;
|
||||
|
||||
/**
|
||||
* A container holding the creator entry field.
|
||||
*/
|
||||
EntryBin * creatorEntryBin;
|
||||
|
||||
/**
|
||||
* The text input for the creator.
|
||||
*/
|
||||
Gtk::Entry * creatorEntry;
|
||||
|
||||
/**
|
||||
* The genre label
|
||||
*/
|
||||
Gtk::Label * genreLabel;
|
||||
|
||||
/**
|
||||
* A container holding the genre entry field.
|
||||
*/
|
||||
EntryBin * genreEntryBin;
|
||||
|
||||
/**
|
||||
* The text input for the genre.
|
||||
*/
|
||||
Gtk::Entry * genreEntry;
|
||||
|
||||
/**
|
||||
* The file format label.
|
||||
*/
|
||||
Gtk::Label * fileFormatLabel;
|
||||
|
||||
/**
|
||||
* The file format combo box.
|
||||
*/
|
||||
ComboBoxText * fileFormatComboBox;
|
||||
|
||||
/**
|
||||
* The length label.
|
||||
*/
|
||||
Gtk::Label * lengthLabel;
|
||||
|
||||
/**
|
||||
* The length value label.
|
||||
*/
|
||||
Gtk::Label * lengthValueLabel;
|
||||
|
||||
/**
|
||||
* The button bar.
|
||||
*/
|
||||
Gtk::HBox * buttonBar;
|
||||
|
||||
/**
|
||||
* The upload button.
|
||||
*/
|
||||
Ptr<Gtk::Button>::Ref uploadButton;
|
||||
Gtk::Button * uploadButton;
|
||||
|
||||
/**
|
||||
* The close button.
|
||||
*/
|
||||
Ptr<Gtk::Button>::Ref closeButton;
|
||||
Gtk::Button * closeButton;
|
||||
|
||||
/**
|
||||
* The status bar.
|
||||
*/
|
||||
Ptr<Gtk::Label>::Ref statusBar;
|
||||
Gtk::Label * statusBar;
|
||||
|
||||
/**
|
||||
* The gLiveSupport object, handling the logic of the application.
|
||||
|
@ -139,6 +227,22 @@ class UploadFileWindow : public Gtk::Window, public LocalizedObject
|
|||
*/
|
||||
Ptr<std::string>::Ref fileName;
|
||||
|
||||
/**
|
||||
* Signals if the file under fileName is good.
|
||||
*/
|
||||
bool isFileGood;
|
||||
|
||||
/**
|
||||
* The URI to the file to upload.
|
||||
* Basically same as fileName, with 'file://' prepended.
|
||||
*/
|
||||
Ptr<std::string>::Ref fileURI;
|
||||
|
||||
/**
|
||||
* The playling length of the file to upload.
|
||||
*/
|
||||
Ptr<time_duration>::Ref playlength;
|
||||
|
||||
/**
|
||||
* Function to catch the event of the choose file button being
|
||||
* pressed.
|
||||
|
@ -153,12 +257,29 @@ class UploadFileWindow : public Gtk::Window, public LocalizedObject
|
|||
virtual void
|
||||
onUploadButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* Signal handler for the user leaving the filename entry box,
|
||||
* where persumably he may have types in a new filename.
|
||||
*
|
||||
* @param event the event recieved.
|
||||
* @return true if the event has been processed, false otherwise.
|
||||
*/
|
||||
bool
|
||||
onFileNameEntryLeave(GdkEventFocus * event) throw ();
|
||||
|
||||
/**
|
||||
* Function to catch the event of the close button being pressed.
|
||||
*/
|
||||
virtual void
|
||||
onCloseButtonClicked(void) throw ();
|
||||
|
||||
/**
|
||||
* Update the information for the file to upload, based on the
|
||||
* value of the fileNameEntry text entry field.
|
||||
*/
|
||||
void
|
||||
updateFileInfo(void) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -65,11 +65,18 @@ hu:table
|
|||
|
||||
uploadFileWindow:table
|
||||
{
|
||||
windowTitle:string { "File Feltőltés Ablak" }
|
||||
windowTitle:string { "File Feltőltés" }
|
||||
|
||||
chooseFileLabel:string { "Filenév" }
|
||||
chooseFileButtonLabel:string { "Tallóz" }
|
||||
|
||||
mainSectionLabel:string { "Fő" }
|
||||
titleLabel:string { "Cim" }
|
||||
creatorLabel:string { "Szerző" }
|
||||
genreLabel:string { "Stilus" }
|
||||
fileFormatLabel:string { "File tipus" }
|
||||
lengthLabel:string { "Hossz" }
|
||||
|
||||
chooseFileLabel:string { "file: " }
|
||||
chooseFileButtonLabel:string { "tallóz..." }
|
||||
nameLabel:string { "hang file név: " }
|
||||
uploadButtonLabel:string { "feltölt" }
|
||||
closeButtonLabel:string { "bezár" }
|
||||
statusBar:string { "állapotsor" }
|
||||
|
|
|
@ -65,13 +65,20 @@ root:table
|
|||
|
||||
uploadFileWindow:table
|
||||
{
|
||||
windowTitle:string { "Upload File Window" }
|
||||
windowTitle:string { "Upload File" }
|
||||
|
||||
chooseFileLabel:string { "file: " }
|
||||
chooseFileButtonLabel:string { "browse..." }
|
||||
nameLabel:string { "audio clip name: " }
|
||||
uploadButtonLabel:string { "upload" }
|
||||
closeButtonLabel:string { "close" }
|
||||
chooseFileLabel:string { "Filename" }
|
||||
chooseFileButtonLabel:string { "Browse" }
|
||||
|
||||
mainSectionLabel:string { "Main" }
|
||||
titleLabel:string { "Title" }
|
||||
creatorLabel:string { "Creator" }
|
||||
genreLabel:string { "Genre" }
|
||||
fileFormatLabel:string { "File Type" }
|
||||
lengthLabel:string { "Duration" }
|
||||
|
||||
uploadButtonLabel:string { "Upload" }
|
||||
closeButtonLabel:string { "Cancel" }
|
||||
statusBar:string { "status bar" }
|
||||
|
||||
fileChooserDialogTitle:string { "Choose a File" }
|
||||
|
|
Loading…
Reference in New Issue