Reorganized windows and IPC classes

parent 47ba2a47
SOURCES = src/main.cpp src/splashpage.cpp src/skylivex.h SOURCES = src/main.cpp \
src/mainwin.cpp \
src/skylivex.cpp # src/plugins.cpp
HEADERS = src/skylivex.h\
src/mainwin.h # src/plugins.h src/pluginsinterfaces.h
QT += network webkitwidgets widgets QT += network webkitwidgets widgets
OTHER_FILES += \ OTHER_FILES += \
gui/splash.html gui/splash.html \
gui/img/logo.png
...@@ -36,41 +36,10 @@ ...@@ -36,41 +36,10 @@
*/ */
#include <QApplication> #include <QApplication>
#include <QFile> #include <QFile>
#include <QObject> #include <QTimer>
#include "mainwin.h"
#include "skylivex.h" #include "skylivex.h"
/*
* class SkyliveX
* This is the core of the SkyliveX client.
* Here the inter-thread and inter-process communication
* with plugins is done, so, the magic happen here
*/
class SkyliveX : public QObject
{
Q_OBJECT
public:
SkyliveX(QObject *parent=0) : QObject(parent) {}
~SkyliveX() {}
public slots:
void run()
{
emit finished();
}
signals:
void finished();
};
/*
* Not less important than the core is the main window.
* It is a Wekbit object that load our HTML/js gui
* for the main window!
*/
//class MainWindow
/* /*
* main loop. * main loop.
...@@ -85,25 +54,30 @@ int main(int argc, char *argv[]) ...@@ -85,25 +54,30 @@ int main(int argc, char *argv[])
{ {
// Start our application object // Start our application object
QApplication skylivex(argc, argv); QApplication skylivexapp(argc, argv);
// Start the splash screen. also // Start the splash screen. also
// the splash screen is a (transparent) webkit object // the splash screen is a (transparent) webkit object
QFile splashfile("gui/splash.html"); QFile splashfile("gui/splash.html");
SplashPage splashwin(splashfile); MainWin mainw(splashfile);
splashwin.show(); mainw.show();
// Instance of the core ITC/IPC messasing // Instance of the core ITC/IPC messasing
SkyliveX *skx = new SkyliveX(&skylivex); SkyliveX *skx = new SkyliveX(&skylivexapp);
// connect the "finished" signal coming from the ITC/IPC to the qui call // connect the "finished" signal coming from the ITC/IPC to the qui call
QObject::connect(skx, SIGNAL(finished()), &skx, SLOT(quit())); QObject::connect(skx, SIGNAL(finished()), &skylivexapp, SLOT(quit()), Qt::QueuedConnection);
// and give a slot to the ITC/IPC in the main loop // and give a slot to the ITC/IPC in the main loop
QTimer::signalShot(0, skx, SLOT(run())); QTimer::singleShot(0, skx, SLOT(initialize()));
// process IPC events when we are in idle from the main window
QTimer *skxprocess = new QTimer(skx);
QObject::connect(skxprocess, SIGNAL(timeout()), skx, SLOT(process()));
skxprocess->start();
// and then.. go! // and then.. go!
return skylivex.exec(); return skylivexapp.exec();
} }
...@@ -27,8 +27,32 @@ ...@@ -27,8 +27,32 @@
* *
******************************************************************** ********************************************************************
* *
* File: * File: splashpage.cpp
* *
* Purpose: * Purpose:
* *
*/ */
#include "mainwin.h"
#include <QFile>
#include <QDir>
MainWin::MainWin(QFile &htmlfile)
: QWebView(0)
{
htmlfile.open(QIODevice::ReadOnly);
htmlFileName = QString::fromUtf8(htmlfile.readAll().constData());
QUrl baseUrl = QUrl::fromLocalFile(QDir::current().absoluteFilePath("gui/dummy.html"));
setWindowFlags(Qt::FramelessWindowHint);
page()->setPalette(palette());
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_OpaquePaintEvent, false);
setHtml(htmlFileName, baseUrl);
resize(250,200);
}
MainWin::~MainWin()
{
}
...@@ -27,32 +27,34 @@ ...@@ -27,32 +27,34 @@
* *
******************************************************************** ********************************************************************
* *
* File: splashpage.cpp * File: skylivex.h
* *
* Purpose: * Purpose:
* *
*/ */
#include "skylivex.h" #ifndef MAINWIN_H
#define MAINWIN_H
#include <QWebView>
#include <QUrl>
#include <QFile> #include <QFile>
#include <QDir> #include <QString>
SplashPage::SplashPage(QFile &splash_html) /*
: QWebView(0) * class MainWin
* This is just a little webkit transparent window
* to show the splash screen
*/
class MainWin : public QWebView
{ {
splash_html.open(QIODevice::ReadOnly); QUrl baseurl;
splashFile = QString::fromUtf8(splash_html.readAll().constData()); QFile htmlfile;
QUrl baseUrl = QUrl::fromLocalFile(QDir::current().absoluteFilePath("gui/dummy.html")); QString htmlFileName;
setWindowFlags(Qt::FramelessWindowHint); public:
page()->setPalette(palette()); MainWin(QFile &htmlfile);
setAttribute(Qt::WA_TranslucentBackground, true); ~MainWin();
setAttribute(Qt::WA_OpaquePaintEvent, false); };
setHtml(splashFile, baseUrl);
resize(250,200);
}
SplashPage::~SplashPage()
{
} #endif
...@@ -35,4 +35,4 @@ ...@@ -35,4 +35,4 @@
#include <QPluginLoader> #include <QPluginLoader>
#include "pluginsinterfaces.h" #include "pluginsinterfaces.h"
#define sarca
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* *
* File: * File:
* *
* Purpose: * Purpose
*
*/ */
#define TEST
...@@ -32,3 +32,17 @@ ...@@ -32,3 +32,17 @@
* Purpose: * Purpose:
* *
*/ */
#include "skylivex.h"
#include <iostream>
void SkyliveX::initialize()
{
std::cout << "antani" << std::endl;
}
void SkyliveX::process()
{
std::cout << "process" << std::endl;
}
...@@ -35,20 +35,29 @@ ...@@ -35,20 +35,29 @@
#ifndef SKYLIVEX_H #ifndef SKYLIVEX_H
#define SKYLIVEX_H #define SKYLIVEX_H
#include <QWebView> #include <QObject>
#include <QUrl>
#include <QFile>
#include <QString>
class SplashPage : public QWebView
/*
* class SkyliveX
* This is the core of the SkyliveX client.
* Here the inter-thread and inter-process communication
* with plugins is done, so, the magic happen here
*/
class SkyliveX : public QObject
{ {
QUrl baseurl; Q_OBJECT
QFile splash_html;
QString splashFile;
public: public:
SplashPage(QFile &splash_html); SkyliveX(QObject *parent=0) : QObject(parent) {}
~SplashPage(); ~SkyliveX() {}
public slots:
void initialize();
void process();
signals:
void finished();
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment