Added CMake magic for plugin infrastructure.

Added ViewManager.
Added dummy Settings class.
Added dummy plugin interface (UI plugins only).
Added dummy greeting plugin.
Added DLLEXPORT macros for UI plugin interface and plugins.
This commit is contained in:
Teo Mrnjavac 2014-06-11 13:37:10 +02:00
parent bfc5316c56
commit 6899b1f0fa
26 changed files with 777 additions and 131 deletions

View File

@ -58,6 +58,11 @@ configure_file(
IMMEDIATE @ONLY
)
# Early configure these files as we need them later on
configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" @ONLY )
file( COPY CalamaresAddPlugin.cmake DESTINATION "${PROJECT_BINARY_DIR}" )
file( COPY CalamaresAddLibrary.cmake DESTINATION "${PROJECT_BINARY_DIR}" )
set( CALAMARES_LIBRARIES calamareslib )
add_subdirectory( src )

112
CalamaresAddLibrary.cmake Normal file
View File

@ -0,0 +1,112 @@
include( CMakeParseArguments )
function(calamares_add_library)
# parse arguments (name needs to be saved before passing ARGN into the macro)
set(NAME ${ARGV0})
set(options NO_INSTALL NO_VERSION)
set(oneValueArgs NAME TYPE EXPORT_MACRO TARGET TARGET_TYPE EXPORT VERSION SOVERSION INSTALL_BINDIR)
set(multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS QT5_MODULES)
cmake_parse_arguments(LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(LIBRARY_NAME ${NAME})
# message("*** Arguments for ${LIBRARY_NAME}")
# message("Sources: ${LIBRARY_SOURCES}")
# message("Link libraries: ${LIBRARY_LINK_LIBRARIES}")
# message("UI: ${LIBRARY_UI}")
# message("TARGET_TYPE: ${LIBRARY_TARGET_TYPE}")
# message("EXPORT_MACRO: ${LIBRARY_EXPORT_MACRO}")
# message("NO_INSTALL: ${LIBRARY_NO_INSTALL}")
set(target ${LIBRARY_NAME})
# qt stuff
include_directories(${CMAKE_CURRENT_LIST_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(LIBRARY_UI)
qt_wrap_ui(LIBRARY_UI_SOURCES ${LIBRARY_UI})
list(APPEND LIBRARY_SOURCES ${LIBRARY_UI_SOURCES})
endif()
# add resources from current dir
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/resources.qrc")
qt_add_resources(LIBRARY_RC_SOURCES "resources.qrc")
list(APPEND LIBRARY_SOURCES ${LIBRARY_RC_SOURCES})
unset(LIBRARY_RC_SOURCES)
endif()
# add target
if(LIBRARY_TARGET_TYPE STREQUAL "STATIC")
add_library(${target} STATIC ${LIBRARY_SOURCES})
elseif(LIBRARY_TARGET_TYPE STREQUAL "MODULE")
add_library(${target} MODULE ${LIBRARY_SOURCES})
else() # default
add_library(${target} SHARED ${LIBRARY_SOURCES})
endif()
# HACK: add qt modules - every lib should define its own set of modules
qt5_use_modules(${target} Core Gui Widgets ${LIBRARY_QT5_MODULES})
# definitions - can this be moved into set_target_properties below?
add_definitions(${QT_DEFINITIONS})
set_target_properties(${target} PROPERTIES AUTOMOC TRUE)
if(LIBRARY_EXPORT_MACRO)
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${LIBRARY_EXPORT_MACRO})
endif()
if(LIBRARY_COMPILE_DEFINITIONS)
# Dear CMake, i hate you! Sincerely, domme
# At least in CMake 2.8.8, you CANNOT set more than one COMPILE_DEFINITIONS value
# only takes the first one if called multiple times or bails out with wrong number of arguments
# when passing in a list, thus i redefine the export macro here in hope it won't mess up other targets
add_definitions( "-D${LIBRARY_EXPORT_MACRO}" )
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS ${LIBRARY_COMPILE_DEFINITIONS})
endif()
# add link targets
target_link_libraries(${target} ${CALAMARES_LIBRARIES})
if(LIBRARY_LINK_LIBRARIES)
target_link_libraries(${target} ${LIBRARY_LINK_LIBRARIES})
endif()
if(LIBRARY_LINK_PRIVATE_LIBRARIES)
target_link_libraries(${target} LINK_PRIVATE ${LIBRARY_LINK_PRIVATE_LIBRARIES})
endif()
# add soversion
if(NOT LIBRARY_NO_VERSION)
set_target_properties(${target} PROPERTIES VERSION ${LIBRARY_VERSION})
if(NOT LIBRARY_SOVERSION)
set(LIBRARY_SOVERSION ${LIBRARY_VERSION})
endif()
set_target_properties(${target} PROPERTIES SOVERSION ${LIBRARY_SOVERSION})
endif()
if(NOT LIBRARY_INSTALL_BINDIR)
set(LIBRARY_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
endif()
# make installation optional, maybe useful for dummy plugins one day
if(NOT LIBRARY_NO_INSTALL)
include(GNUInstallDirs)
if(NOT LIBRARY_EXPORT)
install( TARGETS ${target}
RUNTIME DESTINATION ${LIBRARY_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
install( TARGETS ${target}
EXPORT ${LIBRARY_EXPORT}
RUNTIME DESTINATION ${LIBRARY_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()
endif()
endfunction()

55
CalamaresAddPlugin.cmake Normal file
View File

@ -0,0 +1,55 @@
include( CMakeParseArguments )
include( ${CALAMARES_CMAKE_DIR}/CalamaresAddLibrary.cmake )
function(calamares_add_plugin)
# parse arguments (name needs to be saved before passing ARGN into the macro)
set(NAME ${ARGV0})
set(options NO_INSTALL SHARED_LIB)
set(oneValueArgs NAME TYPE EXPORT_MACRO)
set(multiValueArgs SOURCES UI LINK_LIBRARIES COMPILE_DEFINITIONS)
cmake_parse_arguments(PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(PLUGIN_NAME ${NAME})
# message("*** Arguments for ${PLUGIN_NAME}")
# message("Sources: ${PLUGIN_SOURCES}")
# message("Link libraries: ${PLUGIN_LINK_LIBRARIES}")
# message("UI: ${PLUGIN_UI}")
# message("TYPE: ${PLUGIN_TYPE}")
# message("EXPORT_MACRO: ${PLUGIN_EXPORT_MACRO}")
# message("NO_INSTALL: ${PLUGIN_NO_INSTALL}")
# create target name once for convenience
set(target "calamares_${PLUGIN_TYPE}_${PLUGIN_NAME}")
# determine target type
if(NOT ${PLUGIN_SHARED_LIB})
set(target_type "MODULE")
else()
set(target_type "SHARED")
endif()
list(APPEND calamares_add_library_args
"${target}"
"EXPORT_MACRO" "${PLUGIN_EXPORT_MACRO}"
"TARGET_TYPE" "${target_type}"
"SOURCES" "${PLUGIN_SOURCES}"
)
if(PLUGIN_UI)
list(APPEND calamares_add_library_args "UI" "${PLUGIN_UI}")
endif()
if(PLUGIN_LINK_LIBRARIES)
list(APPEND calamares_add_library_args "LINK_LIBRARIES" "${PLUGIN_LINK_LIBRARIES}")
endif()
if(PLUGIN_COMPILE_DEFINITIONS)
list(APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS})
endif()
list(APPEND calamares_add_library_args "NO_VERSION")
list(APPEND calamares_add_library_args "INSTALL_BINDIR" "${CMAKE_INSTALL_LIBDIR}")
calamares_add_library(${calamares_add_library_args})
endfunction()

View File

@ -18,4 +18,4 @@ include("${CALAMARES_CMAKE_DIR}/CalamaresLibraryDepends.cmake")
# These are IMPORTED targets created by CalamaresLibraryDepends.cmake
set(CALAMARES_LIBRARIES calamareslib)
#set(CALAMARES_USE_FILE "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake")
set(CALAMARES_USE_FILE "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake")

10
CalamaresUse.cmake.in Normal file
View File

@ -0,0 +1,10 @@
#FIXME: this duplicates top level cmakelists: how can we reduce code duplication?
find_package( Qt5 5.3.0 CONFIG REQUIRED Core Gui Widgets LinguistTools )
if(NOT CALAMARES_CMAKE_DIR)
set(CALAMARES_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()
include( "${CALAMARES_CMAKE_DIR}/CalamaresAddLibrary.cmake" )
include( "${CALAMARES_CMAKE_DIR}/CalamaresAddPlugin.cmake" )

View File

@ -1,3 +1,5 @@
include( ${PROJECT_BINARY_DIR}/CalamaresUse.cmake )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libcalamares )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/libcalamares )
@ -9,3 +11,9 @@ add_subdirectory( libcalamares )
# application
add_subdirectory( calamares )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/calamares )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/calamares )
# plugins
add_subdirectory( modules )

View File

@ -8,6 +8,11 @@ set( calamaresSources
main.cpp
CalamaresApplication.cpp
CalamaresWindow.cpp
ViewManager.cpp
Settings.cpp
viewpages/PagePlugin.cpp
viewpages/AbstractPage.cpp
)
set( calamaresUi

View File

@ -18,8 +18,18 @@
#include "CalamaresWindow.h"
#include "ViewManager.h"
#include "QBoxLayout"
CalamaresWindow::CalamaresWindow( QWidget* parent )
: QWidget( parent )
{
setupUi( this );
//This should create a PageManager or ViewManager or whatever, which
//should control the sidebar, next/back buttons and QSW.
Calamares::ViewManager* vm = new Calamares::ViewManager( this );
layout()->addWidget( vm->widget() );
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>500</height>
<height>592</height>
</rect>
</property>
<property name="maximumSize">
@ -22,8 +22,8 @@
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QFrame" name="leftSidebar">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@ -98,7 +98,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../github/installer/ui/installer.qrc">:/Images/images/install.png</pixmap>
<pixmap>:/Images/images/install.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -540,133 +540,8 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>578</width>
<height>420</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="bottomMargin">
<number>8</number>
</property>
<item>
<widget class="QPushButton" name="abortButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Abort installation</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="previousButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string comment="Previous Page">Previous</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="nextButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string comment="Next Page">Next</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../github/installer/ui/installer.qrc"/>
<include location="../github/installer/ui/installer.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

32
src/calamares/DllMacro.h Normal file
View File

@ -0,0 +1,32 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UIDLLMACRO_H
#define UIDLLMACRO_H
#include <QtCore/qglobal.h>
#ifndef UIDLLEXPORT
# if defined (UIDLLEXPORT_PRO)
# define UIDLLEXPORT Q_DECL_EXPORT
# else
# define UIDLLEXPORT Q_DECL_IMPORT
# endif
#endif
#endif

View File

@ -0,0 +1,24 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Settings.h"
Settings::Settings( QObject* parent )
: QObject( parent )
{
}

39
src/calamares/Settings.h Normal file
View File

@ -0,0 +1,39 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QObject>
// Settings::instance() ?
class Settings : public QObject
{
Q_OBJECT
public:
explicit Settings( QObject *parent = 0 );
//TODO: load from JSON then emit ready
signals:
public slots:
};
#endif // SETTINGS_H

View File

@ -0,0 +1,82 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ViewManager.h"
#include <QBoxLayout>
namespace Calamares
{
ViewManager* ViewManager::s_instance = 0;
ViewManager*
ViewManager::instance()
{
return s_instance;
}
ViewManager::ViewManager( QObject* parent )
: QObject( parent )
, m_widget( new QWidget() )
{
s_instance = this;
QBoxLayout* mainLayout = new QVBoxLayout;
m_widget->setLayout( mainLayout );
m_stack = new QStackedWidget( m_widget );
mainLayout->addWidget( m_stack );
m_back = new QPushButton( tr( "&Back" ), m_widget );
m_next = new QPushButton( tr( "&Next" ), m_widget );
QBoxLayout* bottomLayout = new QHBoxLayout;
mainLayout->addLayout( bottomLayout );
bottomLayout->addStretch();
bottomLayout->addWidget( m_back );
bottomLayout->addWidget( m_next );
}
ViewManager::~ViewManager()
{
m_widget->deleteLater();
}
QWidget*
ViewManager::widget()
{
return m_widget;
}
void
ViewManager::next()
{
Q_ASSERT( 0 );
}
void
ViewManager::back()
{
Q_ASSERT( 0 );
}
}

View File

@ -0,0 +1,63 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VIEWMANAGER_H
#define VIEWMANAGER_H
#include "DllMacro.h"
#include "viewpages/PagePlugin.h"
#include <QPushButton>
#include <QStackedWidget>
namespace Calamares
{
class UIDLLEXPORT ViewManager : public QObject
{
Q_OBJECT
public:
static ViewManager* instance();
explicit ViewManager( QObject* parent = 0 );
virtual ~ViewManager();
QWidget* widget();
void addPagePlugin( PagePlugin* plugin );
void insertPage( AbstractPage* page );
void setNext( AbstractPage* page );
void removePage( AbstractPage* page );
public slots:
void next();
void back();
private:
static ViewManager* s_instance;
QWidget* m_widget;
QStackedWidget* m_stack;
QPushButton* m_back;
QPushButton* m_next;
};
}
#endif // VIEWMANAGER_H

View File

@ -0,0 +1,29 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AbstractPage.h"
namespace Calamares
{
AbstractPage::AbstractPage( QWidget* parent )
: QWidget( parent )
{
}
}

View File

@ -0,0 +1,43 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ABSTRACTPAGE_H
#define ABSTRACTPAGE_H
#include <QWidget>
#include "../DllMacro.h"
namespace Calamares
{
class UIDLLEXPORT AbstractPage : public QWidget
{
Q_OBJECT
public:
explicit AbstractPage(QWidget *parent = 0);
signals:
public slots:
};
}
#endif // ABSTRACTPAGE_H

View File

@ -0,0 +1,29 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PagePlugin.h"
namespace Calamares
{
PagePlugin::PagePlugin( QObject* parent )
: QObject( parent )
{
}
}

View File

@ -0,0 +1,46 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PAGEPLUGIN_H
#define PAGEPLUGIN_H
#include <QObject>
#include "../DllMacro.h"
namespace Calamares
{
class AbstractPage;
class UIDLLEXPORT PagePlugin : public QObject
{
Q_OBJECT
public:
explicit PagePlugin( QObject *parent = 0 );
signals:
void done();
};
}
Q_DECLARE_INTERFACE( Calamares::PagePlugin, "calamares.PagePlugin/1.0" )
#endif // PAGEPLUGIN_H

View File

@ -0,0 +1,32 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLUGINDLLMACRO_H
#define PLUGINDLLMACRO_H
#include <QtCore/qglobal.h>
#ifndef PLUGINDLLEXPORT
# if defined (PLUGINDLLEXPORT_PRO)
# define PLUGINDLLEXPORT Q_DECL_EXPORT
# else
# define PLUGINDLLEXPORT Q_DECL_IMPORT
# endif
#endif
#endif

View File

@ -0,0 +1,6 @@
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt")
add_subdirectory(${SUBDIRECTORY})
endif()
endforeach()

5
src/modules/README.md Normal file
View File

@ -0,0 +1,5 @@
Calamares modules directory
===
Calamares modules are plugins that implement the Calamares module API and can provide features like installer pages, batch jobs, etc.
To add a module, put it in a subdirectory and make sure it has a CMakeLists.txt, it should be picked up automatically by our CMake magic.

View File

@ -0,0 +1,12 @@
include_directories( ${PROJECT_BINARY_DIR}/src/calamares )
calamares_add_plugin( greeting
TYPE pageplugin
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
GreetingPagePlugin.cpp
GreetingPage.cpp
UI
LINK_LIBRARIES
${CALAMARES_LIBRARIES}
SHARED_LIB
)

View File

@ -0,0 +1,25 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GreetingPage.h"
GreetingPage::GreetingPage( QWidget* parent )
: AbstractPage( parent )
{
}

View File

@ -0,0 +1,36 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GREETINGPAGE_H
#define GREETINGPAGE_H
#include "viewpages/AbstractPage.h"
class GreetingPage : public Calamares::AbstractPage
{
Q_OBJECT
public:
explicit GreetingPage( QWidget* parent = 0 );
signals:
public slots:
};
#endif // GREETINGPAGE_H

View File

@ -0,0 +1,24 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GreetingPagePlugin.h"
GreetingPagePlugin::GreetingPagePlugin( QObject *parent )
: PagePlugin( parent )
{
}

View File

@ -0,0 +1,39 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GREETINGPAGEPLUGIN_H
#define GREETINGPAGEPLUGIN_H
#include <QObject>
#include "viewpages/PagePlugin.h"
#include "PluginDllMacro.h"
class PLUGINDLLEXPORT GreetingPagePlugin : public Calamares::PagePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA( IID "calamares.PagePlugin/1.0" )
//FILE "module.json" )
Q_INTERFACES( Calamares::PagePlugin )
public:
explicit GreetingPagePlugin(QObject *parent = 0);
};
#endif // GREETINGPAGEPLUGIN_H