-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I just had a quick look at main.cpp. I saw that a QApplication object is 
created after
the processing of the command line arguments. That is sensible, because QT 
doesn't
need to be loaded to process cli-arguments.
But the translator can only be loaded after QApplication. So the output on the 
cli
can't be translated (yet).

There seems to be a solution:
A separate class (here: application) is something like a wrapper for 
QApplication: A
object of the class is being created at the very beginning, but QApplication is 
loaded
some time later.

I included two sparse files. They show the rough handling.
In main.cpp may to be something like:

#include "application.h"
int main(int argc, char **argv)
{
        application a(argc, argv);
        QTranslator *myapp = new QTranslator(&a);
        QString QTDIR = getenv("QTDIR");
        myapp->load(QString("qt_%1").arg(QTextCodec::locale()), QTDIR + 
"/translations");
        a.installTranslator(myapp);

        a.init();

        return(a.exec());
}

So the application has a name and the translator can be loaded. The obejct is 
really
created with a.init().

Please tell me, what you think about it.

Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHF8UWE5UqXaCvB8IRAl/9AJwKzHblavRU9dXVSu8KlLUg+7xihQCffasT
QZKBYXWkefB/+dknd3V14As=
=vkWj
-----END PGP SIGNATURE-----
#include "application.h"

application::application(int argc, char **argv) : QApplication(argc, argv)
{

}

application::~application()
{

}

// public methods:

void application::init()
{
//	SplashScreen *sscSplash = new SplashScreen();

//	sscSplash->show();
	a->processEvents();

	mainWin = new MainWindow();
	// build up MainWindow

//	sscSplash->close();


//	delete sscSplash;
}

int application::exec()
{
	int r;
	
	r = QApplication::exec();

	// call the destructor
	delete mainWin;

	return(r);
}
#ifndef APPLICATION_H
#define APPLICATION_H

#include <qapplication.h>

class application : public QApplication
{
	Q_OBJECT

	public:
		Application(int argc, char **argv);
		~Application();

		// public methods:
		void init();
		int exec();
		
	private:
		// windows:
		MainWindow *mainWin;
};

#endif /* APPLICATION_H */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
DVBCUT-devel mailing list
DVBCUT-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dvbcut-devel

Reply via email to