Commit 47492d18 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Moved mains to a specific dir. Creating a main without GUI for non GUI mode.

parent dea2bdbe
......@@ -19,4 +19,7 @@
/* VLMC's version */
#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@"
/* GUI application ? */
#cmakedefine WITH_GUI
#endif //CONFIG_H
......@@ -4,9 +4,7 @@
SUBDIRS(EffectsEngine/Plugins/src)
SET(VLMC_SRCS
main.cpp
Commands/Commands.cpp
Commands/KeyboardShortcutHelper.cpp
Settings/SettingsManager.cpp
Settings/SettingValue.cpp
EffectsEngine/EffectNode.cpp
......@@ -53,11 +51,10 @@ SET(VLMC_SRCS
IF (WIN32)
LIST ( APPEND VLMC_SRCS winvlmc.cpp )
ELSE (WIN32)
LIST( APPEND VLMC_SRCS vlmc.cpp )
LIST( APPEND VLMC_SRCS Main/vlmc.cpp )
ENDIF(WIN32)
SET (VLMC_HDRS
Commands/KeyboardShortcutHelper.h
Settings/SettingsManager.h
Settings/SettingValue.h
Library/Library.h
......@@ -123,6 +120,7 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake ${CMAKE_CURRENT_BINARY_D
#Add GUI stuff if required
IF (NOT WITH_GUI)
LIST (APPEND VLMC_SRCS Main/main.cpp )
ADD_EXECUTABLE(vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_RCC_SRCS})
TARGET_LINK_LIBRARIES(vlmc
${QT_QTCORE_LIBRARY}
......@@ -135,6 +133,8 @@ IF (NOT WITH_GUI)
ELSE(NOT WITH_GUI)
LIST( APPEND VLMC_SRCS
Commands/KeyboardShortcutHelper.cpp
Main/guimain.cpp
Gui/About.cpp
Gui/AudioSpectrumDrawer.cpp
Gui/ClickableLabel.cpp
......@@ -184,6 +184,7 @@ ELSE(NOT WITH_GUI)
)
LIST( APPEND VLMC_HDRS
Commands/KeyboardShortcutHelper.h
Gui/About.h
Gui/ClickableLabel.h
Gui/ClipProperty.h
......
......@@ -21,16 +21,26 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QUndoCommand>
#include "config.h"
#include "Clip.h"
#include "Commands.h"
#include "UndoStack.h"
#include "MainWorkflow.h"
#include "Clip.h"
#ifdef WITH_GUI
# include "UndoStack.h"
void Commands::trigger( QUndoCommand* command )
{
UndoStack::getInstance()->push( command );
}
#else
void Commands::trigger( Commands::Generic* command )
{
command->redo();
}
#endif
Commands::MainWorkflow::AddClip::AddClip( Clip* clip,
unsigned int trackNumber, qint64 pos,
......
......@@ -24,18 +24,37 @@
#ifndef COMMANDS_H
#define COMMANDS_H
#include <QUndoCommand>
#include "config.h"
#ifdef WITH_GUI
# include <QUndoCommand>
#endif
#include <QObject>
#include <QVector>
#include "MainWorkflow.h"
class Clip;
#define NEW_COMMAND(x) class x : public QUndoCommand
#define NEW_COMMAND(x) class x : public Generic
namespace Commands
{
#ifdef WITH_GUI
class Generic : public QUndoCommand
#else
class Generic
#endif
{
public:
virtual void redo() = 0;
virtual void undo() = 0;
void setText( const QString& ) {}
};
#ifdef WITH_GUI
void trigger( QUndoCommand* command );
#else
void trigger( Generic* command );
#endif
namespace MainWorkflow
{
......
/*****************************************************************************
* winvlmc.cpp: VLMC launcher for win32
* main.cpp: VLMC main for non GUI mode
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -20,23 +20,33 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <windows.h>
#include "config.h"
#include "ProjectManager.h"
int VLMCmain( int, char** );
#include <QCoreApplication>
LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo)
/**
* VLMC Entry point
* \brief this is the VLMC entry point
* \param argc
* \param argv
* \return Return value of vlmc
*/
int
VLMCmain( int argc, char **argv )
{
if(IsDebuggerPresent())
QCoreApplication app( argc, argv );
app.setApplicationName( "vlmc" );
app.setOrganizationName( "vlmc" );
app.setOrganizationDomain( "vlmc.org" );
app.setApplicationVersion( PROJECT_VERSION );
if ( argc < 2 )
{
//If a debugger is present, pass the exception to the debugger with EXCEPTION_CONTINUE_SEARCH
return EXCEPTION_CONTINUE_SEARCH;
qCritical() << "You must provide a project file to render.";
return 1;
}
//TODO: get backtrace
//TODO: relaunch ?
return 0;
ProjectManager::getInstance()->loadProject( argv[1] );
return app.exec();
}
int main( int argc, char **argv )
{
return VLMCmain( argc, argv );
}
/*****************************************************************************
* main.cpp: VLMC main
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/** \file
* This file contain the main function.
* It will initialize the QT application,
* and start it.
*/
#include "config.h"
#include "MainWindow.h"
#include "ProjectManager.h"
#include <QFile>
#include <QApplication>
#include <QColor>
#include <QPalette>
#include <QSettings>
#include <QKeySequence>
#define EXPAND( x ) #x
#define STRINGIFY( x ) EXPAND( x )
/**
* VLMC Entry point
* \brief this is the VLMC entry point
* \param argc
* \param argv
* \return Return value of vlmc
*/
int
VLMCmain( int argc, char **argv )
{
QApplication app( argc, argv );
app.setApplicationName( "vlmc" );
app.setOrganizationName( "vlmc" );
app.setOrganizationDomain( "vlmc.org" );
app.setApplicationVersion( PROJECT_VERSION );
//QSettings::setDefaultFormat( QSettings::IniFormat );
//Preferences::changeLang( QSettings().value( "Lang" ).toString() );
#ifdef Q_OS_WIN
QFile css(":/styles/windows");
if ( css.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
QString styleSheet = css.readAll();
if ( styleSheet != "" )
app.setStyleSheet( styleSheet );
}
#endif
// Creating the color palette
QPalette p;
p.setColor( QPalette::WindowText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::Button, QColor( 104, 103, 103, 255 ) );
p.setColor( QPalette::Light, QColor( 156, 155, 155, 255 ) );
p.setColor( QPalette::Midlight, QColor( 130, 129, 129, 255 ) );
p.setColor( QPalette::Dark, QColor( 52, 51, 51, 255 ) );
p.setColor( QPalette::Mid, QColor( 69, 68, 68, 255 ) );
p.setColor( QPalette::Text, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::BrightText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::ButtonText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::Base, QColor( 104, 103, 103, 255 ) );
p.setColor( QPalette::Window, QColor( 73, 72, 72, 255 ) );
p.setColor( QPalette::Shadow, QColor( 0, 0, 0, 255 ) );
p.setColor( QPalette::AlternateBase, QColor( 52, 51, 51, 255 ) );
p.setColor( QPalette::ToolTipBase, QColor( 255, 255, 220, 255 ) );
p.setColor( QPalette::ToolTipText, QColor( 0, 0, 0, 255 ) );
p.setColor( QPalette::WindowText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::WindowText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::WindowText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::WindowText, QColor( 255, 255, 255, 255 ) );
p.setColor( QPalette::Link, QColor( 177, 202, 0, 255 ) );
p.setColor( QPalette::LinkVisited, QColor( 177, 202, 0, 255 ) );
app.setPalette( p );
MainWindow w;
if ( argc > 1 )
ProjectManager::getInstance()->loadProject( argv[argc - 1] );
w.show();
return app.exec();
}
/*****************************************************************************
* vlmc.cpp: VLMC launcher for unix
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "config.h"
#include <QtDebug>
#include <sys/wait.h>
#include <unistd.h>
int VLMCmain( int , char** );
int main( int argc, char **argv )
{
#ifdef WITH_CRASHHANDLER
while ( true )
{
pid_t pid = fork();
if ( pid < 0 )
qFatal("Can't fork to launch VLMC. Exiting.");
if ( pid == 0 )
return VLMCmain( argc, argv );
else
{
int status;
wait( &status );
if ( WIFEXITED(status) )
{
int ret = WEXITSTATUS( status );
if ( ret == 2 )
continue ;
else
break ;
}
else
{
qCritical() << "Unhandled crash.";
break ;
}
}
}
#else
return VLMCmain( argc, argv );
#endif
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment