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
OTHER_FILES += \
gui/splash.html
gui/splash.html \
gui/img/logo.png
......@@ -36,41 +36,10 @@
*/
#include <QApplication>
#include <QFile>
#include <QObject>
#include <QTimer>
#include "mainwin.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.
......@@ -85,25 +54,30 @@ int main(int argc, char *argv[])
{
// Start our application object
QApplication skylivex(argc, argv);
QApplication skylivexapp(argc, argv);
// Start the splash screen. also
// the splash screen is a (transparent) webkit object
QFile splashfile("gui/splash.html");
SplashPage splashwin(splashfile);
splashwin.show();
MainWin mainw(splashfile);
mainw.show();
// 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
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
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!
return skylivex.exec();
return skylivexapp.exec();
}
......@@ -27,8 +27,32 @@
*
********************************************************************
*
* File:
* File: splashpage.cpp
*
* 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 @@
*
********************************************************************
*
* File: splashpage.cpp
* File: skylivex.h
*
* Purpose:
*
*/
#include "skylivex.h"
#ifndef MAINWIN_H
#define MAINWIN_H
#include <QWebView>
#include <QUrl>
#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);
splashFile = QString::fromUtf8(splash_html.readAll().constData());
QUrl baseUrl = QUrl::fromLocalFile(QDir::current().absoluteFilePath("gui/dummy.html"));
QUrl baseurl;
QFile htmlfile;
QString htmlFileName;
setWindowFlags(Qt::FramelessWindowHint);
page()->setPalette(palette());
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_OpaquePaintEvent, false);
public:
MainWin(QFile &htmlfile);
~MainWin();
};
setHtml(splashFile, baseUrl);
resize(250,200);
}
SplashPage::~SplashPage()
{
}
#endif
......@@ -35,4 +35,4 @@
#include <QPluginLoader>
#include "pluginsinterfaces.h"
#define sarca
......@@ -29,6 +29,7 @@
*
* File:
*
* Purpose:
*
* Purpose
*/
#define TEST
......@@ -32,3 +32,17 @@
* 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 @@
#ifndef SKYLIVEX_H
#define SKYLIVEX_H
#include <QWebView>
#include <QUrl>
#include <QFile>
#include <QString>
#include <QObject>
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;
QFile splash_html;
QString splashFile;
Q_OBJECT
public:
SplashPage(QFile &splash_html);
~SplashPage();
SkyliveX(QObject *parent=0) : QObject(parent) {}
~SkyliveX() {}
public slots:
void initialize();
void process();
signals:
void finished();
};
#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