Difference between revisions of "FileSave screen"

From LinuxMCE
Jump to: navigation, search
(How it's implemented)
Line 32: Line 32:
 
* When "Choose" button from "Choose Drive" is pressed, the name of the device is saved and a "go back" command is sent.
 
* When "Choose" button from "Choose Drive" is pressed, the name of the device is saved and a "go back" command is sent.
 
* When "Choose" button from "Choose Folder" is pressed, the command attached to the screen is executed using "CMD_Send_Message" command, then Orbiter goes to main menu and FileSave screen's internal status is reseted.
 
* When "Choose" button from "Choose Folder" is pressed, the command attached to the screen is executed using "CMD_Send_Message" command, then Orbiter goes to main menu and FileSave screen's internal status is reseted.
 
+
* When "Create Directory" button from "Choose Folder" is pressed, SCREEN_GenericKeyboard is used to get the name of the new folder and a command is attach to that screen : a spawn application to be sent to local application server with a makedir.
  
 
== Examples ==
 
== Examples ==
 
* Ripping
 
* Ripping
 
* Saving bookmarks
 
* Saving bookmarks

Revision as of 10:00, 23 August 2006

This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.
FileSave screen allows the user to save files on a storage drive (network drive, internal drive, core, etc.), on a private or public folder, to choose a folder or create new ones and to choose a name for the file to save.

How to use it

SCREEN_FileSave has three specific parameters: default user, caption and the command to be executed with the file.

From a DCE project, you will have to include "Gen_Devices/AllScreens.h" and write two lines of code:

DCE::SCREEN_FileSave screen_FileSave(m_dwPK_Device,pMessage->m_dwPK_Device_From, "", "Please type a name for the file", sCommand);

SendCommand(screen_FileSave);


How it's implemented

Orbiter has a screen handler called SCREEN_FileSave and implemented in ScreenHandler class. The first thing it does is to send a CMD_Get_Default_Ripping_Info command to Media Plugin and get the default name for the file the be saved, the id of the device with most free space, the name of the device and the base folder for it. The information is saved in few member variables: m_sSaveFile_FileName, m_nSaveFile_PK_DeviceDrive, m_sSaveFile_Drive and m_sSaveFile_MountedFolder.

Variables use for gui to be substituted with real values are:

  • VARIABLE_Misc_Data_3_CONST (#31) : the name of the device (which includes the device id and the amount of free space in MB)
  • VARIABLE_Misc_Data_4_CONST (#33) : relative folder to base path
  • VARIABLE_Device_List_CONST (#45) : the id of the storage device
  • VARIABLE_Misc_Data_5_CONST (#43) : base path for device
  • VARIABLE_Seek_Value_CONST (#17) : the file name


The screen has two registered interceptors:

  • for cbObjectSelected (method FileSave_ObjectSelected)
  • for cbDataGridSelected (method FileSave_GridSelected)

Actions:

  • When "Choose" button from "Choose Drive" is pressed, the name of the device is saved and a "go back" command is sent.
  • When "Choose" button from "Choose Folder" is pressed, the command attached to the screen is executed using "CMD_Send_Message" command, then Orbiter goes to main menu and FileSave screen's internal status is reseted.
  • When "Create Directory" button from "Choose Folder" is pressed, SCREEN_GenericKeyboard is used to get the name of the new folder and a command is attach to that screen : a spawn application to be sent to local application server with a makedir.

Examples

  • Ripping
  • Saving bookmarks