mirror of https://github.com/cutefishos/appmotor
parent
9280739c51
commit
e8a7e61897
@ -0,0 +1,43 @@
|
|||||||
|
# Set sources
|
||||||
|
set(SRC main.cpp mainpage.cpp multiwindowcontent.cpp)
|
||||||
|
|
||||||
|
# Set moc headers
|
||||||
|
set(MOC_HDRS mainpage.h multiwindowcontent.h)
|
||||||
|
qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
|
||||||
|
|
||||||
|
link_libraries(${MEEGOTOUCH_LIBRARIES})
|
||||||
|
|
||||||
|
# Use the compiler and linker flags given in meegotouch-boostable.pc
|
||||||
|
# in the source tree.
|
||||||
|
execute_process(COMMAND "env"
|
||||||
|
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
|
||||||
|
"/usr/bin/pkg-config"
|
||||||
|
"--cflags"
|
||||||
|
"meegotouch-boostable"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE booster_cxxflags
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(COMMAND "env"
|
||||||
|
"PKG_CONFIG_PATH=${CMAKE_SOURCE_DIR}/data/pkgconfig"
|
||||||
|
"/usr/bin/pkg-config" "--libs"
|
||||||
|
"meegotouch-boostable"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE booster_libs
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${booster_cxxflags}")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS ${booster_libs})
|
||||||
|
|
||||||
|
# Enable Qt-support
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
|
||||||
|
|
||||||
|
# Enable Qt-support
|
||||||
|
include(${QT_USE_FILE})
|
||||||
|
|
||||||
|
set(NAME fala_multi-window)
|
||||||
|
|
||||||
|
add_executable(${NAME} ${SRC} ${MOC_SRC})
|
||||||
|
|
||||||
|
# Install
|
||||||
|
install(PROGRAMS ${NAME} DESTINATION /usr/bin)
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
README
|
||||||
|
------
|
||||||
|
|
||||||
|
Multiwindow test application.
|
||||||
|
|
||||||
|
Command to launch application
|
||||||
|
|
||||||
|
invoker --type=m /usr/bin/fala_multi-window [-window-not-from-cache]
|
||||||
|
|
||||||
|
Application can be started with the switch "-output-level debug" to get information what happens inside it.
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
TARGET = fala_multi-window
|
||||||
|
target.path = /usr/bin
|
||||||
|
OBJECTS_DIR = ./.obj
|
||||||
|
MOC_DIR = ./.moc
|
||||||
|
DEPENDPATH += $$INCLUDEPATH
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
CONFIG += meegotouch-boostable
|
||||||
|
|
||||||
|
SOURCES += main.cpp \
|
||||||
|
mainpage.cpp \
|
||||||
|
multiwindowcontent.cpp
|
||||||
|
|
||||||
|
HEADERS += mainpage.h \
|
||||||
|
multiwindowcontent.h
|
||||||
|
|
||||||
|
# Install instructions
|
||||||
|
INSTALLS += target
|
||||||
|
|
||||||
|
|
||||||
|
DEFINES += HAVE_MCOMPONENTCACHE
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applifed.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "multiwindowcontent.h"
|
||||||
|
#include <QString>
|
||||||
|
#include <MApplication>
|
||||||
|
|
||||||
|
#ifdef HAVE_MCOMPONENTCACHE
|
||||||
|
#include <mcomponentcache.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
M_EXPORT int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MCOMPONENTCACHE
|
||||||
|
MApplication *app = MComponentCache::mApplication(argc, argv);
|
||||||
|
|
||||||
|
bool bWindowNotFromCache = false;
|
||||||
|
const QString sWindowNotFromCache = "window-not-from-cache";
|
||||||
|
|
||||||
|
for (int i = 1; i < argc; i++) {
|
||||||
|
QString sArg = QString(argv[i]);
|
||||||
|
if (sArg.contains(sWindowNotFromCache,Qt::CaseInsensitive)) {
|
||||||
|
bWindowNotFromCache = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bWindowNotFromCache) {
|
||||||
|
MultiWindowContent mwContent(false);
|
||||||
|
mwContent.createWindows();
|
||||||
|
mwContent.activateWindow(1);
|
||||||
|
} else {
|
||||||
|
MultiWindowContent mwContent(true);
|
||||||
|
mwContent.createWindows();
|
||||||
|
mwContent.activateWindow(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
MApplication *app = new MApplication(argc, argv);
|
||||||
|
MultiWindowContent mwContent(false);
|
||||||
|
mwContent.createWindows();
|
||||||
|
mwContent.activateWindow(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return app->exec();
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applifed.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <MLayout>
|
||||||
|
#include <MLabel>
|
||||||
|
#include <MGridLayoutPolicy>
|
||||||
|
#include <MDebug>
|
||||||
|
|
||||||
|
#include "mainpage.h"
|
||||||
|
|
||||||
|
MainPage::MainPage(QString windowName) :
|
||||||
|
m_windowName(windowName)
|
||||||
|
{
|
||||||
|
setTitle(windowName);
|
||||||
|
|
||||||
|
m_layout = new MLayout(centralWidget());
|
||||||
|
m_policy = new MGridLayoutPolicy(m_layout);
|
||||||
|
m_policy->setSpacing(20.0);
|
||||||
|
|
||||||
|
m_label = new MLabel(m_windowName);
|
||||||
|
m_label->setAlignment(Qt::AlignCenter);
|
||||||
|
m_policy->addItem(m_label, 0, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MainPage::~MainPage()
|
||||||
|
{
|
||||||
|
delete m_policy;
|
||||||
|
m_policy = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainPage::createContent()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applifed.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAINPAGE_H
|
||||||
|
#define MAINPAGE_H
|
||||||
|
|
||||||
|
#include <MApplicationPage>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class MLabel;
|
||||||
|
class MLayout;
|
||||||
|
class MGridLayoutPolicy;
|
||||||
|
|
||||||
|
class MainPage : public MApplicationPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainPage(QString windowName);
|
||||||
|
virtual ~MainPage();
|
||||||
|
virtual void createContent();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_windowName;
|
||||||
|
MLabel * m_label;
|
||||||
|
MLayout * m_layout;
|
||||||
|
MGridLayoutPolicy * m_policy;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINPAGE_H
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applifed.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "multiwindowcontent.h"
|
||||||
|
#include "mainpage.h"
|
||||||
|
|
||||||
|
#include <MDebug>
|
||||||
|
#include <MApplicationWindow>
|
||||||
|
|
||||||
|
#ifdef HAVE_MCOMPONENTCACHE
|
||||||
|
#include <mcomponentcache.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
MultiWindowContent::MultiWindowContent(bool windowFromCache):
|
||||||
|
m_windowFromCache(windowFromCache)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultiWindowContent::createWindows()
|
||||||
|
{
|
||||||
|
// Create windows
|
||||||
|
for (int i = 0; i < NUM_WINDOWS; i++) {
|
||||||
|
#ifdef HAVE_MCOMPONENTCACHE
|
||||||
|
m_window[i] = m_windowFromCache? MComponentCache::mApplicationWindow() : new MApplicationWindow;
|
||||||
|
#else
|
||||||
|
m_window[i] = new MApplicationWindow;
|
||||||
|
#endif
|
||||||
|
m_window[i]->setWindowTitle(QString("Window %1").arg(i + 1));
|
||||||
|
m_window[i]->setObjectName(QString("Window %1").arg(i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create pages
|
||||||
|
for (int i = 0; i < NUM_WINDOWS; i++)
|
||||||
|
m_mainPage[i] = new MainPage(QString("Window %1").arg(i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MultiWindowContent::activateWindow(int index)
|
||||||
|
{
|
||||||
|
index--;
|
||||||
|
if (index >= 0 && index < NUM_WINDOWS) {
|
||||||
|
|
||||||
|
// Show the desired window
|
||||||
|
m_window[index]->show();
|
||||||
|
m_window[index]->activateWindow();
|
||||||
|
m_window[index]->raise();
|
||||||
|
|
||||||
|
m_mainPage[index]->appear(m_window[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MultiWindowContent::~MultiWindowContent()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (directui@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of applifed.
|
||||||
|
**
|
||||||
|
** If you have questions regarding the use of this file, please contact
|
||||||
|
** Nokia at directui@nokia.com.
|
||||||
|
**
|
||||||
|
** This library is free software; you can redistribute it and/or
|
||||||
|
** modify it under the terms of the GNU Lesser General Public
|
||||||
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
|
** and appearing in the file LICENSE.LGPL included in the packaging
|
||||||
|
** of this file.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MULTIWINDOWCONTENT_H
|
||||||
|
#define MULTIWINDOWCONTENT_H
|
||||||
|
|
||||||
|
#include <MApplicationWindow>
|
||||||
|
|
||||||
|
#include "mainpage.h"
|
||||||
|
|
||||||
|
class MultiWindowContent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static const int NUM_WINDOWS = 3;
|
||||||
|
|
||||||
|
MultiWindowContent(bool windowFromCache);
|
||||||
|
virtual ~MultiWindowContent();
|
||||||
|
void activateWindow(int index);
|
||||||
|
|
||||||
|
void createWindows();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MApplicationWindow *m_window[NUM_WINDOWS];
|
||||||
|
MainPage *m_mainPage[NUM_WINDOWS];
|
||||||
|
bool m_windowFromCache;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MULTIWINDOWCONTENT_H
|
||||||
Loading…
Reference in New Issue