diff --git a/player/Forms/mainwindow.ui b/player/Forms/mainwindow.ui
index b78356f16..b405291d8 100644
--- a/player/Forms/mainwindow.ui
+++ b/player/Forms/mainwindow.ui
@@ -6,51 +6,20 @@
0
0
- 312
- 387
+ 320
+ 480
-
-
-
-
-
-
- 51
- 51
- 51
-
-
-
-
-
-
-
-
- 51
- 51
- 51
-
-
-
-
-
-
-
-
- 51
- 51
- 51
-
-
-
-
-
-
Gideros Player
+
+
+ 1
+ 1
+
+
0
@@ -88,24 +57,64 @@
0
0
- 312
+ 320
21
+
+
+
+
+
+
+ 240
+ 240
+ 240
+
+
+
+
+
+
+
+
+ 240
+ 240
+ 240
+
+
+
+
+
+
+
+
+ 240
+ 240
+ 240
+
+
+
+
+
+
+
+
- E&xit
+ Exit
+
+
+ Alt+E
@@ -267,9 +293,6 @@
true
-
- true
-
Unlimited
@@ -302,9 +325,6 @@
Run
-
- Ctrl+R
-
@@ -312,23 +332,20 @@
-
- true
-
50%
-
- true
-
- true
+ false
100%
+
+ Alt+O
+
@@ -411,9 +428,6 @@
-
- true
-
25 %
@@ -458,6 +472,30 @@
1080x1920
+
+
+ true
+
+
+ 750x1334 (iPhone 6)
+
+
+
+
+ true
+
+
+ 1242x2208 (iPhone 6 Plus)
+
+
+
+
+ true
+
+
+ 900x1200
+
+
Open
@@ -475,9 +513,6 @@
-
- true
-
Hide Menu
@@ -496,9 +531,53 @@
Alt+Return
+
+
+ Zoom In
+
+
+ Alt+Up
+
+
+
+
+ Zoom Out
+
+
+ Alt+Down
+
+
+
+
+ Fit To Window
+
+
+ Alt+W
+
+
+
+
+ Settings
+
+
+
+
+ true
+
+
+ Draw Infos
+
+
+
+
+
+
+
+
+
diff --git a/player/Headers/glcanvas.h b/player/Headers/glcanvas.h
index 0eaf3b5e7..1deee6202 100644
--- a/player/Headers/glcanvas.h
+++ b/player/Headers/glcanvas.h
@@ -12,29 +12,11 @@ class Server;
#include "platform.h"
#include
#include
+//#include
-#include
-/*
-class PlatformImplementation : public PlatformInterface
-{
-public:
- PlatformImplementation(LuaApplication* application) : application_(application) {}
-
- virtual void openUrl(const char* url);
- virtual void memoryWarning();
-
- void openUrls();
-private:
- QTimer* timer_;
- std::vector urls_;
- LuaApplication* application_;
-};
-*/
-
-class GLCanvas : public QGLWidget
-{
+class GLCanvas : public QGLWidget{
Q_OBJECT
public:
@@ -43,67 +25,84 @@ class GLCanvas : public QGLWidget
void setHardwareOrientation(Orientation orientation);
void setResolution(int width, int height);
-
void setFps(int fps);
-
- //std::set accessedResourceFiles;
- std::set allResourceFiles;
+ void setDrawInfos(bool drawInfos);
+ void setScale(float scale);
+ void setCanvasColor(float canvasColor[3]);
+ void setInfoColor(float infoColor[3]);
void sendRun();
- void setScale(int scale);
-
// function to play an application into player passing a directory
void play(QDir directory);
-private:
- //static void accessFileCallback_s(FileType type, const char* filename, void* data);
- //void accessFileCallback(FileType type, const char* filename);
+ //std::set accessedResourceFiles;
+ std::set allResourceFiles;
private slots:
void onTimer();
private:
+ LuaApplication* application_;
+ Server* server_;
+ ErrorDialog errorDialog_;
+ QDir dir_;
+ Orientation orientation_;
+ int width_, height_;
+ std::string resourceDirectory_;
+ std::string md5filename_;
+ int fps_;
+ double clock_;
+ QString projectName_;
+ bool running_;
+ std::map > md5_;
+ float scale_;
+ bool drawInfos_;
+ float canvasColor_[3];
+ float infoColor_[3];
+ // PlatformImplementation* platformImplementation_;
+
+ void setupProperties();
+ void setupApplicationProperties();
virtual void initializeGL();
+
virtual void paintGL();
virtual void timerEvent(QTimerEvent *);
-
virtual void mousePressEvent(QMouseEvent* event);
virtual void mouseMoveEvent(QMouseEvent* event);
virtual void mouseReleaseEvent(QMouseEvent* event);
-
virtual void keyPressEvent(QKeyEvent* event);
virtual void keyReleaseEvent(QKeyEvent* event);
-
-private:
void deleteFiles();
void sendFileList();
-
-private:
void loadMD5();
void saveMD5();
void calculateMD5(const char* file);
- void printMD5();
+ void printMD5();
+
+ //static void accessFileCallback_s(FileType type, const char* filename, void* data);
+ //void accessFileCallback(FileType type, const char* filename);
signals:
void projectNameChanged(const QString& projectName);
-
-private:
- LuaApplication* application_;
- Server* server_;
- ErrorDialog errorDialog_;
-// PlatformImplementation* platformImplementation_;
- QDir dir_;
- Orientation orientation_;
- int width_, height_;
- std::string resourceDirectory_;
- std::string md5filename_;
- int fps_;
- double clock_;
- QString projectName_;
- bool running_;
- std::map > md5_;
- int scale_;
};
#endif // GLCANVAS_H
+
+/*
+class PlatformImplementation : public PlatformInterface
+{
+public:
+ PlatformImplementation(LuaApplication* application) : application_(application) {}
+
+ virtual void openUrl(const char* url);
+ virtual void memoryWarning();
+
+ void openUrls();
+
+private:
+ QTimer* timer_;
+ std::vector urls_;
+ LuaApplication* application_;
+};
+*/
diff --git a/player/Headers/mainwindow.h b/player/Headers/mainwindow.h
index 909f0267c..61fb161e8 100644
--- a/player/Headers/mainwindow.h
+++ b/player/Headers/mainwindow.h
@@ -7,63 +7,109 @@
class GLCanvas;
class QActionGroup;
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
+enum Scale{
+ eZoomIn,
+ eZoomOut,
+ eFitToWindow
+};
-public:
- MainWindow(QWidget *parent = 0);
- ~MainWindow();
+enum Rotate{
+ eLeft,
+ eRight
+};
-protected:
- // protected actions based on events like close, resize, ...
- virtual void closeEvent(QCloseEvent*);
- virtual void resizeEvent(QResizeEvent*);
+class MainWindow : public QMainWindow{
+ Q_OBJECT
-private slots:
- void setupUi();
- void setupGroups();
- void loadSettings();
- void saveSettings();
- void loadResolution(int resolution);
- void loadScale(int scale);
- void loadOrientation(Orientation orientation);
- void loadFps(int fps);
+ public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
- void actionOpen();
+ int width();
+ int height();
+ int fps();
+ bool autoScale();
+ bool alwaysOnTop();
+ Orientation orientation();
+ int scale();
+ bool drawInfos();
+ bool fullScreen();
+ bool hideMenu();
+ QColor backgroundColor();
+ QColor canvasColor();
+ QColor infoColor();
- void actionFull_Screen(bool checked);
- void actionHide_Menu(bool checked);
- void alwaysOnTop(bool checked);
- void actionScale();
+ void setWidth(int width);
+ void setHeight(int height);
+ void setFps(int fps);
+ void setAutoScale(bool autoScale);
+ void setAlwaysOnTop(bool alwaysOnTop);
+ void setOrientation(Orientation orientation);
+ void setScale(int scale);
+ void setDrawInfos(bool drawInfos);
+ void setHideMenu(bool hideMenu);
+ void setFullScreen(bool fullScreen);
+ void setBackgroundColor(QColor backgroundColor);
+ void setCanvasColor(QColor canvasColor);
+ void setInfoColor(QColor infoColor);
- void actionAuto_Scale(bool checked);
- void rotateLeft();
- void rotateRight();
- void portrait();
- void portraitUpsideDown();
- void landscapeLeft();
- void landscapeRight();
- void actionResolution();
- void action15_fps();
- void action30_fps();
- void action60_fps();
- void actionUnlimited();
+ void updateResolution();
+ void updateAutoScale();
+ void updateAlwaysOnTop();
+ void updateFps();
+ void updateOrientation();
+ void updateDrawInfos();
+ void updateFullScreen();
+ void updateHideMenu();
+ void updateBackgroundColor();
+ void updateCanvasColor();
+ void updateInfoColor();
+ void checkLoadedSettings();
+ void saveSettings();
+ void resizeWindow(int width, int height);
- void sendRun();
+ protected:
+ virtual void closeEvent(QCloseEvent*);
+ virtual void resizeEvent(QResizeEvent*);
- void projectNameChanged(const QString& projectName);
+ private:
+ void setupUiActions();
+ void setupUiProperties();
+ void createUiGroups();
+ void loadSettings();
-private:
- Ui::MainWindowClass ui;
- QActionGroup* orientationGroup_;
- QActionGroup* resolutionGroup_;
- QActionGroup* zoomGroup_;
+ Ui::MainWindowClass ui;
+ QActionGroup* resolutionGroup_;
+ QActionGroup* fpsGroup_;
+ QActionGroup* orientationGroup_;
+ int width_;
+ int height_;
+ int fps_;
+ bool autoScale_;
+ bool alwaysOnTop_;
+ int scale_;
+ bool hideMenu_;
+ bool fullScreen_;
+ Orientation orientation_;
+ bool drawInfos_;
+ QColor backgroundColor_;
+ QColor canvasColor_;
+ QColor infoColor_;
- int scale();
- int hardwareWidth();
- int hardwareHeight();
- Orientation orientation() const;
+ private slots:
+ void actionFull_Screen(bool checked);
+ void actionHide_Menu();
+ void actionAlwaysOnTop(bool checked);
+ void actionAuto_Scale(bool checked);
+ void actionResolution();
+ void actionFps();
+ void actionOrientation();
+ void actionScale();
+ void actionRotate();
+ void actionSettings();
+ void actionDraw_Infos(bool checked);
+ void actionOpen();
+ void projectNameChanged(const QString& projectName);
};
#endif // MAINWINDOW_H
diff --git a/player/Other_files/player.rc b/player/Other_files/player.rc
index d933844d2..c2735d2dd 100644
--- a/player/Other_files/player.rc
+++ b/player/Other_files/player.rc
@@ -1,2 +1,2 @@
-IDI_ICON1 ICON DISCARDABLE "Images/player.ico"
+IDI_ICON1 ICON DISCARDABLE "images/player.ico"
diff --git a/player/Resources/mainwindow.qrc b/player/Resources/mainwindow.qrc
deleted file mode 100644
index e69de29bb..000000000
diff --git a/player/Scripts/copydlls.bat b/player/Scripts/copydlls.bat
deleted file mode 100644
index 48865e1e9..000000000
--- a/player/Scripts/copydlls.bat
+++ /dev/null
@@ -1,47 +0,0 @@
-REM bat to create a folder to execute the player
-REM some files are required to execute, build the dependency libraries first
-REM this bat file should run at main folder
-
-REM create the temp dirs to store the .dll and .exe files
-
-mkdir builded
-cd builded
-mkdir release
-mkdir debug
-cd ..
-
-REM copy the required .dlls for release version
-
-cp ..\libgid\release\gid.dll builded\release
-cp ..\libgvfs\release\gvfs.dll builded\release
-cp ..\lua\release\lua.dll builded\release
-cp ..\libgideros\release\gideros.dll builded\release
-cp ..\libpystring\release\pystring.dll builded\release
-cp ..\libgid\external\zlib-1.2.8\build\mingw\zlib.dll builded\release
-cp ..\libgid\external\glew-1.10.0\lib\mingw\glew32.dll builded\release
-cp ..\libgid\external\openal-soft-1.13\build\mingw\OpenAL32.dll builded\release
-cp ..\libgid\external\pthreads-w32-2-8-0-release\Pre-built.2\lib\pthreadGC2.dll builded\release
-
-REM copy the required .dlls for debug version
-
-cp ..\libgid\release\gid.dll builded\debug
-cp ..\libgvfs\release\gvfs.dll builded\debug
-cp ..\lua\release\lua.dll builded\debug
-cp ..\libgideros\release\gideros.dll builded\debug
-cp ..\libpystring\release\pystring.dll builded\debug
-cp ..\libgid\external\zlib-1.2.8\build\mingw\zlib.dll builded\debug
-cp ..\libgid\external\glew-1.10.0\lib\mingw\glew32.dll builded\debug
-cp ..\libgid\external\openal-soft-1.13\build\mingw\OpenAL32.dll builded\debug
-cp ..\libgid\external\pthreads-w32-2-8-0-release\Pre-built.2\lib\pthreadGC2.dll builded\debug
-
-REM copy the luajit library, debug and release is the samme)
-
-cp ..\luajit\src\lua51.dll builded\release\lua.dll
-cp ..\luajit\src\lua51.dll builded\debug\lua.dll
-
-REM copy the builded player executable, debug and release
-
-cp release\GiderosPlayer.exe builded\release
-cp debug\GiderosPlayer.exe builded\debug
-
-REM comment to finish with return 0 on qtcreator
\ No newline at end of file
diff --git a/player/Sources/errordialog.cpp b/player/Sources/errordialog.cpp
index 8cd6c874d..cb515d5de 100644
--- a/player/Sources/errordialog.cpp
+++ b/player/Sources/errordialog.cpp
@@ -3,23 +3,23 @@
#include
ErrorDialog::ErrorDialog(QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent)
{
- setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
- ui.setupUi(this);
+ setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
+ ui.setupUi(this);
#ifdef Q_OS_MAC
- QFont f("Monaco", 10);
+ QFont f("Monaco", 10);
#else
- QFont f("Courier New", 8);
+ QFont f("Courier New", 8);
#endif
- QFontMetrics fm(f);
- ui.textEdit->setFont(f);
- ui.textEdit->setTabStopWidth(fm.width("1234"));
+ QFontMetrics fm(f);
+ ui.textEdit->setFont(f);
+ ui.textEdit->setTabStopWidth(fm.width("1234"));
- connect(ui.clear, SIGNAL(clicked()), ui.textEdit, SLOT(clear()));
- connect(ui.close, SIGNAL(clicked()), this, SLOT(hide()));
+ connect(ui.clear, SIGNAL(clicked()), ui.textEdit, SLOT(clear()));
+ connect(ui.close, SIGNAL(clicked()), this, SLOT(hide()));
}
ErrorDialog::~ErrorDialog()
@@ -29,9 +29,9 @@ ErrorDialog::~ErrorDialog()
void ErrorDialog::appendString(const QString& string)
{
- ui.textEdit->selectAll();
- ui.textEdit->setTextColor(Qt::gray);
- ui.textEdit->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
- ui.textEdit->setTextColor(Qt::black);
- ui.textEdit->append(string);
+ ui.textEdit->selectAll();
+ ui.textEdit->setTextColor(Qt::gray);
+ ui.textEdit->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
+ ui.textEdit->setTextColor(Qt::black);
+ ui.textEdit->append(string);
}
diff --git a/player/Sources/glcanvas.cpp b/player/Sources/glcanvas.cpp
index fb01cdcfd..f28c01dea 100644
--- a/player/Sources/glcanvas.cpp
+++ b/player/Sources/glcanvas.cpp
@@ -1,17 +1,14 @@
#include
-
#include "glcanvas.h"
#include "luaapplication.h"
#include "libnetwork.h"
-
#ifdef _WIN32
-#include
+ #include
#else
-#include
+ #include
#endif
-
#include
#include "platform.h"
#include "refptr.h"
@@ -25,883 +22,931 @@
#include
#include
#include
-
#include
#include
#include
-
#include
-static int __mkdir(const char* path)
-{
-#ifdef _WIN32
- return _mkdir(path);
-#else
- return mkdir(path, 0755);
-#endif
-}
-/*
-void PlatformImplementation::openUrl(const char* url)
-{
- urls_.push_back(QUrl(url, QUrl::TolerantMode));
-}
-
-void PlatformImplementation::openUrls()
-{
- for (std::size_t i = 0; i < urls_.size(); ++i)
- QDesktopServices::openUrl(urls_[i]);
- urls_.clear();
+static int __mkdir(const char* path){
+ #ifdef _WIN32
+ return _mkdir(path);
+ #else
+ return mkdir(path, 0755);
+ #endif
}
-void PlatformImplementation::memoryWarning()
-{
- application_->broadcastMemoryWarning();
-}
-*/
+// global var server to print to server function
static Server* g_server = NULL;
-static void printToServer(const char* str, int len, void* data)
-{
+
+static void printToServer(const char* str, int len, void* data){
unsigned int size = 1 + ((len < 0) ? strlen(str) : len) + 1;
- char* buffer = (char*)malloc(size);
+ char* buffer = (char*)malloc(size);
- int pos = 0;
- buffer[pos] = 4;
- pos += 1;
- strcpy(buffer + pos, str);
- pos += strlen(str) + 1;
- Q_ASSERT(pos == size);
+ int pos = 0;
+ buffer[pos] = 4;
+ pos += 1;
+ strcpy(buffer + pos, str);
+ pos += strlen(str) + 1;
+ Q_ASSERT(pos == size);
- g_server->sendData(buffer, size);
+ g_server->sendData(buffer, size);
- free(buffer);
+ free(buffer);
}
-GLCanvas::GLCanvas(QWidget *parent)
- : QGLWidget(parent)
-{
- server_ = new Server(15000);
- g_server = server_;
- application_ = new LuaApplication;
- application_->enableExceptions();
- application_->setPrintFunc(printToServer);
-
- //startTimer(1);
- QTimer* timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
- timer->start(1);
-/* platformImplementation_ = new PlatformImplementation(application_);
- setPlatformInterface(platformImplementation_);*/
+// the constructor of canvas
+GLCanvas::GLCanvas(QWidget *parent) : QGLWidget(parent){
+ setupProperties();
- orientation_ = ePortrait;
+ application_->enableExceptions();
+ application_->setPrintFunc(printToServer);
- width_ = 320;
- height_ = 480;
- scale_ = 1;
+ // set timer to get timeout if an error occur
+ QTimer* timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
+ timer->start(1);
- fps_ = 10000;
- clock_ = iclock();
+ /*
+ startTimer(1);
+ setAccessFileCallback(accessFileCallback_s, this);
- //setAccessFileCallback(accessFileCallback_s, this);
+ platformImplementation_ = new PlatformImplementation(application_);
+ setPlatformInterface(platformImplementation_);
+ */
- running_ = false;
+ // set the canvas in lua application
+ application_->setGLCanvas(this);
}
-GLCanvas::~GLCanvas()
-{
- if (running_ == true)
- {
+// destructor of player, clear timer and set app exit event
+GLCanvas::~GLCanvas(){
+ // if running, set app event exit
+ if (running_ == true){
Event event(Event::APPLICATION_EXIT);
GStatus status;
application_->broadcastEvent(&event, &status);
- if (status.error())
- {
+
+ if(status.error()){
errorDialog_.appendString(status.errorString());
- errorDialog_.show();
+ errorDialog_.show();
printToServer(status.errorString(), -1, NULL);
printToServer("\n", -1, NULL);
- }
- }
+ }
+ }
- //setAccessFileCallback(NULL, NULL);
+ /*
+ setAccessFileCallback(NULL, NULL);
+ application_->broadcastApplicationWillTerminate();
+ */
-// application_->broadcastApplicationWillTerminate();
- timerEvent(0); // TODO: network bufferinda ne kalmissa send etmek icin baska bi fonksiyon yaz
+ timerEvent(0); // TODO: network bufferinda ne kalmissa send etmek icin baska bi fonksiyon yaz
- application_->deinitialize();
- delete application_;
+ // delete app
+ application_->deinitialize();
+ delete application_;
-/* setPlatformInterface(NULL);
- delete platformImplementation_; */
+ /*
+ setPlatformInterface(NULL);
+ delete platformImplementation_;
+ */
- delete server_;
- g_server = 0;
+ // delete server and global server
+ delete server_;
+ g_server = 0;
}
-void GLCanvas::initializeGL()
-{
+
+
+// setup the initial properties of canvas
+void GLCanvas::setupProperties(){
+ // set the lua application to use in player
+ application_ = new LuaApplication;
+
+ server_ = new Server(15000);
+
+ // set the global server var to use in print to server function
+ g_server = server_;
+
+ running_ = false;
+ clock_ = iclock();
+
+ setHardwareOrientation(ePortrait);
+ setResolution(320, 480);
+ setFps(10000);
+ setScale(1);
+ setDrawInfos(false);
+
+ float canvasColor[3];
+ canvasColor[0] = 1;
+ canvasColor[1] = 1;
+ canvasColor[2] = 1;
+ setCanvasColor(canvasColor);
+
+ float infoColor[3];
+ infoColor[0] = 0;
+ infoColor[1] = 0;
+ infoColor[2] = 0;
+ setInfoColor(infoColor);
+}
+
+// set the properties in application var
+void GLCanvas::setupApplicationProperties(){
+ application_->setHardwareOrientation(orientation_);
+ application_->setResolution(width_, height_);
+ application_->setScale(scale_);
+}
+
+
+
+// initialize glcanvas, starting some app properties
+void GLCanvas::initializeGL(){
glewInit();
- application_->initialize();
- application_->setHardwareOrientation(orientation_);
- application_->setResolution(width_, height_);
- application_->setScale(scale_);
+ application_->initialize();
+ setupApplicationProperties();
}
-// TODO: renderScene'e full try-catch icine aldigimiz icin. mesela enterFrame event'inde bi exception olursa,
-// geriye kalanlar calistirilmadigi icin ekrana hicbirsey cizilmiyor. renderScene'inin icini parcalamak lazim.
-// her logical kismi ayri try-catch icine alabiliriz belki.
-// TODO: bu hata olayini iyi dusunmek lazim. bi timer event'inde hata olursa, o timer tekrar cagirilmiyordu. sebebi bu yuzden olsa gerek.
-// TODO: belki de lua'yi exception'li derlemek lazim. koda baktigimda oyle birseyi destekliyordu
-void GLCanvas::paintGL()
-{
+// paint the application on each right time
+/*
+TODO: renderScene'e full try-catch icine aldigimiz icin. mesela enterFrame event'inde bi exception olursa,
+geriye kalanlar calistirilmadigi icin ekrana hicbirsey cizilmiyor. renderScene'inin icini parcalamak lazim.
+her logical kismi ayri try-catch icine alabiliriz belki.
+TODO: bu hata olayini iyi dusunmek lazim. bi timer event'inde hata olursa, o timer tekrar cagirilmiyordu. sebebi bu yuzden olsa gerek.
+TODO: belki de lua'yi exception'li derlemek lazim. koda baktigimda oyle birseyi destekliyordu
+*/
+void GLCanvas::paintGL(){
+ // call enterframe event
GStatus status;
application_->enterFrame(&status);
- if (status.error())
- {
- running_ = false;
+ if(status.error()){
+ running_ = false;
errorDialog_.appendString(status.errorString());
- errorDialog_.show();
+ errorDialog_.show();
printToServer(status.errorString(), -1, NULL);
printToServer("\n", -1, NULL);
- application_->deinitialize();
- application_->initialize();
- }
- application_->clearBuffers();
- application_->renderScene();
+ application_->deinitialize();
+ application_->initialize();
+ }
+
+ // render the new scene frame
+ application_->clearBuffers();
+ application_->renderScene();
- if (running_ == false)
- {
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glScalef(1.f / scale_, 1.f / scale_, 1);
+ // if not running or if is running with drawInfos enabled, draw some usefull infos on the canvas
+ if(!running_ || drawInfos_){
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glScalef(1.f / scale_, 1.f / scale_, 1);
- void drawInfoResolution(int width, int height);
- drawInfoResolution(width_, height_);
- }
+ int lWidth = application_->getLogicalWidth();
+ int lHeight = application_->getLogicalHeight();
+ float scale = round((float)100 / (float)((float)scale_ * (float)devicePixelRatio()));
+ void drawInfoResolution(int width, int height, int scale, int lWidth, int lHeight, bool drawRunning, float canvasColor[3], float infoColor[3]);
+ drawInfoResolution(width_, height_, scale, lWidth, lHeight, running_ && drawInfos_, canvasColor_, infoColor_);
+ }
}
-void GLCanvas::onTimer()
-{
- double deltat = 1.0 / fps_;
+// timer event for upload and configure the player for run
+// TODO: TimerEvent.TIMER'da bi exception olursa, o event bir daha cagirilmiyor. Bunun nedeini bulmak lazim
+void GLCanvas::timerEvent(QTimerEvent *){
+ /*
+ platformImplementation_->openUrls();
+ printf(".");
+ printf("%d\n", Referenced::instanceCount);
+ */
-/* if (deltat == 0)
- {
- timerEvent(0);
- return;
- } */
+ int dataTotal = 0;
- bool update = false;
+ while(true){
+ int dataSent0 = server_->dataSent();
+ int dataReceived0 = server_->dataReceived();
- double now = iclock();
- while (now > clock_ + deltat)
- {
- update = true;
- clock_ += deltat;
- }
+ NetworkEvent event;
+ server_->tick(&event);
- if (update)
- timerEvent(0);
-}
+ /*
+ if (event.eventCode != eNone)
+ printf("%s\n", eventCodeString(event.eventCode));
+ */
+ int dataSent1 = server_->dataSent();
+ int dataReceived1 = server_->dataReceived();
-// function to play an application into player passing path
-// TODO: pensar em um nome intuitivo
-void GLCanvas::play(QDir directory)
-{
- // emmit a stop on player
- if (running_ == true)
- {
- Event event(Event::APPLICATION_EXIT);
- GStatus status;
- application_->broadcastEvent(&event, &status);
- running_ = false;
+ if(event.eventCode == eDataReceived){
+ const std::vector& data = event.data;
- if (status.error())
- {
- errorDialog_.appendString(status.errorString());
- errorDialog_.show();
- printToServer(status.errorString(), -1, NULL);
- printToServer("\n", -1, NULL);
- return;
- }
- }
+ switch(data[0]){
+ case 0: // create folder
+ {
+ std::string folderName = &data[1];
+ __mkdir(g_pathForFile(folderName.c_str()));
+ break;
+ }
- // reset the player settings
- application_->deinitialize();
- application_->initialize();
- application_->setResolution(width_, height_);
- application_->setHardwareOrientation(orientation_);
- application_->setScale(scale_);
+ case 1: // create file
+ {
+ std::string fileName = &data[1];
+ FILE* fos = fopen(g_pathForFile(fileName.c_str()), "wb");
+ int pos = 1 + fileName.size() + 1;
+ if(data.size() > pos)
+ fwrite(&data[pos], data.size() - pos, 1, fos);
+ fclose(fos);
+ allResourceFiles.insert(fileName);
+ calculateMD5(fileName.c_str());
+ saveMD5();
+ break;
+ }
- // next, send the project name
- projectName_ = directory.dirName();
+ case 2:
+ {
+ glog_v("play message is received\n");
- emit projectNameChanged(projectName_);
+ running_ = true;
- dir_ = QDir::temp();
- dir_.mkdir("gideros");
- dir_.cd("gideros");
- dir_.mkdir(projectName_);
- dir_.cd(projectName_);
- dir_.mkdir("documents");
- dir_.mkdir("temporary");
+ //accessedResourceFiles.clear();
- setDocumentsDirectory(qPrintable(dir_.absoluteFilePath("documents")));
- setTemporaryDirectory(qPrintable(dir_.absoluteFilePath("temporary")));
- setResourceDirectory(directory.absolutePath().toStdString().c_str());
+ std::vector luafiles;
- // play the loaded app
- running_ = true;
+ ByteBuffer buffer(&data[0], data.size());
- QStringList filters;
- filters << "*.lua";
- directory.setNameFilters(filters);
- QStringList directoryFiles = directory.entryList();
+ char chr;
+ buffer >> chr;
- GStatus status;
- foreach(QString directoryFile, directoryFiles){
- application_->loadFile(directoryFile.toStdString().c_str(), &status);
- if (status.error())
- break;
- }
+ while (buffer.eob() == false)
+ {
+ std::string str;
+ buffer >> str;
+ luafiles.push_back(str);
+ }
- Event event(Event::APPLICATION_START);
- application_->broadcastEvent(&event, &status);
+ GStatus status;
+ for (std::size_t i = 0; i < luafiles.size(); ++i)
+ {
+ application_->loadFile(luafiles[i].c_str(), &status);
+ if (status.error())
+ break;
+ }
+
+ if (!status.error())
+ {
+ Event event(Event::APPLICATION_START);
+ application_->broadcastEvent(&event, &status);
+ }
- if (status.error())
- {
- running_ = false;
+ if (status.error())
+ {
+ running_ = false;
- errorDialog_.appendString(status.errorString());
- errorDialog_.show();
- printToServer(status.errorString(), -1, NULL);
- printToServer("\n", -1, NULL);
- application_->deinitialize();
- application_->initialize();
+ errorDialog_.appendString(status.errorString());
+ errorDialog_.show();
+ printToServer(status.errorString(), -1, NULL);
+ printToServer("\n", -1, NULL);
+ application_->deinitialize();
+ application_->initialize();
+ }
- return;
- }
-}
+ break;
+ }
-// TODO: TimerEvent.TIMER'da bi exception olursa, o event bir daha cagirilmiyor. Bunun nedeini bulmak lazim
-void GLCanvas::timerEvent(QTimerEvent *)
-{
-// platformImplementation_->openUrls();
-
-// printf(".");
-// printf("%d\n", Referenced::instanceCount);
- int dataTotal = 0;
-
- while (true)
- {
- int dataSent0 = server_->dataSent();
- int dataReceived0 = server_->dataReceived();
-
- NetworkEvent event;
- server_->tick(&event);
-
-// if (event.eventCode != eNone)
-// printf("%s\n", eventCodeString(event.eventCode));
-
- int dataSent1 = server_->dataSent();
- int dataReceived1 = server_->dataReceived();
-
- if (event.eventCode == eDataReceived)
- {
- const std::vector& data = event.data;
-
- switch (data[0])
- {
- case 0: // create folder
- {
- std::string folderName = &data[1];
- __mkdir(g_pathForFile(folderName.c_str()));
- break;
- }
-
- case 1: // create file
- {
- std::string fileName = &data[1];
- FILE* fos = fopen(g_pathForFile(fileName.c_str()), "wb");
- int pos = 1 + fileName.size() + 1;
- if (data.size() > pos)
- fwrite(&data[pos], data.size() - pos, 1, fos);
- fclose(fos);
- allResourceFiles.insert(fileName);
- calculateMD5(fileName.c_str());
- saveMD5();
- break;
- }
- case 2:
- {
- glog_v("play message is received\n");
-
- running_ = true;
-
- //accessedResourceFiles.clear();
-
- std::vector luafiles;
-
- ByteBuffer buffer(&data[0], data.size());
-
- char chr;
- buffer >> chr;
-
- while (buffer.eob() == false)
- {
- std::string str;
- buffer >> str;
- luafiles.push_back(str);
- }
-
- GStatus status;
- for (std::size_t i = 0; i < luafiles.size(); ++i)
+ case 3:
{
- application_->loadFile(luafiles[i].c_str(), &status);
- if (status.error())
- break;
+ glog_v("stop message is received\n");
+
+ if (running_ == true)
+ {
+ Event event(Event::APPLICATION_EXIT);
+ GStatus status;
+ application_->broadcastEvent(&event, &status);
+
+ if (status.error())
+ {
+ errorDialog_.appendString(status.errorString());
+ errorDialog_.show();
+ printToServer(status.errorString(), -1, NULL);
+ printToServer("\n", -1, NULL);
+ }
+ }
+
+ running_ = false;
+
+ application_->deinitialize();
+ application_->initialize();
+ setupApplicationProperties();
+ break;
}
- if (!status.error())
+ /*
+ case 5:
{
- Event event(Event::APPLICATION_START);
- application_->broadcastEvent(&event, &status);
+ // deleteFiles();
+ break;
}
+ */
- if (status.error())
+ case 7:
{
- running_ = false;
+ sendFileList();
+ break;
+ }
- errorDialog_.appendString(status.errorString());
- errorDialog_.show();
- printToServer(status.errorString(), -1, NULL);
- printToServer("\n", -1, NULL);
- application_->deinitialize();
- application_->initialize();
+ case 8:
+ {
+ ByteBuffer buffer(&data[0], data.size());
+
+ char chr;
+ buffer >> chr;
+
+ std::string str;
+ buffer >> str;
+
+ projectName_ = str.c_str();
+
+ if(projectName_.isEmpty() == false){
+ dir_ = QDir::temp();
+ dir_.mkdir("gideros");
+ dir_.cd("gideros");
+ dir_.mkdir(projectName_);
+ dir_.cd(projectName_);
+
+ md5filename_ = qPrintable(dir_.absoluteFilePath("md5.txt"));
+ loadMD5();
+
+ dir_.mkdir("documents");
+ dir_.mkdir("temporary");
+ dir_.mkdir("resource");
+
+ resourceDirectory_ = qPrintable(dir_.absoluteFilePath("resource"));
+
+ setDocumentsDirectory(qPrintable(dir_.absoluteFilePath("documents")));
+ setTemporaryDirectory(qPrintable(dir_.absoluteFilePath("temporary")));
+ setResourceDirectory(resourceDirectory_.c_str());
+ }
+
+ emit projectNameChanged(projectName_);
+ break;
}
- break;
- }
- case 3:
- {
- glog_v("stop message is received\n");
+ case 9:
+ {
+ ByteBuffer buffer(&data[0], data.size());
- if (running_ == true)
- {
- Event event(Event::APPLICATION_EXIT);
- GStatus status;
- application_->broadcastEvent(&event, &status);
+ char chr;
+ buffer >> chr;
- if (status.error())
- {
- errorDialog_.appendString(status.errorString());
- errorDialog_.show();
- printToServer(status.errorString(), -1, NULL);
- printToServer("\n", -1, NULL);
- }
- }
-
- running_ = false;
-
- application_->deinitialize();
- application_->initialize();
- application_->setHardwareOrientation(orientation_);
- application_->setResolution(width_, height_);
- application_->setScale(scale_);
- break;
- }
- case 5:
- {
- // deleteFiles();
- break;
- }
- case 7:
- {
- sendFileList();
- break;
- }
- case 8:
- {
- ByteBuffer buffer(&data[0], data.size());
-
- char chr;
- buffer >> chr;
-
- std::string str;
- buffer >> str;
-
- projectName_ = str.c_str();
-
- if (projectName_.isEmpty() == false)
- {
- dir_ = QDir::temp();
- dir_.mkdir("gideros");
- dir_.cd("gideros");
- dir_.mkdir(projectName_);
- dir_.cd(projectName_);
-
- md5filename_ = qPrintable(dir_.absoluteFilePath("md5.txt"));
- loadMD5();
-
- dir_.mkdir("documents");
- dir_.mkdir("temporary");
- dir_.mkdir("resource");
-
- resourceDirectory_ = qPrintable(dir_.absoluteFilePath("resource"));
-
- setDocumentsDirectory(qPrintable(dir_.absoluteFilePath("documents")));
- setTemporaryDirectory(qPrintable(dir_.absoluteFilePath("temporary")));
- setResourceDirectory(resourceDirectory_.c_str());
- }
-
- emit projectNameChanged(projectName_);
- break;
- }
-
- case 9:
- {
- ByteBuffer buffer(&data[0], data.size());
-
- char chr;
- buffer >> chr;
-
- std::string fileName;
- buffer >> fileName;
-
- remove(g_pathForFile(fileName.c_str()));
-
- {
- std::set::iterator iter = allResourceFiles.find(fileName);
- if (iter != allResourceFiles.end()) // this if statement is unnecessary, but we put it "ne olur ne olmaz"
- allResourceFiles.erase(iter);
- }
-
- {
- std::map >::iterator iter = md5_.find(fileName);
- if (iter != md5_.end())
- {
- md5_.erase(iter);
- saveMD5();
- }
- }
-
- break;
- }
-
- case 11:
- {
- ByteBuffer buffer(&data[0], data.size());
-
- char chr;
- buffer >> chr;
-
- int scaleMode, logicalWidth, logicalHeight;
- buffer >> scaleMode;
- buffer >> logicalWidth;
- buffer >> logicalHeight;
-
- application_->deinitialize();
- application_->initialize();
- application_->setResolution(width_, height_);
- application_->setHardwareOrientation(orientation_);
-// application_->orientationChange(orientation_);
- application_->setScale(scale_);
- application_->setLogicalDimensions(logicalWidth, logicalHeight);
- application_->setLogicalScaleMode((LogicalScaleMode)scaleMode);
-
- int scaleCount;
- buffer >> scaleCount;
- std::vector > imageScales(scaleCount);
- for (int i = 0; i < scaleCount; ++i)
- {
- buffer >> imageScales[i].first;
- buffer >> imageScales[i].second;
- }
-
- application_->setImageScales(imageScales);
-
- int orientation;
- buffer >> orientation;
- application_->setOrientation((Orientation)orientation);
- application_->getApplication()->setDeviceOrientation((Orientation)orientation);
+ std::string fileName;
+ buffer >> fileName;
+
+ remove(g_pathForFile(fileName.c_str()));
+
+ {
+ std::set::iterator iter = allResourceFiles.find(fileName);
+ if (iter != allResourceFiles.end()) // this if statement is unnecessary, but we put it "ne olur ne olmaz"
+ allResourceFiles.erase(iter);
+ }
+
+ {
+ std::map >::iterator iter = md5_.find(fileName);
+ if (iter != md5_.end())
+ {
+ md5_.erase(iter);
+ saveMD5();
+ }
+ }
+
+ break;
+ }
+
+ case 11:
+ {
+ ByteBuffer buffer(&data[0], data.size());
- int fps;
- buffer >> fps;
+ char chr;
+ buffer >> chr;
- int retinaDisplay;
- buffer >> retinaDisplay;
+ int scaleMode, logicalWidth, logicalHeight;
+ buffer >> scaleMode;
+ buffer >> logicalWidth;
+ buffer >> logicalHeight;
+
+ application_->deinitialize();
+ application_->initialize();
+ setupApplicationProperties();
+ // application_->orientationChange(orientation_);
+ application_->setLogicalDimensions(logicalWidth, logicalHeight);
+ application_->setLogicalScaleMode((LogicalScaleMode)scaleMode);
- int autorotation;
- buffer >> autorotation;
+ int scaleCount;
+ buffer >> scaleCount;
+ std::vector > imageScales(scaleCount);
+ for (int i = 0; i < scaleCount; ++i)
+ {
+ buffer >> imageScales[i].first;
+ buffer >> imageScales[i].second;
+ }
- int mouseToTouch;
- buffer >> mouseToTouch;
- ginput_setMouseToTouchEnabled(mouseToTouch);
+ application_->setImageScales(imageScales);
- int touchToMouse;
- buffer >> touchToMouse;
- ginput_setTouchToMouseEnabled(touchToMouse);
+ int orientation;
+ buffer >> orientation;
+ application_->setOrientation((Orientation)orientation);
+ application_->getApplication()->setDeviceOrientation((Orientation)orientation);
- int mouseTouchOrder;
- buffer >> mouseTouchOrder;
- ginput_setMouseTouchOrder(mouseTouchOrder);
+ int fps;
+ buffer >> fps;
- break;
- }
+ int retinaDisplay;
+ buffer >> retinaDisplay;
- }
- }
+ int autorotation;
+ buffer >> autorotation;
+
+ int mouseToTouch;
+ buffer >> mouseToTouch;
+ ginput_setMouseToTouchEnabled(mouseToTouch);
+
+ int touchToMouse;
+ buffer >> touchToMouse;
+ ginput_setTouchToMouseEnabled(touchToMouse);
+
+ int mouseTouchOrder;
+ buffer >> mouseTouchOrder;
+ ginput_setMouseTouchOrder(mouseTouchOrder);
+
+ break;
+ }
+ }
+ }
- int dataDelta = (dataSent1 - dataSent0) + (dataReceived1 - dataReceived0);
- dataTotal += dataDelta;
+ int dataDelta = (dataSent1 - dataSent0) + (dataReceived1 - dataReceived0);
+ dataTotal += dataDelta;
- if (dataDelta == 0 || dataTotal > 1024)
- break;
- }
+ // data upload complete
+ if(dataDelta == 0 || dataTotal > 1024)
+ break;
+ }
- update();
+ update();
}
-void GLCanvas::mousePressEvent(QMouseEvent* event)
-{
+void GLCanvas::mousePressEvent(QMouseEvent* event){
ginputp_mouseDown(event->x() * scale_, event->y() * scale_, 0);
}
-void GLCanvas::mouseMoveEvent(QMouseEvent* event)
-{
+void GLCanvas::mouseMoveEvent(QMouseEvent* event){
ginputp_mouseMove(event->x() * scale_, event->y() * scale_);
}
-void GLCanvas::mouseReleaseEvent(QMouseEvent* event)
-{
+void GLCanvas::mouseReleaseEvent(QMouseEvent* event){
ginputp_mouseUp(event->x() * scale_, event->y() * scale_, 0);
}
-
-void GLCanvas::keyPressEvent(QKeyEvent* event)
-{
- if (event->isAutoRepeat())
- return;
+void GLCanvas::keyPressEvent(QKeyEvent* event){
+ if (event->isAutoRepeat())
+ return;
ginputp_keyDown(event->key());
}
-void GLCanvas::keyReleaseEvent(QKeyEvent* event)
-{
- if (event->isAutoRepeat())
- return;
+void GLCanvas::keyReleaseEvent(QKeyEvent* event){
+ if(event->isAutoRepeat())
+ return;
ginputp_keyUp(event->key());
}
-void GLCanvas::setHardwareOrientation(Orientation orientation)
-{
- orientation_ = orientation;
- if (application_->isInitialized())
- {
- application_->setHardwareOrientation(orientation_);
-// application_->orientationChange(orientation_);
- }
-}
+// get the right timer
+void GLCanvas::onTimer(){
+ double deltat = 1.0 / fps_;
-void GLCanvas::setResolution(int width, int height)
-{
- width_ = width;
- height_ = height;
+ /*
+ if(deltat == 0){
+ timerEvent(0);
+ return;
+ }
+ */
+
+ bool update = false;
- if (application_->isInitialized())
- application_->setResolution(width_, height_);
+ double now = iclock();
+ while(now > clock_ + deltat){
+ update = true;
+ clock_ += deltat;
+ }
+
+ if(update)
+ timerEvent(0);
}
+// func to delete recursively the dir, used in deleteFiles func
+static void deltree(const char* dir){
+ std::stack stack;
-/*
-static void getDirectoryListing(const std::string& dir, std::vector* files, std::vector* directories)
-{
- files->clear();
- directories->clear();
+ std::string directory = dir;
+ char back = directory[directory.size() - 1];
+ if (back == '/' || back == '\\')
+ directory.resize(directory.size() - 1);
- WIN32_FIND_DATAA ffd;
- HANDLE hFind;
+ stack.push(directory);
- std::string dirstar = dir + "/*";
+ while (!stack.empty()){
+ std::string dir = stack.top();
+ stack.pop();
- hFind = FindFirstFileA(dirstar.c_str(), &ffd);
+ std::vector files, directories;
+ getDirectoryListing(dir.c_str(), &files, &directories);
- do
- {
- if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- if (strcmp(ffd.cFileName, ".") == 0 || strcmp(ffd.cFileName, "..") == 0)
- continue;
+ for (std::size_t i = 0; i < files.size(); ++i)
+ remove((dir + "/" + files[i]).c_str());
- if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- directories->push_back(ffd.cFileName);
- else
- files->push_back(ffd.cFileName);
- } while (FindNextFileA(hFind, &ffd) != 0);
+ for (std::size_t i = 0; i < directories.size(); ++i)
+ stack.push(dir + "/" + directories[i]);
+ }
+}
- FindClose(hFind);
+void GLCanvas::deleteFiles(){
+ deltree(resourceDirectory_.c_str());
+// fileList_.clear();
}
-*/
-static void deltree(const char* dir)
+void GLCanvas::sendFileList()
{
- std::stack stack;
+ allResourceFiles.clear();
+
+ ByteBuffer buffer;
- std::string directory = dir;
- char back = directory[directory.size() - 1];
- if (back == '/' || back == '\\')
- directory.resize(directory.size() - 1);
+ // type(byte) 6
+ // D or F, file (zero ended string), age (int)
+ // D or F, file (zero ended string), age (int)
+ // ....
- stack.push(directory);
+ buffer.append((char)6);
- while (!stack.empty())
- {
- std::string dir = stack.top();
- stack.pop();
+ std::vector files, directories;
+ getDirectoryListingR(resourceDirectory_.c_str(), &files, &directories);
- std::vector files, directories;
- getDirectoryListing(dir.c_str(), &files, &directories);
+ for (std::size_t i = 0; i < files.size(); ++i)
+ {
+ buffer.append('F');
+ buffer.append(files[i]);
+ int age = fileAge(g_pathForFile(files[i].c_str()));
+ buffer.append(age);
- for (std::size_t i = 0; i < files.size(); ++i)
- remove((dir + "/" + files[i]).c_str());
+ std::map >::iterator iter = md5_.find(files[i]);
+ if (iter == md5_.end())
+ {
+ calculateMD5(files[i].c_str());
+ saveMD5();
+ iter = md5_.find(files[i]);
+ }
+ buffer.append(&iter->second[0], 16);
- for (std::size_t i = 0; i < directories.size(); ++i)
- stack.push(dir + "/" + directories[i]);
- }
-}
-void GLCanvas::deleteFiles()
-{
- deltree(resourceDirectory_.c_str());
-// fileList_.clear();
+ allResourceFiles.insert(files[i]);
+ }
+
+ for (std::size_t i = 0; i < directories.size(); ++i)
+ {
+ buffer.append('D');
+ buffer.append(directories[i]);
+ }
+
+ server_->sendData(buffer.data(), buffer.size());
}
-void GLCanvas::setFps(int fps)
+void GLCanvas::sendRun()
{
- fps_ = fps;
- clock_ = iclock();
+ ByteBuffer buffer;
+ buffer.append((char)10);
+ server_->sendData(buffer.data(), buffer.size());
}
-void GLCanvas::sendFileList()
-{
- allResourceFiles.clear();
+void GLCanvas::loadMD5(){
+ /*
+ md5_.clear();
- ByteBuffer buffer;
+ FILE* fis = fopen(md5filename_.c_str(), "rt");
- // type(byte) 6
- // D or F, file (zero ended string), age (int)
- // D or F, file (zero ended string), age (int)
- // ....
+ if (fis == NULL)
+ return;
- buffer.append((char)6);
+ std::string filename;
- std::vector files, directories;
- getDirectoryListingR(resourceDirectory_.c_str(), &files, &directories);
+ char line[1024];
+ int nline = 0;
+ while (true)
+ {
+ line[0] = '\0';
+ fgets(line, 1024, fis);
- for (std::size_t i = 0; i < files.size(); ++i)
- {
- buffer.append('F');
- buffer.append(files[i]);
- int age = fileAge(g_pathForFile(files[i].c_str()));
- buffer.append(age);
+ int len = strlen(line);
- std::map >::iterator iter = md5_.find(files[i]);
- if (iter == md5_.end())
- {
- calculateMD5(files[i].c_str());
- saveMD5();
- iter = md5_.find(files[i]);
- }
- buffer.append(&iter->second[0], 16);
+ if (len > 0 && line[len - 1] == 0x0a)
+ {
+ line[len - 1] = '\0';
+ len--;
+ }
+ if (len > 0 && line[len - 1] == 0x0d)
+ {
+ line[len - 1] = '\0';
+ len--;
+ }
- allResourceFiles.insert(files[i]);
- }
+ if (len == 0)
+ break;
- for (std::size_t i = 0; i < directories.size(); ++i)
- {
- buffer.append('D');
- buffer.append(directories[i]);
- }
+ if ((nline % 2) == 0)
+ filename = line;
+ else
+ md5_[filename] = line;
- server_->sendData(buffer.data(), buffer.size());
-}
+ nline++;
+ }
-/*
-void GLCanvas::accessFileCallback_s(FileType type, const char* filename, void* data)
-{
- GLCanvas* that = static_cast(data);
- that->accessFileCallback(type, filename);
+ fclose(fis);
+ */
+
+ md5_.clear();
+
+ FILE* fis = fopen(md5filename_.c_str(), "rb");
+
+ if(fis == NULL)
+ return;
+
+ int nfiles;
+ fread(&nfiles, sizeof(int), 1, fis);
+
+ for(int i = 0; i < nfiles; ++i){
+ int strlen;
+ fread(&strlen, sizeof(int), 1, fis);
+
+ char* buffer = (char*)malloc(strlen);
+ fread(buffer, 1, strlen, fis);
+ std::string filename(buffer, strlen);
+ free(buffer);
+
+ std::vector md5(16);
+ fread(&md5[0], 1, 16, fis);
+
+ md5_[filename] = md5;
+ }
+
+// printMD5();
}
-void GLCanvas::accessFileCallback(FileType type, const char* filename)
-{
- if (type == eResourceFile)
- accessedResourceFiles.insert(filename);
+void GLCanvas::saveMD5(){
+ /*
+ FILE* fos = fopen(md5filename_.c_str(), "wt");
+
+ if (fos == NULL)
+ return;
+
+ std::map::iterator iter, end = md5_.end();
+ for (iter = md5_.begin(); iter != end; ++iter)
+ {
+ fprintf(fos, "%s\n", iter->first.c_str());
+ fprintf(fos, "%s\n", iter->second.c_str());
+ }
+ fclose(fos);
+ */
+
+
+ FILE* fos = fopen(md5filename_.c_str(), "wb");
+ if(fos == NULL)
+ return;
+
+ int nfiles = md5_.size();
+ fwrite(&nfiles, sizeof(int), 1, fos);
+
+ int i = 0;
+ std::map >::iterator iter, end = md5_.end();
+ for (iter = md5_.begin(); iter != end; ++iter, ++i){
+ int strlen = iter->first.size();
+ fwrite(&strlen, sizeof(int), 1, fos);
+ fwrite(iter->first.c_str(), 1, strlen, fos);
+ fwrite(&iter->second[0], 1, 16, fos);
+ }
+
+ fclose(fos);
+
+// printMD5();
}
-*/
-void GLCanvas::sendRun()
-{
- ByteBuffer buffer;
- buffer.append((char)10);
- server_->sendData(buffer.data(), buffer.size());
+void GLCanvas::calculateMD5(const char* file){
+ std::vector md5(16);
+ if (md5_fromfile(g_pathForFile(file), &md5[0]))
+ md5_[file] = md5;
}
-void GLCanvas::loadMD5()
-{
-/* md5_.clear();
+// print a md5 file, util function
+void GLCanvas::printMD5(){
+ std::map >::iterator iter, end = md5_.end();
+ for (iter = md5_.begin(); iter != end; ++iter){
+ qDebug() << iter->first.c_str();
+ const std::vector& m = iter->second;
+
+ char buffer[33];
+ sprintf(buffer, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ m[0], m[1], m[2], m[3],
+ m[4], m[5], m[6], m[7],
+ m[8], m[9], m[10], m[11],
+ m[12], m[13], m[14], m[15]);
+
+ qDebug() << buffer;
+ }
+}
- FILE* fis = fopen(md5filename_.c_str(), "rt");
+// function to play an application into player passing path
+// TODO: pensar em um nome intuitivo
+void GLCanvas::play(QDir directory){
+ // emmit a stop on player
+ if(running_ == true){
+ Event event(Event::APPLICATION_EXIT);
+ GStatus status;
+ application_->broadcastEvent(&event, &status);
+ running_ = false;
- if (fis == NULL)
- return;
-
- std::string filename;
+ if(status.error()){
+ errorDialog_.appendString(status.errorString());
+ errorDialog_.show();
+ printToServer(status.errorString(), -1, NULL);
+ printToServer("\n", -1, NULL);
+ return;
+ }
+ }
- char line[1024];
- int nline = 0;
- while (true)
- {
- line[0] = '\0';
- fgets(line, 1024, fis);
+ // reset the player settings
+ application_->deinitialize();
+ application_->initialize();
+ setupApplicationProperties();
- int len = strlen(line);
+ // next, send the project name
+ projectName_ = directory.dirName();
- if (len > 0 && line[len - 1] == 0x0a)
- {
- line[len - 1] = '\0';
- len--;
- }
+ emit projectNameChanged(projectName_);
- if (len > 0 && line[len - 1] == 0x0d)
- {
- line[len - 1] = '\0';
- len--;
- }
+ dir_ = QDir::temp();
+ dir_.mkdir("gideros");
+ dir_.cd("gideros");
+ dir_.mkdir(projectName_);
+ dir_.cd(projectName_);
+ dir_.mkdir("documents");
+ dir_.mkdir("temporary");
- if (len == 0)
- break;
+ setDocumentsDirectory(qPrintable(dir_.absoluteFilePath("documents")));
+ setTemporaryDirectory(qPrintable(dir_.absoluteFilePath("temporary")));
+ setResourceDirectory(directory.absolutePath().toStdString().c_str());
- if ((nline % 2) == 0)
- filename = line;
- else
- md5_[filename] = line;
+ // play the loaded app
+ running_ = true;
- nline++;
- }
+ QStringList filters;
+ filters << "*.lua";
+ directory.setNameFilters(filters);
+ QStringList directoryFiles = directory.entryList();
- fclose(fis);
- */
+ GStatus status;
+ foreach(QString directoryFile, directoryFiles){
+ application_->loadFile(directoryFile.toStdString().c_str(), &status);
+ if (status.error())
+ break;
+ }
+ Event event(Event::APPLICATION_START);
+ application_->broadcastEvent(&event, &status);
- md5_.clear();
+ if (status.error())
+ {
+ running_ = false;
- FILE* fis = fopen(md5filename_.c_str(), "rb");
+ errorDialog_.appendString(status.errorString());
+ errorDialog_.show();
+ printToServer(status.errorString(), -1, NULL);
+ printToServer("\n", -1, NULL);
+ application_->deinitialize();
+ application_->initialize();
- if (fis == NULL)
- return;
+ return;
+ }
+}
- int nfiles;
- fread(&nfiles, sizeof(int), 1, fis);
- for (int i = 0; i < nfiles; ++i)
- {
- int strlen;
- fread(&strlen, sizeof(int), 1, fis);
- char* buffer = (char*)malloc(strlen);
- fread(buffer, 1, strlen, fis);
- std::string filename(buffer, strlen);
- free(buffer);
+// setters
+void GLCanvas::setScale(float scale){
+ scale_ = scale;
- std::vector md5(16);
- fread(&md5[0], 1, 16, fis);
+ if (application_->isInitialized())
+ application_->setScale(scale_);
+}
- md5_[filename] = md5;
- }
+void GLCanvas::setFps(int fps){
+ fps_ = fps;
+ clock_ = iclock();
+}
-// printMD5();
+void GLCanvas::setDrawInfos(bool drawInfos){
+ drawInfos_ = drawInfos;
}
-void GLCanvas::saveMD5()
-{
-/* FILE* fos = fopen(md5filename_.c_str(), "wt");
+void GLCanvas::setCanvasColor(float canvasColor[3]){
+ canvasColor_[0] = canvasColor[0];
+ canvasColor_[1] = canvasColor[1];
+ canvasColor_[2] = canvasColor[2];
+}
- if (fos == NULL)
- return;
+void GLCanvas::setInfoColor(float infoColor[3]){
+ infoColor_[0] = infoColor[0];
+ infoColor_[1] = infoColor[1];
+ infoColor_[2] = infoColor[2];
+}
- std::map::iterator iter, end = md5_.end();
- for (iter = md5_.begin(); iter != end; ++iter)
- {
- fprintf(fos, "%s\n", iter->first.c_str());
- fprintf(fos, "%s\n", iter->second.c_str());
- }
- fclose(fos); */
+void GLCanvas::setHardwareOrientation(Orientation orientation){
+ orientation_ = orientation;
+ if(application_->isInitialized()){
+ application_->setHardwareOrientation(orientation_);
+// application_->orientationChange(orientation_);
+ }
+}
- FILE* fos = fopen(md5filename_.c_str(), "wb");
- if (fos == NULL)
- return;
+void GLCanvas::setResolution(int width, int height){
+ width_ = width;
+ height_ = height;
- int nfiles = md5_.size();
- fwrite(&nfiles, sizeof(int), 1, fos);
+ if(application_->isInitialized())
+ application_->setResolution(width_, height_);
+}
- int i = 0;
- std::map >::iterator iter, end = md5_.end();
- for (iter = md5_.begin(); iter != end; ++iter, ++i)
- {
- int strlen = iter->first.size();
- fwrite(&strlen, sizeof(int), 1, fos);
- fwrite(iter->first.c_str(), 1, strlen, fos);
- fwrite(&iter->second[0], 1, 16, fos);
- }
- fclose(fos);
-// printMD5();
+/*
+void PlatformImplementation::openUrl(const char* url)
+{
+ urls_.push_back(QUrl(url, QUrl::TolerantMode));
}
-void GLCanvas::calculateMD5(const char* file)
+void PlatformImplementation::openUrls()
{
- std::vector md5(16);
- if (md5_fromfile(g_pathForFile(file), &md5[0]))
- md5_[file] = md5;
+ for (std::size_t i = 0; i < urls_.size(); ++i)
+ QDesktopServices::openUrl(urls_[i]);
+ urls_.clear();
}
-
-void GLCanvas::printMD5()
+void PlatformImplementation::memoryWarning()
{
- std::map >::iterator iter, end = md5_.end();
- for (iter = md5_.begin(); iter != end; ++iter)
- {
- qDebug() << iter->first.c_str();
- const std::vector& m = iter->second;
+ application_->broadcastMemoryWarning();
+}
+*/
- char buffer[33];
- sprintf(buffer, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
- m[0], m[1], m[2], m[3],
- m[4], m[5], m[6], m[7],
- m[8], m[9], m[10], m[11],
- m[12], m[13], m[14], m[15]);
+/*
+void GLCanvas::accessFileCallback_s(FileType type, const char* filename, void* data)
+{
+ GLCanvas* that = static_cast(data);
+ that->accessFileCallback(type, filename);
+}
- qDebug() << buffer;
- }
+void GLCanvas::accessFileCallback(FileType type, const char* filename)
+{
+ if (type == eResourceFile)
+ accessedResourceFiles.insert(filename);
}
+*/
-void GLCanvas::setScale(int scale)
+/*
+static void getDirectoryListing(const std::string& dir, std::vector* files, std::vector* directories)
{
- scale_ = scale;
+ files->clear();
+ directories->clear();
+
+ WIN32_FIND_DATAA ffd;
+ HANDLE hFind;
+
+ std::string dirstar = dir + "/*";
- if (application_->isInitialized())
- application_->setScale(scale_);
+ hFind = FindFirstFileA(dirstar.c_str(), &ffd);
+
+ do
+ {
+ if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ if (strcmp(ffd.cFileName, ".") == 0 || strcmp(ffd.cFileName, "..") == 0)
+ continue;
+
+ if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ directories->push_back(ffd.cFileName);
+ else
+ files->push_back(ffd.cFileName);
+ } while (FindNextFileA(hFind, &ffd) != 0);
+
+ FindClose(hFind);
}
+*/
diff --git a/player/Sources/main.cpp b/player/Sources/main.cpp
index bffb4f136..bb46ad746 100644
--- a/player/Sources/main.cpp
+++ b/player/Sources/main.cpp
@@ -3,7 +3,6 @@
#include
#include
#include
-//#include
#include
#include
#include
@@ -23,72 +22,23 @@
#include
#include
#include
+#include "constants.cpp"
+//#include
-/*
-this method should be added to unzip.c:
-
-extern uLong unzGetOffset2(unzFile file)
-{
- unz64_s* s;
- s=(unz64_s*)file;
-
- return s->pfile_in_zip_read->pos_in_zipfile + s->pfile_in_zip_read->byte_before_the_zipfile;
-}
-
-*/
-
-/*
-static void setZipFile(const char* filename)
-{
- unzFile file = unzOpen(filename);
- if (file == NULL)
- return;
-
- g_clearfilepos();
- if (unzGoToFirstFile(file) != UNZ_OK)
- return;
- while (true)
- {
- unz_file_info info;
- char filename[256];
- unzGetCurrentFileInfo(file, &info, filename, 255, NULL, 0, NULL, 0);
-
- bool uisdir = (info.external_fa & 0x40000000) != 0;
- bool wisdir = (info.external_fa & 0x00000010) != 0;
- bool isdir = uisdir | wisdir;
-
- if (!isdir && info.compression_method == 0)
- {
- if (unzOpenCurrentFile(file) == UNZ_OK)
- {
- uLong offset = unzGetOffset2(file);
- g_setfilepos(filename, offset, info.uncompressed_size);
- unzCloseCurrentFile(file);
- }
- }
-
- if (unzGoToNextFile(file) != UNZ_OK)
- break;
- }
+static void loadPlugins(){
+ QDir dir = QDir::currentPath();
- g_setbigfile(filename);
-}
-*/
+ #if defined(Q_OS_MAC)
+ dir.cd("../../Plugins");
+ QStringList files = dir.entryList(QStringList() << "*.dylib");
+ #else
+ dir.cd("Plugins");
+ QStringList files = dir.entryList(QStringList() << "*.dll");
+ #endif
-static void loadPlugins()
-{
- QDir dir = QDir::currentPath();
-#if defined(Q_OS_MAC)
- dir.cd("../../Plugins");
- QStringList files = dir.entryList(QStringList() << "*.dylib");
-#else
- dir.cd("Plugins");
- QStringList files = dir.entryList(QStringList() << "*.dll");
-#endif
- for (int i = 0; i < files.size(); ++i)
- {
+ for(int i = 0; i < files.size(); ++i){
QString filename = dir.absoluteFilePath(files[i]);
QLibrary library(filename);
void* plugin = (void*)library.resolve("g_pluginMain");
@@ -97,22 +47,25 @@ static void loadPlugins()
}
}
-int main(int argc, char *argv[])
-{
+
+
+int main(int argc, char *argv[]){
// curl_global_init(CURL_GLOBAL_WIN32);
- QCoreApplication::setOrganizationName("GiderosMobile");
- QCoreApplication::setOrganizationDomain("giderosmobile.com");
- QCoreApplication::setApplicationName("GiderosPlayer");
+ QCoreApplication::setOrganizationName(Constants::ORGANIZATION_NAME);
+ QCoreApplication::setOrganizationDomain(Constants::ORGANIZATION_DOMAIN);
+ QCoreApplication::setApplicationName(Constants::PLAYER_APPLICATION_NAME);
QSettings::setDefaultFormat(QSettings::IniFormat);
QApplication a(argc, argv);
QDir dir = QCoreApplication::applicationDirPath();
-#if defined(Q_OS_MAC)
- dir.cdUp();
-#endif
+
+ #if defined(Q_OS_MAC)
+ dir.cdUp();
+ #endif
+
QDir::setCurrent(dir.absolutePath());
gpath_init();
@@ -186,3 +139,58 @@ int main(int argc, char *argv[])
return result;
}
+
+
+
+/*
+this method should be added to unzip.c:
+
+extern uLong unzGetOffset2(unzFile file)
+{
+ unz64_s* s;
+ s=(unz64_s*)file;
+
+ return s->pfile_in_zip_read->pos_in_zipfile + s->pfile_in_zip_read->byte_before_the_zipfile;
+}
+
+*/
+
+/*
+static void setZipFile(const char* filename)
+{
+ unzFile file = unzOpen(filename);
+ if (file == NULL)
+ return;
+
+ g_clearfilepos();
+
+ if (unzGoToFirstFile(file) != UNZ_OK)
+ return;
+
+ while (true)
+ {
+ unz_file_info info;
+ char filename[256];
+ unzGetCurrentFileInfo(file, &info, filename, 255, NULL, 0, NULL, 0);
+
+ bool uisdir = (info.external_fa & 0x40000000) != 0;
+ bool wisdir = (info.external_fa & 0x00000010) != 0;
+ bool isdir = uisdir | wisdir;
+
+ if (!isdir && info.compression_method == 0)
+ {
+ if (unzOpenCurrentFile(file) == UNZ_OK)
+ {
+ uLong offset = unzGetOffset2(file);
+ g_setfilepos(filename, offset, info.uncompressed_size);
+ unzCloseCurrentFile(file);
+ }
+ }
+
+ if (unzGoToNextFile(file) != UNZ_OK)
+ break;
+ }
+
+ g_setbigfile(filename);
+}
+*/
diff --git a/player/Sources/mainwindow.cpp b/player/Sources/mainwindow.cpp
index 992f0b6fe..0d590b735 100644
--- a/player/Sources/mainwindow.cpp
+++ b/player/Sources/mainwindow.cpp
@@ -1,9 +1,4 @@
#include "mainwindow.h"
-#include "libnetwork.h"
-#include "applicationwrapper.h"
-#include "glcanvas.h"
-#include "platform.h"
-
#include
#include
#include
@@ -11,91 +6,182 @@
#include
#include
#include
-
#include
+#include
+#include "libnetwork.h"
+#include "applicationwrapper.h"
+#include "glcanvas.h"
+#include "platform.h"
+#include "settingsdialog.h"
+#include "themes.cpp"
+#include "constants.cpp"
+
+MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
+ setDefaultTheme();
+
+ setupUiActions();
+ setupUiProperties();
+
+ createUiGroups();
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- setupUi();
- setupGroups();
loadSettings();
}
-MainWindow::~MainWindow()
-{
-}
+MainWindow::~MainWindow(){}
-// connect the handlers into menus and shortcuts
-void MainWindow::setupUi()
-{
+void MainWindow::setupUiActions(){
ui.setupUi(this);
- // file menu
- connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen()));
- connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
-
- // view menu
- connect(ui.actionFull_Screen, SIGNAL(triggered(bool)), this, SLOT(actionFull_Screen(bool)));
- connect(ui.actionHide_Menu, SIGNAL(triggered(bool)), this, SLOT(actionHide_Menu(bool)));
- connect(ui.actionAlways_on_Top, SIGNAL(triggered(bool)), this, SLOT(alwaysOnTop(bool)));
- connect(ui.actionQuarter, SIGNAL(triggered()), this, SLOT(actionScale()));
- connect(ui.actionHalf, SIGNAL(triggered()), this, SLOT(actionScale()));
- connect(ui.actionOriginal, SIGNAL(triggered()), this, SLOT(actionScale()));
-
- // hardware menu
- connect(ui.actionAuto_Scale, SIGNAL(triggered(bool)), this, SLOT(actionAuto_Scale(bool)));
- connect(ui.actionRotate_Left, SIGNAL(triggered()), this, SLOT(rotateLeft()));
- connect(ui.actionRotate_Right, SIGNAL(triggered()), this, SLOT(rotateRight()));
- connect(ui.actionPortrait, SIGNAL(triggered()), this, SLOT(portrait()));
- connect(ui.actionPortrait_Upside_Down, SIGNAL(triggered()), this, SLOT(portraitUpsideDown()));
- connect(ui.actionLandscape_Left, SIGNAL(triggered()), this, SLOT(landscapeLeft()));
- connect(ui.actionLandscape_Right, SIGNAL(triggered()), this, SLOT(landscapeRight()));
- connect(ui.action320x480, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action768x1024, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action640x960, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action1536x2048, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action320x568, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action640x1136, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action480x800, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action240x320, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action540x960, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action480x854, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action240x400, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action360x640, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action800x1280, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action600x1024, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action600x800, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action768x1366, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action720x1280, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action1080x1920, SIGNAL(triggered()), this, SLOT(actionResolution()));
- connect(ui.action15_fps, SIGNAL(triggered()), this, SLOT(action15_fps()));
- connect(ui.action30_fps, SIGNAL(triggered()), this, SLOT(action30_fps()));
- connect(ui.action60_fps, SIGNAL(triggered()), this, SLOT(action60_fps()));
- connect(ui.actionUnlimited, SIGNAL(triggered()), this, SLOT(actionUnlimited()));
-
- // shortcuts
- connect(ui.actionRun, SIGNAL(triggered()), this, SLOT(sendRun()));
-
- // triggers
- connect(ui.glCanvas, SIGNAL(projectNameChanged(const QString&)), this, SLOT(projectNameChanged(const QString&)));
-}
-
-// set up the groups QActionGroup
-void MainWindow::setupGroups()
-{
- // view menu
- zoomGroup_ = new QActionGroup(this);
- zoomGroup_->addAction(ui.actionQuarter);
- zoomGroup_->addAction(ui.actionHalf);
- zoomGroup_->addAction(ui.actionOriginal);
+ connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
+ connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen()));
+
+ connect(ui.actionFull_Screen, SIGNAL(triggered(bool)), this, SLOT(actionFull_Screen(bool)));
+ connect(ui.actionHide_Menu, SIGNAL(triggered()), this, SLOT(actionHide_Menu()));
+ connect(ui.actionAlways_on_Top, SIGNAL(triggered(bool)), this, SLOT(actionAlwaysOnTop(bool)));
+
+ connect(ui.actionQuarter, SIGNAL(triggered()), this, SLOT(actionScale()));
+ connect(ui.actionHalf, SIGNAL(triggered()), this, SLOT(actionScale()));
+ connect(ui.actionOriginal, SIGNAL(triggered()), this, SLOT(actionScale()));
+ connect(ui.actionZoom_In, SIGNAL(triggered()), this, SLOT(actionScale()));
+ connect(ui.actionZoom_Out, SIGNAL(triggered()), this, SLOT(actionScale()));
+ connect(ui.actionFit_To_Window, SIGNAL(triggered()), this, SLOT(actionScale()));
+
+ connect(ui.actionDraw_Infos, SIGNAL(triggered(bool)), this, SLOT(actionDraw_Infos(bool)));
+
+ connect(ui.actionAuto_Scale, SIGNAL(triggered(bool)), this, SLOT(actionAuto_Scale(bool)));
+
+ connect(ui.actionRotate_Left, SIGNAL(triggered()), this, SLOT(actionRotate()));
+ connect(ui.actionRotate_Right, SIGNAL(triggered()), this, SLOT(actionRotate()));
+
+ connect(ui.actionPortrait, SIGNAL(triggered()), this, SLOT(actionOrientation()));
+ connect(ui.actionPortrait_Upside_Down, SIGNAL(triggered()), this, SLOT(actionOrientation()));
+ connect(ui.actionLandscape_Left, SIGNAL(triggered()), this, SLOT(actionOrientation()));
+ connect(ui.actionLandscape_Right, SIGNAL(triggered()), this, SLOT(actionOrientation()));
+
+ connect(ui.action320x480, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action768x1024, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action640x960, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action1536x2048, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action320x568, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action640x1136, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action480x800, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action240x320, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action540x960, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action480x854, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action240x400, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action360x640, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action800x1280, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action600x1024, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action600x800, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action768x1366, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action720x1280, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action1080x1920, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action750x1334, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action1242x2208, SIGNAL(triggered()), this, SLOT(actionResolution()));
+ connect(ui.action900x1200, SIGNAL(triggered()), this, SLOT(actionResolution()));
+
+ connect(ui.action15_fps, SIGNAL(triggered()), this, SLOT(actionFps()));
+ connect(ui.action30_fps, SIGNAL(triggered()), this, SLOT(actionFps()));
+ connect(ui.action60_fps, SIGNAL(triggered()), this, SLOT(actionFps()));
+ connect(ui.actionUnlimited, SIGNAL(triggered()), this, SLOT(actionFps()));
+
+ connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT(actionSettings()));
+
+ connect(ui.glCanvas, SIGNAL(projectNameChanged(const QString&)), this, SLOT(projectNameChanged(const QString&)));
+}
+
+void MainWindow::setupUiProperties(){
+ ui.action320x480->setProperty("width", 320);
+ ui.action320x480->setProperty("height", 480);
+
+ ui.action768x1024->setProperty("width", 768);
+ ui.action768x1024->setProperty("height", 1024);
+
+ ui.action640x960->setProperty("width", 640);
+ ui.action640x960->setProperty("height", 960);
+
+ ui.action1536x2048->setProperty("width", 1536);
+ ui.action1536x2048->setProperty("height", 2048);
+
+ ui.action320x568->setProperty("width", 320);
+ ui.action320x568->setProperty("height", 568);
- // hardware menu
+ ui.action640x1136->setProperty("width", 640);
+ ui.action640x1136->setProperty("height", 1136);
+
+ ui.action480x800->setProperty("width", 480);
+ ui.action480x800->setProperty("height", 800);
+
+ ui.action240x320->setProperty("width", 240);
+ ui.action240x320->setProperty("height", 320);
+
+ ui.action540x960->setProperty("width", 540);
+ ui.action540x960->setProperty("height", 960);
+
+ ui.action480x854->setProperty("width", 480);
+ ui.action480x854->setProperty("height", 854);
+
+ ui.action240x400->setProperty("width", 240);
+ ui.action240x400->setProperty("height", 400);
+
+ ui.action360x640->setProperty("width", 360);
+ ui.action360x640->setProperty("height", 640);
+
+ ui.action800x1280->setProperty("width", 800);
+ ui.action800x1280->setProperty("height", 1280);
+
+ ui.action600x1024->setProperty("width", 600);
+ ui.action600x1024->setProperty("height", 1024);
+
+ ui.action600x800->setProperty("width", 600);
+ ui.action600x800->setProperty("height", 800);
+
+ ui.action768x1366->setProperty("width", 768);
+ ui.action768x1366->setProperty("height", 1366);
+
+ ui.action720x1280->setProperty("width", 768);
+ ui.action720x1280->setProperty("height", 1280);
+
+ ui.action1080x1920->setProperty("width", 1080);
+ ui.action1080x1920->setProperty("height", 1920);
+
+ ui.action750x1334->setProperty("width", 750);
+ ui.action750x1334->setProperty("height", 1334);
+
+ ui.action1242x2208->setProperty("width", 1242);
+ ui.action1242x2208->setProperty("height", 2208);
+
+ ui.action900x1200->setProperty("width", 900);
+ ui.action900x1200->setProperty("height", 1200);
+
+ ui.action15_fps->setProperty("fps", 15);
+ ui.action30_fps->setProperty("fps", 30);
+ ui.action60_fps->setProperty("fps", 60);
+ ui.actionUnlimited->setProperty("fps", 10000);
+
+ ui.actionPortrait->setProperty("orientation", ePortrait);
+ ui.actionPortrait_Upside_Down->setProperty("orientation", ePortraitUpsideDown);
+ ui.actionLandscape_Left->setProperty("orientation", eLandscapeLeft);
+ ui.actionLandscape_Right->setProperty("orientation", eLandscapeRight);
+
+ ui.actionQuarter->setProperty("scale", 25);
+ ui.actionHalf->setProperty("scale", 50);
+ ui.actionOriginal->setProperty("scale", 100);
+ ui.actionZoom_In->setProperty("scale", eZoomIn);
+ ui.actionZoom_Out->setProperty("scale", eZoomOut);
+ ui.actionFit_To_Window->setProperty("scale", eFitToWindow);
+
+ ui.actionRotate_Left->setProperty("rotate", eLeft);
+ ui.actionRotate_Right->setProperty("rotate", eRight);
+}
+
+void MainWindow::createUiGroups(){
orientationGroup_ = new QActionGroup(this);
orientationGroup_->addAction(ui.actionPortrait);
orientationGroup_->addAction(ui.actionPortrait_Upside_Down);
orientationGroup_->addAction(ui.actionLandscape_Left);
orientationGroup_->addAction(ui.actionLandscape_Right);
+
resolutionGroup_ = new QActionGroup(this);
resolutionGroup_->addAction(ui.action320x480);
resolutionGroup_->addAction(ui.action768x1024);
@@ -115,465 +201,356 @@ void MainWindow::setupGroups()
resolutionGroup_->addAction(ui.action768x1366);
resolutionGroup_->addAction(ui.action720x1280);
resolutionGroup_->addAction(ui.action1080x1920);
+ resolutionGroup_->addAction(ui.action750x1334);
+ resolutionGroup_->addAction(ui.action1242x2208);
+ resolutionGroup_->addAction(ui.action900x1200);
+
+ fpsGroup_ = new QActionGroup(this);
+ fpsGroup_->addAction(ui.action15_fps);
+ fpsGroup_->addAction(ui.action30_fps);
+ fpsGroup_->addAction(ui.action60_fps);
+ fpsGroup_->addAction(ui.actionUnlimited);
}
-// load the QSettings and configure with persistent parameters
-void MainWindow::loadSettings()
-{
- QSettings settings;
+void MainWindow::loadSettings(){
+ setFullScreen(false);
+ setHideMenu(false);
+
+ QSettings settingsNative;
- // the position and size of window
- QPoint pos = settings.value("pos", QPoint(50, 50)).toPoint();
- QSize size = settings.value("size", QSize(1, 1)).toSize();
- resize(size);
- move(pos);
+ resize(settingsNative.value("size", QSize(320, 480 + ui.menuBar->height())).toSize());
+ move(settingsNative.value("pos", QPoint(0, 0)).toPoint());
- // the bools menu options
- if (settings.value("alwaysOnTop").toBool())
- ui.actionAlways_on_Top->trigger();
+ int red = settingsNative.value("backgroundRed", 240).toInt();
+ int green = settingsNative.value("backgroundGreen", 240).toInt();
+ int blue = settingsNative.value("backgroundBlue", 240).toInt();
+ QColor backgroundColor = QColor(red, green, blue);
- if (settings.value("autoScale").toBool())
- ui.actionAuto_Scale->trigger();
+ red = settingsNative.value("canvasRed", 255).toInt();
+ green = settingsNative.value("canvasGreen", 255).toInt();
+ blue = settingsNative.value("canvasBlue", 255).toInt();
+ QColor canvasColor = QColor(red, green, blue);
- // load configured resolution and scale
- loadResolution(settings.value("resolution", 320).toInt());
- loadScale(settings.value("scale", 1).toInt());
+ red = settingsNative.value("infoRed", 0).toInt();
+ green = settingsNative.value("infoGreen", 0).toInt();
+ blue = settingsNative.value("infoBlue", 0).toInt();
+ QColor infoColor = QColor(red, green, blue);
- // set canvas settings, scale, size and resolution
- ui.glCanvas->setScale(scale());
- ui.glCanvas->setFixedSize(hardwareWidth() / scale(), hardwareHeight() / scale());
- ui.glCanvas->setResolution(hardwareWidth(), hardwareHeight());
+ setBackgroundColor(backgroundColor);
+ setCanvasColor(canvasColor);
+ setInfoColor(infoColor);
- // load orientation and fps of player
- loadOrientation(static_cast(settings.value("orientation", ePortrait).toInt()));
- loadFps(settings.value("fps2", 60).toInt());
+ updateBackgroundColor();
+ updateCanvasColor();
+ updateInfoColor();
+
+ QSettings settings(Constants::SETTINGS_FOLDER + "/" + Constants::PLAYER_SETTINGS_FILE, QSettings::IniFormat);
+
+ setWidth(settings.value("width", 320).toInt());
+ setHeight(settings.value("height", 480).toInt());
+ setScale(settings.value("scale", 100).toInt());
+ setFps(settings.value("fps", 60).toInt());
+ setOrientation(static_cast(settings.value("orientation", ePortrait).toInt()));
+ setDrawInfos(settings.value("drawInfos", false).toBool());
+ setAutoScale(settings.value("autoScale", false).toBool());
+ setAlwaysOnTop(settings.value("alwaysOnTop", false).toBool());
+
+ checkLoadedSettings();
+
+ updateFps();
+ updateDrawInfos();
+ updateAlwaysOnTop();
+ updateAutoScale();
+ updateOrientation();
+ updateResolution();
}
-// save the current player settings
-void MainWindow::saveSettings()
-{
- QSettings settings;
+void MainWindow::checkLoadedSettings(){
+ QAction *action;
+
+ action = resolutionGroup_->checkedAction();
+
+ if(action)
+ action->setChecked(false);
+
+ QList resolutionListActions = resolutionGroup_->actions();
+ foreach(QAction *action, resolutionListActions){
+ if(action->property("width").toInt() == width() && action->property("height").toInt() == height()){
+ action->setChecked(true);
+ break;
+ }
+ }
+
+ action = fpsGroup_->checkedAction();
+ if(action)
+ action->setChecked(false);
+
+ QList fpsListActions = fpsGroup_->actions();
+ foreach(QAction *action, fpsListActions){
+ if(action->property("fps").toInt() == fps()){
+ action->setChecked(true);
+ break;
+ }
+ }
+
+ action = orientationGroup_->checkedAction();
+ if(action)
+ action->setChecked(false);
+
+ QList orientationListActions = orientationGroup_->actions();
+ foreach(QAction *action, orientationListActions){
+ if(static_cast(action->property("orientation").toInt()) == orientation()){
+ action->setChecked(true);
+ break;
+ }
+ }
+
+ ui.actionDraw_Infos->setChecked(drawInfos());
+ ui.actionAlways_on_Top->setChecked(alwaysOnTop());
+ ui.actionAuto_Scale->setChecked(autoScale());
+}
+
+void MainWindow::saveSettings(){
+ if(fullScreen())
+ this->showNormal();
+
+ QSettings settingsNative;
+
+ settingsNative.setValue("pos", pos());
+ settingsNative.setValue("size", size());
+
+ settingsNative.setValue("backgroundRed", backgroundColor().red());
+ settingsNative.setValue("backgroundGreen", backgroundColor().green());
+ settingsNative.setValue("backgroundBlue", backgroundColor().blue());
+
+ settingsNative.setValue("canvasRed", canvasColor().red());
+ settingsNative.setValue("canvasGreen", canvasColor().green());
+ settingsNative.setValue("canvasBlue", canvasColor().blue());
+
+ settingsNative.setValue("infoRed", infoColor().red());
+ settingsNative.setValue("infoGreen", infoColor().green());
+ settingsNative.setValue("infoBlue", infoColor().blue());
+
+ QSettings settings(Constants::SETTINGS_FOLDER + "/" + Constants::PLAYER_SETTINGS_FILE, QSettings::IniFormat);
- // save all flags and int values
- settings.setValue("pos", pos());
- settings.setValue("size", size());
settings.setValue("orientation", orientation());
- settings.setValue("alwaysOnTop", ui.actionAlways_on_Top->isChecked());
- settings.setValue("autoScale", ui.actionAuto_Scale->isChecked());
-
- // save fps setting
- if (ui.action15_fps->isChecked())
- settings.setValue("fps2", 15);
- else if (ui.action30_fps->isChecked())
- settings.setValue("fps2", 30);
- else if (ui.action60_fps->isChecked())
- settings.setValue("fps2", 60);
- else
- settings.setValue("fps2", 10000);
-
- // save resolution setting
- if (resolutionGroup_->checkedAction() == ui.action320x480)
- settings.setValue("resolution", 320);
- else if (resolutionGroup_->checkedAction() == ui.action768x1024)
- settings.setValue("resolution", 768);
- else if (resolutionGroup_->checkedAction() == ui.action640x960)
- settings.setValue("resolution", 640);
- else if (resolutionGroup_->checkedAction() == ui.action1536x2048)
- settings.setValue("resolution", 1536);
- else if (resolutionGroup_->checkedAction() == ui.action320x568)
- settings.setValue("resolution", 320+1);
- else if (resolutionGroup_->checkedAction() == ui.action640x1136)
- settings.setValue("resolution", 640+1);
- else if (resolutionGroup_->checkedAction() == ui.action480x800)
- settings.setValue("resolution", 480);
- else if (resolutionGroup_->checkedAction() == ui.action240x320)
- settings.setValue("resolution", 240);
- else if (resolutionGroup_->checkedAction() == ui.action540x960)
- settings.setValue("resolution", 540);
- else if (resolutionGroup_->checkedAction() == ui.action480x854)
- settings.setValue("resolution", 480+1);
- else if (resolutionGroup_->checkedAction() == ui.action240x400)
- settings.setValue("resolution", 240+1);
- else if (resolutionGroup_->checkedAction() == ui.action360x640)
- settings.setValue("resolution", 360);
- else if (resolutionGroup_->checkedAction() == ui.action800x1280)
- settings.setValue("resolution", 800);
- else if (resolutionGroup_->checkedAction() == ui.action600x1024)
- settings.setValue("resolution", 600);
- else if (resolutionGroup_->checkedAction() == ui.action600x800)
- settings.setValue("resolution", 600+1);
- else if (resolutionGroup_->checkedAction() == ui.action768x1366)
- settings.setValue("resolution", 768+1);
- else if (resolutionGroup_->checkedAction() == ui.action720x1280)
- settings.setValue("resolution", 720);
- else if (resolutionGroup_->checkedAction() == ui.action1080x1920)
- settings.setValue("resolution", 1080);
- else
- settings.setValue("resolution", 320);
+ settings.setValue("alwaysOnTop", alwaysOnTop());
+ settings.setValue("autoScale", autoScale());
+ settings.setValue("width", width());
+ settings.setValue("height", height());
+ settings.setValue("fps", fps());
+ settings.setValue("scale", scale());
+ settings.setValue("drawInfos", drawInfos());
+
+ if(fullScreen())
+ this->showFullScreen();
+}
- // save zoom factor setting
- if (ui.actionQuarter->isChecked())
- settings.setValue("scale", 4);
- else if (ui.actionHalf->isChecked())
- settings.setValue("scale", 2);
- else
- settings.setValue("scale", 1);
+void MainWindow::actionOpen(){
+ QDir directory = QFileDialog::getExistingDirectory(this, Constants::PLAYER_OPEN_DIALOG_NAME, "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ ui.glCanvas->play(directory);
}
-// load a resolution of loaded player by int res
-void MainWindow::loadResolution(int resolution)
-{
- switch (resolution)
- {
- case 320:
- ui.action320x480->setChecked(true);
- break;
- case 768:
- ui.action768x1024->setChecked(true);
- break;
- case 640:
- ui.action640x960->setChecked(true);
- break;
- case 1536:
- ui.action1536x2048->setChecked(true);
- break;
- case 320+1:
- ui.action320x568->setChecked(true);
- break;
- case 640+1:
- ui.action640x1136->setChecked(true);
- break;
- case 480:
- ui.action480x800->setChecked(true);
- break;
- case 240:
- ui.action240x320->setChecked(true);
- break;
- case 540:
- ui.action540x960->setChecked(true);
- break;
- case 480+1:
- ui.action480x854->setChecked(true);
- break;
- case 240+1:
- ui.action240x400->setChecked(true);
- break;
- case 360:
- ui.action360x640->setChecked(true);
- break;
- case 800:
- ui.action800x1280->setChecked(true);
- break;
- case 600:
- ui.action600x1024->setChecked(true);
- break;
- case 600+1:
- ui.action600x800->setChecked(true);
- break;
- case 768+1:
- ui.action768x1366->setChecked(true);
- break;
- case 720:
- ui.action720x1280->setChecked(true);
- break;
- case 1080:
- ui.action1080x1920->setChecked(true);
- break;
- }
+void MainWindow::actionDraw_Infos(bool checked){
+ setDrawInfos(checked);
+
+ updateDrawInfos();
}
-// load a scale to start player by scale factor
-void MainWindow::loadScale(int scale)
-{
- switch (scale)
- {
- case 1:
- ui.actionOriginal->setChecked(true);
- break;
- case 2:
- ui.actionHalf->setChecked(true);
- break;
- case 4:
- ui.actionQuarter->setChecked(true);
- break;
- }
+void MainWindow::actionFull_Screen(bool checked){
+ setFullScreen(checked);
+
+ updateFullScreen();
}
-// load an orientation for player by Orientation
-void MainWindow::loadOrientation(Orientation orientation)
-{
- switch (orientation)
- {
- case ePortrait:
- portrait();
- ui.actionPortrait->setChecked(true);
- break;
- case eLandscapeLeft:
- landscapeLeft();
- ui.actionLandscape_Left->setChecked(true);
- break;
- case ePortraitUpsideDown:
- portraitUpsideDown();
- ui.actionPortrait_Upside_Down->setChecked(true);
- break;
- case eLandscapeRight:
- landscapeRight();
- ui.actionLandscape_Right->setChecked(true);
- break;
- }
+void MainWindow::actionHide_Menu(){
+ setHideMenu(!ui.menuBar->isHidden());
+
+ updateHideMenu();
}
-// load fpt of player by int
-void MainWindow::loadFps(int fps)
-{
- if (fps == 15)
- action15_fps();
- else if (fps == 30)
- action30_fps();
- else if (fps == 60)
- action60_fps();
- else
- actionUnlimited();
+void MainWindow::actionAlwaysOnTop(bool checked){
+ setAlwaysOnTop(checked);
+
+ updateAlwaysOnTop();
}
-// get the scale factor of screen
-int MainWindow::scale()
-{
- if (ui.actionQuarter->isChecked())
- return 4;
+void MainWindow::actionAuto_Scale(bool checked){
+ setAutoScale(checked);
- if (ui.actionHalf->isChecked())
- return 2;
+ updateAutoScale();
+}
+
+void MainWindow::actionResolution(){
+ QAction *action = (QAction*)sender();
- return 1;
+ setWidth( action->property("width").toInt());
+ setHeight(action->property("height").toInt());
+
+ updateResolution();
}
-// get hardware width based on resolution or in screen if auto scale is on
-int MainWindow::hardwareWidth()
-{
- if(ui.actionAuto_Scale->isChecked())
- switch (orientation())
+void MainWindow::actionFps(){
+ QAction *action = (QAction*)sender();
+
+ setFps(action->property("fps").toInt());
+
+ updateFps();
+}
+
+void MainWindow::actionOrientation(){
+ QAction *action = (QAction*)sender();
+
+ setOrientation(static_cast(action->property("orientation").toInt()));
+
+ updateOrientation();
+}
+
+void MainWindow::actionScale(){
+ QAction *action = (QAction*)sender();
+
+ int scaleProperty = action->property("scale").toInt();
+ int scaleCurrent = scale();
+
+ switch(scaleProperty){
+ case(eZoomIn):
+ scaleProperty = scaleCurrent;
+ ++scaleProperty;
+ break;
+
+ case(eZoomOut):
+ scaleProperty = scaleCurrent;
+ if(scaleProperty > 1)
+ --scaleProperty;
+ break;
+
+ case(eFitToWindow):
+ int width = scale() * ui.centralWidget->height() / ui.glCanvas->height();
+ int height = scale() * ui.centralWidget->width() / ui.glCanvas->width();
+
+ scaleProperty = std::min(width, height);
+ break;
+ }
+
+ setScale(scaleProperty);
+
+ updateResolution();
+}
+
+void MainWindow::actionRotate(){
+ QAction *action = (QAction*)sender();
+
+ if(action->property("rotate").toInt() == eLeft){
+ switch(orientation())
{
case ePortrait:
- case ePortraitUpsideDown:
- return width();
-
+ ui.actionLandscape_Left->trigger();
+ break;
case eLandscapeLeft:
+ ui.actionPortrait_Upside_Down->trigger();
+ break;
+ case ePortraitUpsideDown:
+ ui.actionLandscape_Right->trigger();
+ break;
case eLandscapeRight:
- return height();
+ ui.actionPortrait->trigger();
+ break;
}
- else if (resolutionGroup_->checkedAction() == ui.action320x480)
- return 320;
- else if (resolutionGroup_->checkedAction() == ui.action768x1024)
- return 768;
- else if (resolutionGroup_->checkedAction() == ui.action640x960)
- return 640;
- else if (resolutionGroup_->checkedAction() == ui.action1536x2048)
- return 1536;
- else if (resolutionGroup_->checkedAction() == ui.action320x568)
- return 320;
- else if (resolutionGroup_->checkedAction() == ui.action640x1136)
- return 640;
- else if (resolutionGroup_->checkedAction() == ui.action480x800)
- return 480;
- else if (resolutionGroup_->checkedAction() == ui.action240x320)
- return 240;
- else if (resolutionGroup_->checkedAction() == ui.action540x960)
- return 540;
- else if (resolutionGroup_->checkedAction() == ui.action480x854)
- return 480;
- else if (resolutionGroup_->checkedAction() == ui.action240x400)
- return 240;
- else if (resolutionGroup_->checkedAction() == ui.action360x640)
- return 360;
- else if (resolutionGroup_->checkedAction() == ui.action800x1280)
- return 800;
- else if (resolutionGroup_->checkedAction() == ui.action600x1024)
- return 600;
- else if (resolutionGroup_->checkedAction() == ui.action600x800)
- return 600;
- else if (resolutionGroup_->checkedAction() == ui.action768x1366)
- return 768;
- else if (resolutionGroup_->checkedAction() == ui.action720x1280)
- return 720;
- else if (resolutionGroup_->checkedAction() == ui.action1080x1920)
- return 1080;
-
-
- return 320;
-}
-
-// get hardware height based on resolution or in screen if auto scale is on
-int MainWindow::hardwareHeight()
-{
- if(ui.actionAuto_Scale->isChecked())
+
+ }else{
switch (orientation())
{
case ePortrait:
+ ui.actionLandscape_Right->trigger();
+ break;
+ case eLandscapeRight:
+ ui.actionPortrait_Upside_Down->trigger();
+ break;
case ePortraitUpsideDown:
- if(ui.menuBar->isHidden())
- return height();
- else
- return height() - 21; // TODO: aqui, 21 é o height do menu superior, quando está à mostra, ele deve diminuir na screen, então devo
- // alterar aqui pegando o height do menu, pois pode ser diferente do mac para o windows
-
+ ui.actionLandscape_Left->trigger();
+ break;
case eLandscapeLeft:
- case eLandscapeRight:
- return width();
+ ui.actionPortrait->trigger();
+ break;
}
- else if (resolutionGroup_->checkedAction() == ui.action320x480)
- return 480;
- else if (resolutionGroup_->checkedAction() == ui.action768x1024)
- return 1024;
- else if (resolutionGroup_->checkedAction() == ui.action640x960)
- return 960;
- else if (resolutionGroup_->checkedAction() == ui.action1536x2048)
- return 2048;
- else if (resolutionGroup_->checkedAction() == ui.action320x568)
- return 568;
- else if (resolutionGroup_->checkedAction() == ui.action640x1136)
- return 1136;
- else if (resolutionGroup_->checkedAction() == ui.action480x800)
- return 800;
- else if (resolutionGroup_->checkedAction() == ui.action240x320)
- return 320;
- else if (resolutionGroup_->checkedAction() == ui.action540x960)
- return 960;
- else if (resolutionGroup_->checkedAction() == ui.action480x854)
- return 854;
- else if (resolutionGroup_->checkedAction() == ui.action240x400)
- return 400;
- else if (resolutionGroup_->checkedAction() == ui.action360x640)
- return 640;
- else if (resolutionGroup_->checkedAction() == ui.action800x1280)
- return 1280;
- else if (resolutionGroup_->checkedAction() == ui.action600x1024)
- return 1024;
- else if (resolutionGroup_->checkedAction() == ui.action600x800)
- return 800;
- else if (resolutionGroup_->checkedAction() == ui.action768x1366)
- return 1366;
- else if (resolutionGroup_->checkedAction() == ui.action720x1280)
- return 1280;
- else if (resolutionGroup_->checkedAction() == ui.action1080x1920)
- return 1920;
-
- return 480;
-}
-
-// player in portrait mode
-void MainWindow::portrait()
-{
- ui.glCanvas->setFixedSize(hardwareWidth()/scale(), hardwareHeight()/scale());
- ui.glCanvas->setHardwareOrientation(ePortrait);
+ }
+
+ updateOrientation();
}
-// player in portraitUpsideDown mode
-void MainWindow::portraitUpsideDown()
-{
- ui.glCanvas->setFixedSize(hardwareWidth()/scale(), hardwareHeight()/scale());
- ui.glCanvas->setHardwareOrientation(ePortraitUpsideDown);
+void MainWindow::actionSettings(){
+ SettingsDialog settingsDialog(this);
+ settingsDialog.exec();
}
-// player in landscapeLeft mode
-void MainWindow::landscapeLeft()
-{
- ui.glCanvas->setFixedSize(hardwareHeight()/scale(), hardwareWidth()/scale());
- ui.glCanvas->setHardwareOrientation(eLandscapeLeft);
+void MainWindow::updateHideMenu(){
+ if(hideMenu())
+ ui.menuBar->hide();
+
+ else
+ ui.menuBar->show();
+
+ updateResolution();
}
-// player in landscapeRight mode
-void MainWindow::landscapeRight()
-{
- ui.glCanvas->setFixedSize(hardwareHeight()/scale(), hardwareWidth()/scale());
- ui.glCanvas->setHardwareOrientation(eLandscapeRight);
+void MainWindow::updateFullScreen(){
+ if(fullScreen())
+ this->showFullScreen();
+ else
+ this->showNormal();
}
-// get the orientation of player by checked action
-Orientation MainWindow::orientation() const
-{
- if (orientationGroup_->checkedAction() == ui.actionPortrait)
- return ePortrait;
- else if (orientationGroup_->checkedAction() == ui.actionPortrait_Upside_Down)
- return ePortraitUpsideDown;
- else if (orientationGroup_->checkedAction() == ui.actionLandscape_Left)
- return eLandscapeLeft;
- else if (orientationGroup_->checkedAction() == ui.actionLandscape_Right)
- return eLandscapeRight;
+void MainWindow::updateResolution(){
+ if(autoScale()){
+ setWidth(ui.centralWidget->width());
+ setHeight(ui.centralWidget->height());
- return ePortrait;
-}
+ if(orientation() == eLandscapeLeft || orientation() == eLandscapeRight){
+ setWidth(ui.centralWidget->height());
+ setHeight(ui.centralWidget->width());
-// function to handle auto scale option
-void MainWindow::actionAuto_Scale(bool checked)
-{
- if (checked)
- {
- if(ui.centralWidget->minimumSize() == QSize(0, 0))
- ui.centralWidget->setMinimumSize(1, 1);
+ if(hideMenu())
+ setWidth(width() + ui.menuBar->height());
+
+ }else if(hideMenu())
+ setHeight(height() + ui.menuBar->height());
}
- else
- {
- ui.centralWidget->setMinimumSize(0, 0);
+
+ float scaleProperty = (float)100 / (float)((float)scale() * (float)devicePixelRatio());
+
+ ui.glCanvas->setScale(scaleProperty);
+
+ switch (orientation()){
+ case ePortrait:
+ case ePortraitUpsideDown:
+ ui.glCanvas->setFixedSize(width() / scaleProperty, height() / scaleProperty);
+ break;
+
+ case eLandscapeLeft:
+ case eLandscapeRight:
+ ui.glCanvas->setFixedSize(height() / scaleProperty, width() / scaleProperty);
+ break;
}
- actionResolution();
+ ui.glCanvas->setResolution(width(), height());
}
-// TODO: desativada por enquanto, mas esta basicamente funcionando (muitos bugs)
-// action to open a project directly in the player
-void MainWindow::actionOpen()
-{
- QDir directory = QFileDialog::getExistingDirectory(this, "Open Directory", "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
- ui.glCanvas->play(directory);
+void MainWindow::updateAutoScale(){
+ if(autoScale()){
+ QAction *action = resolutionGroup_->checkedAction();
+ if(action)
+ action->setChecked(false);
+ }
+
+ resolutionGroup_->setEnabled(!autoScale());
+
+ updateResolution();
}
-// handler of rotations to left
-void MainWindow::rotateLeft()
-{
- switch (orientation())
- {
- case ePortrait:
- ui.actionLandscape_Left->trigger();
- break;
- case eLandscapeLeft:
- ui.actionPortrait_Upside_Down->trigger();
- break;
- case ePortraitUpsideDown:
- ui.actionLandscape_Right->trigger();
- break;
- case eLandscapeRight:
- ui.actionPortrait->trigger();
- break;
- }
-}
-
-// handler of rotations to right
-void MainWindow::rotateRight()
-{
- switch (orientation())
- {
- case ePortrait:
- ui.actionLandscape_Right->trigger();
- break;
- case eLandscapeLeft:
- ui.actionPortrait->trigger();
- break;
- case ePortraitUpsideDown:
- ui.actionLandscape_Left->trigger();
- break;
- case eLandscapeRight:
- ui.actionPortrait_Upside_Down->trigger();
- break;
- }
-}
-
-// always on top function
-void MainWindow::alwaysOnTop(bool checked)
-{
+void MainWindow::updateAlwaysOnTop(){
// TODO: burada mac ve X11 icin extra seyler yapmak lazim
// keywords: Qt::Tool, Qt::WA_MacAlwaysShowToolWindow
- if (checked)
+ if(alwaysOnTop())
setWindowFlags((windowFlags() & ~Qt::WindowStaysOnBottomHint) | Qt::WindowStaysOnTopHint);
else
@@ -582,127 +559,170 @@ void MainWindow::alwaysOnTop(bool checked)
show();
}
-// handler to set zoom factor, scale
-void MainWindow::actionScale()
-{
- ui.glCanvas->setScale(scale());
- actionResolution();
+void MainWindow::updateFps(){
+ ui.glCanvas->setFps(fps());
}
-// action for 15 fps
-void MainWindow::action15_fps()
-{
- ui.action15_fps->setChecked(true);
- ui.action30_fps->setChecked(false);
- ui.action60_fps->setChecked(false);
- ui.actionUnlimited->setChecked(false);
+void MainWindow::updateOrientation(){
+ ui.glCanvas->setHardwareOrientation(orientation());
- ui.glCanvas->setFps(15);
+ updateResolution();
}
-// action for 30 fps
-void MainWindow::action30_fps()
-{
- ui.action15_fps->setChecked(false);
- ui.action30_fps->setChecked(true);
- ui.action60_fps->setChecked(false);
- ui.actionUnlimited->setChecked(false);
+void MainWindow::updateDrawInfos(){
+ ui.glCanvas->setDrawInfos(drawInfos());
+}
- ui.glCanvas->setFps(30);
+void MainWindow::updateBackgroundColor(){
+ QPalette palette;
+ palette.setColor(QPalette::Window, backgroundColor());
+ ui.centralWidget->window()->setPalette(palette);
}
-// action for 60 fps
-void MainWindow::action60_fps()
-{
- ui.action15_fps->setChecked(false);
- ui.action30_fps->setChecked(false);
- ui.action60_fps->setChecked(true);
- ui.actionUnlimited->setChecked(false);
+void MainWindow::updateCanvasColor(){
+ float glCanvasColor[3];
+ glCanvasColor[0] = (float)canvasColor().red() / (float)255;
+ glCanvasColor[1] = (float)canvasColor().green() / (float)255;
+ glCanvasColor[2] = (float)canvasColor().blue() / (float)255;
- ui.glCanvas->setFps(60);
+ ui.glCanvas->setCanvasColor(glCanvasColor);
}
-// action for 10000 (unlimited) fps
-void MainWindow::actionUnlimited()
-{
- ui.action15_fps->setChecked(false);
- ui.action30_fps->setChecked(false);
- ui.action60_fps->setChecked(false);
- ui.actionUnlimited->setChecked(true);
+void MainWindow::updateInfoColor(){
+ float glInfoColor[3];
+ glInfoColor[0] = (float)infoColor().red() / (float)255;
+ glInfoColor[1] = (float)infoColor().green() / (float)255;
+ glInfoColor[2] = (float)infoColor().blue() / (float)255;
- ui.glCanvas->setFps(10000);
+ ui.glCanvas->setInfoColor(glInfoColor);
}
-// key action to configure resolution
-void MainWindow::actionResolution()
-{
- switch (orientation())
- {
- case ePortrait:
- case ePortraitUpsideDown:
- ui.glCanvas->setScale(scale());
- ui.glCanvas->setFixedSize(hardwareWidth()/scale(), hardwareHeight()/scale());
- ui.glCanvas->setResolution(hardwareWidth(), hardwareHeight());
- break;
-
- case eLandscapeLeft:
- case eLandscapeRight:
- ui.glCanvas->setScale(scale());
- ui.glCanvas->setFixedSize(hardwareHeight()/scale(), hardwareWidth()/scale());
- ui.glCanvas->setResolution(hardwareWidth(), hardwareHeight());
- break;
- }
-}
-
-// handler to emmit project name changed event
-void MainWindow::projectNameChanged(const QString& projectName)
-{
- if (projectName.isEmpty() == true)
- setWindowTitle("Gideros Player");
- else
- setWindowTitle(projectName + " - Gideros Player");
+int MainWindow::fps(){
+ return fps_;
}
-// action to make full screen support
-void MainWindow::actionFull_Screen(bool checked)
-{
- if(checked)
- this->showFullScreen();
- else
- this->showNormal();
+void MainWindow::setFps(int fps){
+ fps_ = fps;
}
-// action to hide top menu
-void MainWindow::actionHide_Menu(bool checked)
-{
- if (checked)
- ui.menuBar->hide();
+int MainWindow::height(){
+ return height_;
+}
- else
- ui.menuBar->show();
+void MainWindow::setHeight(int height){
+ height_ = height;
+}
- actionResolution();
+int MainWindow::width(){
+ return width_;
}
-// send run shortcut (ctrl+r)
-void MainWindow::sendRun()
-{
- ui.glCanvas->sendRun();
+void MainWindow::setWidth(int width){
+ width_ = width;
}
-// on resize handler
-void MainWindow::resizeEvent(QResizeEvent*)
-{
- actionAuto_Scale(ui.actionAuto_Scale->isChecked());
+bool MainWindow::autoScale(){
+ return autoScale_;
}
-//on close of player event, save some settings
-void MainWindow::closeEvent(QCloseEvent*)
-{
- saveSettings();
+void MainWindow::setAutoScale(bool autoScale){
+ autoScale_ = autoScale;
+}
+
+bool MainWindow::drawInfos(){
+ return drawInfos_;
+}
+
+void MainWindow::setDrawInfos(bool drawInfos){
+ drawInfos_ = drawInfos;
+}
+
+bool MainWindow::alwaysOnTop(){
+ return alwaysOnTop_;
+}
+
+void MainWindow::setAlwaysOnTop(bool alwaysOnTop){
+ alwaysOnTop_ = alwaysOnTop;
+}
+
+Orientation MainWindow::orientation(){
+ return orientation_;
+}
+
+void MainWindow::setOrientation(Orientation orientation){
+ orientation_ = orientation;
+}
+
+bool MainWindow::hideMenu(){
+ return hideMenu_;
+}
+
+void MainWindow::setHideMenu(bool hideMenu){
+ hideMenu_ = hideMenu;
+}
+
+bool MainWindow::fullScreen(){
+ return fullScreen_;
+}
+
+void MainWindow::setFullScreen(bool fullScreen){
+ fullScreen_ = fullScreen;
+}
+
+int MainWindow::scale(){
+ return scale_;
+}
+
+void MainWindow::setScale(int scale){
+ scale_ = scale;
+}
+
+void MainWindow::setBackgroundColor(QColor backgroundColor){
+ backgroundColor_ = backgroundColor;
+}
+
+QColor MainWindow::backgroundColor(){
+ return backgroundColor_;
+}
+
+void MainWindow::setCanvasColor(QColor canvasColor){
+ canvasColor_ = canvasColor;
}
+QColor MainWindow::canvasColor(){
+ return canvasColor_;
+}
+
+void MainWindow::setInfoColor(QColor infoColor){
+ infoColor_ = infoColor;
+}
+
+QColor MainWindow::infoColor(){
+ return infoColor_;
+}
+void MainWindow::resizeWindow(int width, int height){
+ if(!hideMenu())
+ height = height + ui.menuBar->height();
+
+ resize(width, height);
+}
+
+void MainWindow::resizeEvent(QResizeEvent*){
+ if(autoScale())
+ updateResolution();
+}
+
+void MainWindow::closeEvent(QCloseEvent*){
+ saveSettings();
+}
+
+void MainWindow::projectNameChanged(const QString& projectName){
+ if (projectName.isEmpty() == true)
+ setWindowTitle(Constants::PLAYER_WINDOW_TITLE);
+ else
+ setWindowTitle(projectName + " - " + Constants::PLAYER_WINDOW_TITLE);
+}
/*
void MainWindow::exportAccessedFiles()
@@ -738,4 +758,38 @@ void MainWindow::exportAccessedFiles()
for (std::size_t i = 0; i < v.size(); ++i)
out << v[i].c_str() << "\n";
}
-} */
+}
+
+#include
+#include
+#include
+
+QPixmap pixmap("Images/cursor.png");
+QCursor cursor(pixmap, 222, 62);
+
+QApplication::setOverrideCursor(cursor);
+
+void MainWindow::mousePressEvent(QMouseEvent*)
+{
+ QPixmap pixmap("Images/cursor2.png");
+ QCursor cursor(pixmap, 222, 62);
+
+ QApplication::setOverrideCursor(cursor);
+}
+
+void MainWindow::mouseReleaseEvent(QMouseEvent*)
+{
+ QPixmap pixmap("Images/cursor.png");
+ QCursor cursor(pixmap, 222, 62);
+
+ QApplication::setOverrideCursor(cursor);
+}
+*/
+
+/*
+// send run shortcut (ctrl+r)
+void MainWindow::sendRun()
+{
+ ui.glCanvas->sendRun();
+}
+*/
diff --git a/player/Forms/projectpropertiesdialog.ui b/player/forms/projectpropertiesdialog.ui.disabled
similarity index 100%
rename from player/Forms/projectpropertiesdialog.ui
rename to player/forms/projectpropertiesdialog.ui.disabled
diff --git a/player/forms/settingsdialog.ui b/player/forms/settingsdialog.ui
new file mode 100644
index 000000000..e9209ceae
--- /dev/null
+++ b/player/forms/settingsdialog.ui
@@ -0,0 +1,438 @@
+
+
+ SettingsDialogClass
+
+
+
+ 0
+ 0
+ 381
+ 400
+
+
+
+ Settings Dialog
+
+
+
+ QLayout::SetFixedSize
+
+ -
+
+
+ 1
+
+
+
+ Configurations
+
+
+
-
+
+
-
+
+
-
+
+
+ Resolution:
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+ x
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+ px
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Orientation:
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ FPS:
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Scale:
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+ %
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 0
+ 200
+
+
+
+
+
+
+
+
+ Layout
+
+
+ -
+
+
-
+
+
-
+
+
+ Window Background (RGB 0-255):
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Canvas Background (RGB 0-255):
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Info Text Color (RGB 0-255):
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+ -
+
+
+
+ 50
+ 16777215
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 0
+ 200
+
+
+
+
+
+
+
+
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
diff --git a/player/Headers/projectpropertiesdialog.h b/player/headers/projectpropertiesdialog.h.disabled
similarity index 100%
rename from player/Headers/projectpropertiesdialog.h
rename to player/headers/projectpropertiesdialog.h.disabled
diff --git a/player/headers/settingsdialog.h b/player/headers/settingsdialog.h
new file mode 100644
index 000000000..664997057
--- /dev/null
+++ b/player/headers/settingsdialog.h
@@ -0,0 +1,29 @@
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include
+#include "ui_settingsdialog.h"
+#include "mainwindow.h"
+
+class SettingsDialog : public QDialog{
+ Q_OBJECT
+
+ public:
+ SettingsDialog(MainWindow *mainWindow, QWidget *parent = 0);
+ ~SettingsDialog();
+
+ private:
+ Ui::SettingsDialogClass ui;
+ MainWindow *mainWindow_;
+
+ void setupUiItems();
+ void loadValues();
+ void saveValues();
+ void updateMainStatus();
+
+ private slots:
+ void ok();
+ void cancel();
+};
+
+#endif // SETTINGSDIALOG_H
diff --git a/player/player.pro b/player/player.pro
new file mode 100644
index 000000000..a25142d98
--- /dev/null
+++ b/player/player.pro
@@ -0,0 +1,139 @@
+QT += core gui opengl network
+
+win32{
+ RC_FILE = other_files/player.rc
+
+ TARGET = GiderosPlayer
+
+ INCLUDEPATH += \
+ "../libgid/external/zlib-1.2.8"\
+ "../libgid/external/glew-1.10.0/include"\
+ ../libgid/external/freetype-2.4.12/include
+
+ LIBS += \
+ -L"../libgid/external/zlib-1.2.8/build/mingw48_32" -lzlibx\
+ -L"../libgid/external/glew-1.10.0/lib/mingw48_32" -lglew32\
+ -L"../libgid/external/freetype-2.4.12/build/mingw48_32" -lfreetype\
+ -lwsock32\
+ -liphlpapi\
+ -L"../libgid/release" -lgid\
+ -L"../libgvfs/release" -lgvfs\
+ -L"../lua/release" -llua\
+ -L"../libgideros/release" -lgideros\
+ -L"../libpystring/release" -lpystring
+}
+
+macx {
+ ICON = other_files/player.icns
+
+ INCLUDEPATH += \
+ "/usr/local/include"\
+ "/usr/local/include/freetype2"
+
+ TARGET = "Gideros Player"
+
+ LIBS += \
+ -framework OpenAL\
+ -framework OpenGL\
+ -framework CoreFoundation\
+ -lz\
+ -L"/usr/local/lib"\
+ -L"../libgid" -lgid\
+ -L"../libgvfs" -lgvfs\
+ -L"../lua" -llua\
+ -L"../libgideros" -lgideros\
+ -L"../libpystring" -lpystring\
+ -L"/usr/local/lib" -lGLEW -lfreetype
+
+ QMAKE_LFLAGS += -pagezero_size 10000 -image_base 100000000
+}
+
+TEMPLATE = app
+
+INCLUDEPATH += \
+ headers \
+ sources \
+ forms \
+ ../2dsg \
+ ../libplatform \
+ ../libsound \
+ ../libnetwork \
+ ../luabinding \
+ ../lua/src \
+ ../libpvrt \
+ ../libgvfs \
+ ../libgid/include \
+ ../libgid/include/qt \
+ ../libgideros \
+ ../libpystring \
+ "../external/glu" \
+ ../external/liquidfun-1.0.0/liquidfun/Box2D \
+ "../external/minizip-1.1/source" \
+ ../libraries/themes \
+ ../libraries/constants \
+
+SOURCES += \
+ sources/main.cpp \
+ sources/mainwindow.cpp \
+ sources/errordialog.cpp \
+ sources/glcanvas.cpp \
+ sources/settingsdialog.cpp \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Common/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/Shapes/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Contacts/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Joints/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Rope/*.cpp) \
+ $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Particle/*.cpp) \
+ $$files(../luabinding/*.cpp) ../luabinding/tlsf.c \
+ $$files(../libnetwork/*.cpp) \
+ ../libplatform/md5.c \
+ ../libplatform/platform.cpp \
+ ../libplatform/platformutil.cpp \
+ ../libplatform/utf8.c \
+ ../libplatform/openurl-qt.cpp \
+ ../libplatform/vibrate-empty.cpp \
+ ../libplatform/locale-qt.cpp \
+ ../libplatform/keepawake-empty.cpp \
+ ../libplatform/deviceinfo-qt.cpp \
+ ../libplatform/drawinfo.cpp \
+ ../libplatform/fps-generic.cpp \
+ ../libplatform/exit-generic.cpp \
+# ../libplatform/windowsize-generic.cpp \
+ ../libplatform/gtimer.cpp \
+ $$files(../2dsg/*.cpp) \
+ $$files(../libpvrt/*.cpp) \
+ $$files(../external/glu/libtess/*.c) \
+ "../external/minizip-1.1/source/ioapi.c" \
+ "../external/minizip-1.1/source/unzip.c" \
+ $$files(../libpvrt/*.h)
+
+FORMS += \
+ forms\mainwindow.ui\
+ forms\errordialog.ui \
+ forms\settingsdialog.ui
+
+HEADERS += \
+ headers\mainwindow.h \
+ headers\errordialog.h \
+ headers\glcanvas.h \
+ headers\settingsdialog.h\
+ $$files(../libsound/*.h)\
+ $$files(../2dsg/*.h)\
+ $$files(../luabinding/*.h)\
+ $$files(../libnetwork/*.h)\
+ $$files(../libplatform/*.h)\
+
+DEFINES += USE_FILE32API
+
+LIBS += -lpthread
+
+#INCLUDEPATH += ../external/Box2D_v2.3.0/Box2D
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Common/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/Shapes/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Contacts/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Joints/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Rope/*.cpp)
diff --git a/player/player_qt5.pro b/player/player_qt5.pro
deleted file mode 100644
index 872b3865c..000000000
--- a/player/player_qt5.pro
+++ /dev/null
@@ -1,176 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2011-03-09T08:32:11
-#
-#-------------------------------------------------
-
-QT += core gui opengl network
-
-win32 {
-RC_FILE = Other_files/player.rc
-}
-
-macx {
-ICON = Other_files/player.icns
-}
-
-INCLUDEPATH += \
- Headers\
- Sources\
- Forms\
- ../2dsg\
- ../libplatform\
- ../libsound\
- ../libnetwork\
- ../luabinding\
- ../lua/src\
- ../libpvrt\
- ../libgvfs\
- ../libgid/include\
- ../libgid/include/qt\
- ../libgideros\
- ../libpystring\
- "../external/glu"
-
-macx {
-INCLUDEPATH += "/usr/local/include"
-INCLUDEPATH += "/usr/local/include/freetype2"
-}
-
-macx {
-TARGET = "Gideros Player"
-}
-
-win32 {
-TARGET = GiderosPlayer
-}
-
-TEMPLATE = app
-
-
-#INCLUDEPATH += ../external/Box2D_v2.3.0/Box2D
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Common/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/Shapes/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Contacts/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Joints/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Rope/*.cpp)
-
-INCLUDEPATH += ../external/liquidfun-1.0.0/liquidfun/Box2D
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Common/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/Shapes/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Contacts/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Joints/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Rope/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Particle/*.cpp)
-
-SOURCES += \
- Sources\main.cpp \
- Sources\mainwindow.cpp \
- Sources\errordialog.cpp \
- Sources\glcanvas.cpp \
- Sources\projectpropertiesdialog.cpp
-
-SOURCES += $$files(../luabinding/*.cpp) ../luabinding/tlsf.c
-
-SOURCES += $$files(../libnetwork/*.cpp)
-
-SOURCES += \
- ../libplatform/md5.c \
- ../libplatform/platform.cpp \
- ../libplatform/platformutil.cpp \
- ../libplatform/utf8.c \
- ../libplatform/openurl-qt.cpp \
- ../libplatform/vibrate-empty.cpp \
- ../libplatform/locale-qt.cpp \
- ../libplatform/keepawake-empty.cpp \
- ../libplatform/deviceinfo-qt.cpp \
- ../libplatform/drawinfo.cpp \
- ../libplatform/fps-generic.cpp \
- ../libplatform/exit-generic.cpp \
- ../libplatform/gtimer.cpp
-
-SOURCES += $$files(../2dsg/*.cpp)
-
-SOURCES += $$files(../libpvrt/*.cpp)
-
-SOURCES += $$files(../external/glu/libtess/*.c)
-
-DEFINES += USE_FILE32API
-SOURCES += \
- "../external/minizip-1.1/source/ioapi.c" \
- "../external/minizip-1.1/source/unzip.c"
-
-INCLUDEPATH += "../external/minizip-1.1/source"
-
-win32 {
-INCLUDEPATH += "../libgid/external/zlib-1.2.8"
-LIBS += -L"../libgid/external/zlib-1.2.8/build/mingw48_32" -lzlibx
-INCLUDEPATH += "../libgid/external/glew-1.10.0/include"
-LIBS += -L"../libgid/external/glew-1.10.0/lib/mingw48_32" -lglew32
-}
-
-LIBS += -lpthread
-
-macx {
-LIBS += -framework OpenAL
-LIBS += -framework OpenGL
-LIBS += -framework CoreFoundation
-LIBS += -lz
-LIBS += -L"/usr/local/lib"
-}
-
-win32 {
-LIBS += -lwsock32
-LIBS += -liphlpapi
-}
-
-win32 {
-LIBS += -L"../libgid/release" -lgid
-LIBS += -L"../libgvfs/release" -lgvfs
-LIBS += -L"../lua/release" -llua
-LIBS += -L"../libgideros/release" -lgideros
-LIBS += -L"../libpystring/release" -lpystring
-}
-
-macx {
-LIBS += -L"../libgid" -lgid
-LIBS += -L"../libgvfs" -lgvfs
-LIBS += -L"../lua" -llua
-LIBS += -L"../libgideros" -lgideros
-LIBS += -L"../libpystring" -lpystring
-LIBS += -L"/usr/local/lib" -lGLEW -lfreetype
-}
-
-
-HEADERS += \
- Headers\mainwindow.h \
- Headers\errordialog.h \
- Headers\glcanvas.h \
- Headers\projectpropertiesdialog.h
-
-HEADERS += $$files(../libsound/*.h)
-HEADERS += $$files(../2dsg/*.h)
-HEADERS += $$files(../luabinding/*.h)
-HEADERS += $$files(../libnetwork/*.h)
-HEADERS += $$files(../libplatform/*.h)
-
-SOURCES += $$files(../libpvrt/*.h)
-
-
-FORMS += \
- Forms\mainwindow.ui\
- Forms\errordialog.ui \
- Forms\projectpropertiesdialog.ui
-
-win32 {
- INCLUDEPATH += ../libgid/external/freetype-2.4.12/include
- LIBS += -L"../libgid/external/freetype-2.4.12/build/mingw48_32" -lfreetype
-}
-
-macx {
-QMAKE_LFLAGS += -pagezero_size 10000 -image_base 100000000
-}
diff --git a/player/player_qt4.pro b/player/projects/player_qt4.pro
similarity index 96%
rename from player/player_qt4.pro
rename to player/projects/player_qt4.pro
index bc60614bc..f996e4758 100644
--- a/player/player_qt4.pro
+++ b/player/projects/player_qt4.pro
@@ -1,174 +1,174 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2011-03-09T08:32:11
-#
-#-------------------------------------------------
-
-QT += core gui opengl network
-
-win32 {
-RC_FILE = player.rc
-}
-
-macx {
-ICON = player.icns
-}
-
-INCLUDEPATH += \
- ../2dsg\
- ../libplatform\
- ../libsound\
- ../libnetwork\
- ../luabinding\
- ../lua/src\
- ../libpvrt\
- ../libgvfs\
- ../libgid/include\
- ../libgid/include/qt\
- ../libgideros\
- ../libpystring\
- "../external/glu"
-
-macx {
-INCLUDEPATH += "/opt/local/include"
-INCLUDEPATH += "/opt/local/include/freetype2"
-}
-
-macx {
-TARGET = "Gideros Player"
-}
-
-win32 {
-TARGET = GiderosPlayer
-}
-
-TEMPLATE = app
-
-
-#INCLUDEPATH += ../external/Box2D_v2.3.0/Box2D
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Common/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/Shapes/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Contacts/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Joints/*.cpp)
-#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Rope/*.cpp)
-
-INCLUDEPATH += ../external/liquidfun-1.0.0/liquidfun/Box2D
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Common/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/Shapes/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Contacts/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Joints/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Rope/*.cpp)
-SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Particle/*.cpp)
-
-
-SOURCES += \
- main.cpp \
- mainwindow.cpp \
- errordialog.cpp \
- glcanvas.cpp \
- projectpropertiesdialog.cpp
-
-SOURCES += $$files(../luabinding/*.cpp) ../luabinding/tlsf.c
-
-SOURCES += $$files(../libnetwork/*.cpp)
-
-SOURCES += \
- ../libplatform/md5.c \
- ../libplatform/platform.cpp \
- ../libplatform/platformutil.cpp \
- ../libplatform/utf8.c \
- ../libplatform/openurl-qt.cpp \
- ../libplatform/vibrate-empty.cpp \
- ../libplatform/locale-qt.cpp \
- ../libplatform/keepawake-empty.cpp \
- ../libplatform/deviceinfo-qt.cpp \
- ../libplatform/drawinfo.cpp \
- ../libplatform/fps-generic.cpp \
- ../libplatform/exit-generic.cpp \
- ../libplatform/gtimer.cpp
-
-SOURCES += $$files(../2dsg/*.cpp)
-
-SOURCES += $$files(../libpvrt/*.cpp)
-
-SOURCES += $$files(../external/glu/libtess/*.c)
-
-DEFINES += USE_FILE32API
-SOURCES += \
- "../external/minizip-1.1/source/ioapi.c" \
- "../external/minizip-1.1/source/unzip.c"
-
-INCLUDEPATH += "../external/minizip-1.1/source"
-
-win32 {
-INCLUDEPATH += "../libgid/external/zlib-1.2.8"
-LIBS += -L"../libgid/external/zlib-1.2.8/build/mingw" -lzlibx
-INCLUDEPATH += "../libgid/external/glew-1.10.0/include"
-LIBS += -L"../libgid/external/glew-1.10.0/lib/mingw" -lglew32
-}
-
-LIBS += -lpthread
-
-macx {
-LIBS += -framework OpenAL
-LIBS += -framework OpenGL
-LIBS += -framework CoreFoundation
-LIBS += -lz
-LIBS += -L"/opt/local/lib"
-}
-
-win32 {
-LIBS += -lwsock32
-LIBS += -liphlpapi
-}
-
-win32 {
-LIBS += -L"../libgid/release" -lgid
-LIBS += -L"../libgvfs/release" -lgvfs
-LIBS += -L"../lua/release" -llua
-LIBS += -L"../libgideros/release" -lgideros
-LIBS += -L"../libpystring/release" -lpystring
-}
-
-macx {
-LIBS += -L"../libgid" -lgid
-LIBS += -L"../libgvfs" -lgvfs
-LIBS += -L"../lua" -llua
-LIBS += -L"../libgideros" -lgideros
-LIBS += -L"../libpystring" -lpystring
-LIBS += -L"/opt/local/lib" -lGLEW -lfreetype
-}
-
-
-HEADERS += \
- mainwindow.h \
- errordialog.h \
- glcanvas.h \
- projectpropertiesdialog.h
-
-HEADERS += $$files(../libsound/*.h)
-HEADERS += $$files(../2dsg/*.h)
-HEADERS += $$files(../luabinding/*.h)
-HEADERS += $$files(../libnetwork/*.h)
-HEADERS += $$files(../libplatform/*.h)
-
-SOURCES += $$files(../libpvrt/*.h)
-
-
-FORMS += \
- mainwindow.ui\
- errordialog.ui \
- projectpropertiesdialog.ui
-
-win32 {
- INCLUDEPATH += ../libgid/external/freetype-2.4.12/include
- LIBS += -L"../libgid/external/freetype-2.4.12/build/mingw" -lfreetype
-}
-
-macx {
-QMAKE_LFLAGS += -pagezero_size 10000 -image_base 100000000
-}
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-03-09T08:32:11
+#
+#-------------------------------------------------
+
+QT += core gui opengl network
+
+win32 {
+RC_FILE = player.rc
+}
+
+macx {
+ICON = player.icns
+}
+
+INCLUDEPATH += \
+ ../2dsg\
+ ../libplatform\
+ ../libsound\
+ ../libnetwork\
+ ../luabinding\
+ ../lua/src\
+ ../libpvrt\
+ ../libgvfs\
+ ../libgid/include\
+ ../libgid/include/qt\
+ ../libgideros\
+ ../libpystring\
+ "../external/glu"
+
+macx {
+INCLUDEPATH += "/opt/local/include"
+INCLUDEPATH += "/opt/local/include/freetype2"
+}
+
+macx {
+TARGET = "Gideros Player"
+}
+
+win32 {
+TARGET = GiderosPlayer
+}
+
+TEMPLATE = app
+
+
+#INCLUDEPATH += ../external/Box2D_v2.3.0/Box2D
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Common/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Collision/Shapes/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Contacts/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Dynamics/Joints/*.cpp)
+#SOURCES += $$files(../external/Box2D_v2.3.0/Box2D/Box2D/Rope/*.cpp)
+
+INCLUDEPATH += ../external/liquidfun-1.0.0/liquidfun/Box2D
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Common/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Collision/Shapes/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Contacts/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Dynamics/Joints/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Rope/*.cpp)
+SOURCES += $$files(../external/liquidfun-1.0.0/liquidfun/Box2D/Box2D/Particle/*.cpp)
+
+
+SOURCES += \
+ main.cpp \
+ mainwindow.cpp \
+ errordialog.cpp \
+ glcanvas.cpp \
+ projectpropertiesdialog.cpp
+
+SOURCES += $$files(../luabinding/*.cpp) ../luabinding/tlsf.c
+
+SOURCES += $$files(../libnetwork/*.cpp)
+
+SOURCES += \
+ ../libplatform/md5.c \
+ ../libplatform/platform.cpp \
+ ../libplatform/platformutil.cpp \
+ ../libplatform/utf8.c \
+ ../libplatform/openurl-qt.cpp \
+ ../libplatform/vibrate-empty.cpp \
+ ../libplatform/locale-qt.cpp \
+ ../libplatform/keepawake-empty.cpp \
+ ../libplatform/deviceinfo-qt.cpp \
+ ../libplatform/drawinfo.cpp \
+ ../libplatform/fps-generic.cpp \
+ ../libplatform/exit-generic.cpp \
+ ../libplatform/gtimer.cpp
+
+SOURCES += $$files(../2dsg/*.cpp)
+
+SOURCES += $$files(../libpvrt/*.cpp)
+
+SOURCES += $$files(../external/glu/libtess/*.c)
+
+DEFINES += USE_FILE32API
+SOURCES += \
+ "../external/minizip-1.1/source/ioapi.c" \
+ "../external/minizip-1.1/source/unzip.c"
+
+INCLUDEPATH += "../external/minizip-1.1/source"
+
+win32 {
+INCLUDEPATH += "../libgid/external/zlib-1.2.8"
+LIBS += -L"../libgid/external/zlib-1.2.8/build/mingw" -lzlibx
+INCLUDEPATH += "../libgid/external/glew-1.10.0/include"
+LIBS += -L"../libgid/external/glew-1.10.0/lib/mingw" -lglew32
+}
+
+LIBS += -lpthread
+
+macx {
+LIBS += -framework OpenAL
+LIBS += -framework OpenGL
+LIBS += -framework CoreFoundation
+LIBS += -lz
+LIBS += -L"/opt/local/lib"
+}
+
+win32 {
+LIBS += -lwsock32
+LIBS += -liphlpapi
+}
+
+win32 {
+LIBS += -L"../libgid/release" -lgid
+LIBS += -L"../libgvfs/release" -lgvfs
+LIBS += -L"../lua/release" -llua
+LIBS += -L"../libgideros/release" -lgideros
+LIBS += -L"../libpystring/release" -lpystring
+}
+
+macx {
+LIBS += -L"../libgid" -lgid
+LIBS += -L"../libgvfs" -lgvfs
+LIBS += -L"../lua" -llua
+LIBS += -L"../libgideros" -lgideros
+LIBS += -L"../libpystring" -lpystring
+LIBS += -L"/opt/local/lib" -lGLEW -lfreetype
+}
+
+
+HEADERS += \
+ mainwindow.h \
+ errordialog.h \
+ glcanvas.h \
+ projectpropertiesdialog.h
+
+HEADERS += $$files(../libsound/*.h)
+HEADERS += $$files(../2dsg/*.h)
+HEADERS += $$files(../luabinding/*.h)
+HEADERS += $$files(../libnetwork/*.h)
+HEADERS += $$files(../libplatform/*.h)
+
+SOURCES += $$files(../libpvrt/*.h)
+
+
+FORMS += \
+ mainwindow.ui\
+ errordialog.ui \
+ projectpropertiesdialog.ui
+
+win32 {
+ INCLUDEPATH += ../libgid/external/freetype-2.4.12/include
+ LIBS += -L"../libgid/external/freetype-2.4.12/build/mingw" -lfreetype
+}
+
+macx {
+QMAKE_LFLAGS += -pagezero_size 10000 -image_base 100000000
+}
diff --git a/player/readme.md b/player/readme.md
new file mode 100644
index 000000000..9dbc2207d
--- /dev/null
+++ b/player/readme.md
@@ -0,0 +1,47 @@
+# Gideros Player
+### This is the player simulator to Gideros Studio run on desktop.
+
+Features added:
+
+* Zoom In and Out option, controlled by Alt + Arrow Up or Alt + Arrow Down
+* Fit to Window by zooming
+* Hide Menu bar option
+* Auto Scale option, the canvas occupies all the player screen (but the player dont resize anymore when resolution are changed
+* Draw Infos option, to show the player informations when the app is running
+* Some resolutions added
+* Configurations dialog added, to control some commom options and aditional color options (Player window, canvas background and info text color)
+* Settings/GiderosPlayer.ini automatically created to store some configurations
+
+
+##### Important
+
+Don't forget to build these dependencies, in this order, before build this project:
+* libpystring
+* libgvfs
+* liblua
+* libgid
+* libgideros
+
+
+To make a easy workflow, add this custom steps (Add Build Step -> Custom Process Step) to Qt Creator:
+
+
+##### Release (Windows)
+
+To copy generated files from build player process to root\release folder:
+
+* Command: cmd
+* Arguments: /C %{buildDir}\scripts\copy-generated.bat
+* Working directory: %{buildDir}
+
+To copy required player files previously builded to root\release folder:
+
+* Command: cmd
+* Arguments: /C %{buildDir}\scripts\copy-required.bat
+* Working directory: %{buildDir}
+
+To start the player from root\release folder:
+
+* Command: cmd
+* Arguments: /C %{buildDir}\scripts\start-player.bat
+* Working directory: %{buildDir}
\ No newline at end of file
diff --git a/player/scripts/copy-generated.bat b/player/scripts/copy-generated.bat
new file mode 100644
index 000000000..69111106b
--- /dev/null
+++ b/player/scripts/copy-generated.bat
@@ -0,0 +1 @@
+cp ..\player\release\GiderosPlayer.exe ..\release
\ No newline at end of file
diff --git a/player/scripts/copy-required.bat b/player/scripts/copy-required.bat
new file mode 100644
index 000000000..6fb6dfae9
--- /dev/null
+++ b/player/scripts/copy-required.bat
@@ -0,0 +1,34 @@
+rm -rf ..\release\platforms\*
+mkdir ..\release\platforms
+cp %QT_DIR%\plugins\platforms\qminimal.dll ..\release\platforms
+cp %QT_DIR%\plugins\platforms\qoffscreen.dll ..\release\platforms
+cp %QT_DIR%\plugins\platforms\qwindows.dll ..\release\platforms
+
+cp %QT_DIR%\bin\icudt53.dll ..\release
+cp %QT_DIR%\bin\icuin53.dll ..\release
+cp %QT_DIR%\bin\icuuc53.dll ..\release
+cp %QT_DIR%\bin\libgcc_s_dw2-1.dll ..\release
+cp %QT_DIR%\bin\libstdc++-6.dll ..\release
+cp %QT_DIR%\bin\libwinpthread-1.dll ..\release
+cp %QT_DIR%\bin\Qt5Core.dll ..\release
+cp %QT_DIR%\bin\Qt5Gui.dll ..\release
+cp %QT_DIR%\bin\Qt5Network.dll ..\release
+cp %QT_DIR%\bin\Qt5OpenGL.dll ..\release
+cp %QT_DIR%\bin\Qt5PrintSupport.dll ..\release
+cp %QT_DIR%\bin\Qt5Widgets.dll ..\release
+cp %QT_DIR%\bin\Qt5Xml.dll ..\release
+
+cp ..\libgid\release\gid.dll ..\release
+cp ..\libgideros\release\gideros.dll ..\release
+cp ..\libgvfs\release\gvfs.dll ..\release
+cp ..\lua\release\lua.dll ..\release
+cp ..\libpystring\release\pystring.dll ..\release
+
+cp ..\libgid\external\glew-1.10.0\lib\mingw\glew32.dll ..\release
+cp ..\libgid\external\openal-soft-1.13\build\mingw\OpenAL32.dll ..\release
+
+REM zlib not used for now
+REM cp ..\libgid\external\zlib-1.2.8\build\mingw\zlib.dll ..\release
+
+REM luajit not working for now
+REM cp ..\luajit\src\lua51.dll ..\release\lua.dll
\ No newline at end of file
diff --git a/player/scripts/start.bat b/player/scripts/start.bat
new file mode 100644
index 000000000..bc495ad97
--- /dev/null
+++ b/player/scripts/start.bat
@@ -0,0 +1 @@
+start "" "..\release\GiderosPlayer.exe"
\ No newline at end of file
diff --git a/player/Sources/projectpropertiesdialog.cpp b/player/sources/projectpropertiesdialog.cpp.disabled
similarity index 100%
rename from player/Sources/projectpropertiesdialog.cpp
rename to player/sources/projectpropertiesdialog.cpp.disabled
diff --git a/player/sources/settingsdialog.cpp b/player/sources/settingsdialog.cpp
new file mode 100644
index 000000000..0bf3666d5
--- /dev/null
+++ b/player/sources/settingsdialog.cpp
@@ -0,0 +1,127 @@
+#include "settingsdialog.h"
+#include
+#include
+#include
+#include
+#include "constants.cpp"
+#include "mainwindow.h"
+
+SettingsDialog::SettingsDialog(MainWindow *mainWindow, QWidget *parent) : QDialog(parent), mainWindow_(mainWindow){
+ ui.setupUi(this);
+
+ setWindowFlags((windowFlags() & ~Qt::WindowStaysOnBottomHint) | Qt::WindowStaysOnTopHint);
+
+ connect(ui.dialogButtonBox, SIGNAL(accepted()), this, SLOT(ok()));
+ connect(ui.dialogButtonBox, SIGNAL(rejected()), this, SLOT(cancel()));
+
+ setupUiItems();
+
+ loadValues();
+}
+
+SettingsDialog::~SettingsDialog(){}
+
+void SettingsDialog::setupUiItems(){
+ ui.comboBoxOrientation->addItem(Constants::PORTRAIT, ePortrait);
+ ui.comboBoxOrientation->addItem(Constants::LANDSCAPE_LEFT, eLandscapeLeft);
+ ui.comboBoxOrientation->addItem(Constants::PORTRAIT_UPSIDE_DOWN, ePortraitUpsideDown);
+ ui.comboBoxOrientation->addItem(Constants::LANDSCAPE_RIGHT, eLandscapeRight);
+
+ ui.comboBoxFps->addItem("15", 15);
+ ui.comboBoxFps->addItem("30", 30);
+ ui.comboBoxFps->addItem("60", 60);
+ ui.comboBoxFps->addItem("Unlimited", 10000);
+}
+
+void SettingsDialog::loadValues(){
+ int width = mainWindow_->width();
+ int height = mainWindow_->height();
+ int orientation = mainWindow_->orientation();
+ int fps = mainWindow_->fps();
+ int fpsIndex;
+ if(fps == 15)
+ fpsIndex = 0;
+
+ else if(fps == 30)
+ fpsIndex = 1;
+
+ else if(fps == 60)
+ fpsIndex = 2;
+
+ else
+ fpsIndex = 3;
+ int scale = mainWindow_->scale();
+ QColor backgroundColor = mainWindow_->backgroundColor();
+ QColor canvasColor = mainWindow_->canvasColor();
+ QColor infoColor = mainWindow_->infoColor();
+
+ ui.lineEditWidth->setText(QString::number(width));
+ ui.lineEditHeight->setText(QString::number(height));
+ ui.comboBoxOrientation->setCurrentIndex(orientation);
+ ui.comboBoxFps->setCurrentIndex(fpsIndex);
+ ui.lineEditScale->setText(QString::number(scale));
+ ui.lineEditWindowRed->setText(QString::number(backgroundColor.red()));
+ ui.lineEditWindowGreen->setText(QString::number(backgroundColor.green()));
+ ui.lineEditWindowBlue->setText(QString::number(backgroundColor.blue()));
+ ui.lineEditCanvasRed->setText(QString::number(canvasColor.red()));
+ ui.lineEditCanvasGreen->setText(QString::number(canvasColor.green()));
+ ui.lineEditCanvasBlue->setText(QString::number(canvasColor.blue()));
+ ui.lineEditInfoRed->setText(QString::number(infoColor.red()));
+ ui.lineEditInfoGreen->setText(QString::number(infoColor.green()));
+ ui.lineEditInfoBlue->setText(QString::number(infoColor.blue()));
+}
+
+void SettingsDialog::cancel(){
+ reject();
+}
+
+void SettingsDialog::ok(){
+ saveValues();
+
+ updateMainStatus();
+
+ accept();
+}
+
+void SettingsDialog::saveValues(){
+ int width = ui.lineEditWidth->text().toInt();
+ int height = ui.lineEditHeight->text().toInt();
+ Orientation orientation = static_cast(ui.comboBoxOrientation->currentData().toInt());
+ int fps = ui.comboBoxFps->currentData().toInt();
+ int scale = ui.lineEditScale->text().toInt();
+ int red = ui.lineEditWindowRed->text().toInt();
+ int green = ui.lineEditWindowGreen->text().toInt();
+ int blue = ui.lineEditWindowBlue->text().toInt();
+ QColor backgroundColor = QColor(red, green, blue);
+ red = ui.lineEditCanvasRed->text().toInt();
+ green = ui.lineEditCanvasGreen->text().toInt();
+ blue = ui.lineEditCanvasBlue->text().toInt();
+ QColor canvasColor = QColor(red, green, blue);
+ red = ui.lineEditInfoRed->text().toInt();
+ green = ui.lineEditInfoGreen->text().toInt();
+ blue = ui.lineEditInfoBlue->text().toInt();
+ QColor infoColor = QColor(red, green, blue);
+
+ mainWindow_->setWidth(width);
+ mainWindow_->setHeight(height);
+ mainWindow_->setOrientation(orientation);
+ mainWindow_->setFps(fps);
+ mainWindow_->setScale(scale);
+ mainWindow_->setBackgroundColor(backgroundColor);
+ mainWindow_->setCanvasColor(canvasColor);
+ mainWindow_->setInfoColor(infoColor);
+
+ mainWindow_->saveSettings();
+}
+
+void SettingsDialog::updateMainStatus(){
+ mainWindow_->updateFps();
+
+ mainWindow_->updateOrientation();
+ mainWindow_->updateResolution();
+ mainWindow_->updateBackgroundColor();
+ mainWindow_->updateCanvasColor();
+ mainWindow_->updateInfoColor();
+
+ mainWindow_->checkLoadedSettings();
+}