You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.6 KiB
78 lines
1.6 KiB
#include <QtGui/QApplication>
|
|
|
|
#include <QTextCodec>
|
|
#include <QLocale>
|
|
#include <QTranslator>
|
|
#include <QMessageBox>
|
|
#include <QFile>
|
|
#include <QDateTime>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QProcess>
|
|
|
|
#include "systeminstaller.h"
|
|
|
|
static QFile debugLog;
|
|
|
|
void toDebugLog(const QString& str);
|
|
void MsgHandler(QtMsgType type, const char *msg);
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") );
|
|
QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8") );
|
|
QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") );
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
qInstallMsgHandler( MsgHandler );
|
|
|
|
debugLog.setFileName("/var/log/calculate/cl-install-gui-debug.log");
|
|
if ( debugLog.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text | QIODevice::Unbuffered) )
|
|
{
|
|
qDebug() << "Installation started";
|
|
}
|
|
|
|
SystemInstaller installer;
|
|
|
|
QProcess::execute("export QT_PLUGIN_PATH=/home/ivan/.kde4/lib64/kde4/plugins/:/usr/lib64/kde4/plugins/" );
|
|
//qDebug() << app.libraryPaths().join(" ");
|
|
|
|
if ( getuid() != 0)
|
|
{
|
|
QMessageBox::critical(
|
|
0,
|
|
QObject::tr("Error"),
|
|
QObject::tr("You do not have administrative privileges.")
|
|
);
|
|
return -1;
|
|
}
|
|
|
|
//app.addLibraryPath("/usr");
|
|
|
|
installer.show();
|
|
|
|
return app.exec();
|
|
}
|
|
|
|
void MsgHandler(QtMsgType type, const char *msg)
|
|
{
|
|
switch (type) {
|
|
case QtDebugMsg:
|
|
toDebugLog( QString(msg) );
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void toDebugLog(const QString& str)
|
|
{
|
|
if (debugLog.isOpen())
|
|
debugLog.write(
|
|
("[" + QDateTime::currentDateTime().toString(Qt::ISODate) + "] " +
|
|
str + "\n\r").toLocal8Bit()
|
|
);
|
|
}
|