Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » More new functions
Re: More new functions [message #18834 is a reply to message #18804] Sun, 26 October 2008 01:19 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3432
Registered: August 2008
Senior Veteran
Hello all

Thank you for the feedback. First I inclose you a screengrab of a program I am doing that uses these functions. It is very preliminary but it runs:

index.php?t=getfile&id=1462&private=0

With this program I drag-drop movie clips in a main track that I convert in DVD format mpg files:
- With LaunchCommand(const char *cmd, String &ret); I get the video images you see in the center-left side column using mplayer
- With LaunchCommand(const char *cmd, void (*readCallBack)(String &)); I get the final .mpg DVD compatible file using mencoder. All the mencoder output goes to a function that sends it to a window (in the screengrab). If the window is closed, it kills the process before.

Coming to the comments:
- You are right: I have to change LaunchCommand in case of non GUI program to not call Ctrl::ProcessEvents();
- Ctrl::ProcessEvents(); lets the main GUI program to follow doing other things and being responsive to user without stoping the process. The command runs in another thread and the main GUI program only gets its output.
It is not perfect multithread, but it works well.
- In LaunchCommand, for example, to join to files, I would do LaunchCommand("mencoder a.avi b.avo -oac copy -ovc copy - ab.avi", myfun);
a basic myfun would be like:
void myfun(String &s)
{
     MySendStrToCommandWindow(s);
     MyParseStrToMoveProgressBar(s);
}

About the functions, I have prepared more but before finishing them I would like to ask you if putting them in different functions or declaring them into classes like:

class SysFolders          // Special folders
	String GetDesktop();
	String GetPrograms();
	String GetAppData();
	String GetMusic();
	String GetPictures();
	String GetVideo();
	String GetPersonal();
	String GetTemplates();
	String GetDownload();

	String GetRoot();  // New
	String GetTemp();  // New
        Possible new functions to change folders

class SysOS          // OS info. Samples after //
	String GetName();	// Windows  Linux
	String GetCode();	// 6.0	    2.6.8-1.523
	String GetVersion();	// Vista    Ubuntu
	String GetRelease();	// Home Premium Edition	8.04
	String GetSize();	// 64-bit   32-bit

class SysCPU          //CPU info
	String GetIdentifier();
	String GetLevel();
	String GetRevision();
	String GetArchitecture;
	String GetSpeed();
	String GetNumber();
        Possible new functions to get more details

class SysProcesses          //Current processes info. 
	bool Update();      // Gets processes info
	bool GetFirst(int processId, String pName);
	vool GetNext(int processId, String pName);
        Possible new functions to kill processes or change priority


I have seen in Upp that it tends to not create new classes with grouped static functions inside, but doing alone functions. What do you prefer ?

Best regards
Koldo



Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Simple app-wide "macros"
Next Topic: Grid helper
Goto Forum:
  


Current Time: Thu May 08 07:51:09 CEST 2025

Total time taken to generate the page: 0.02801 seconds