Commit a54e9342 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Adding What is interesting QML port by Artem Fedoskin. Still crashing so there...

Adding What is interesting QML port by Artem Fedoskin. Still crashing so there is a lot of work to be done stability wise.
REVIEW:127116
CCMAIL:kstars-devel@kde.org
parent 6b119f87
......@@ -16,8 +16,8 @@ find_package(ECM 1.7.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
#find_package(Qt5 5.2 REQUIRED COMPONENTS Gui Qml Quick Xml Sql Svg PrintSupport)
find_package(Qt5 5.2 REQUIRED COMPONENTS Gui Xml Sql Svg PrintSupport)
find_package(Qt5 5.2 REQUIRED COMPONENTS Gui Qml Quick Xml Sql Svg PrintSupport)
#find_package(Qt5 5.2 REQUIRED COMPONENTS Gui Xml Sql Svg PrintSupport)
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)
......@@ -39,6 +39,8 @@ find_package(KF5 REQUIRED COMPONENTS
IconThemes
)
#message("KF5 Version is ${KF5_VERSION}")
find_package(Eigen3 REQUIRED)
add_definitions(${EIGEN_DEFINITIONS})
include_directories(${EIGEN3_INCLUDE_DIR})
......
add_subdirectory( data )
add_subdirectory( icons )
add_subdirectory( htmesh )
#FIXME Port to QML2
#add_subdirectory( tools/whatsinteresting/qml)
if (${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0)
add_subdirectory( tools/whatsinteresting/qml)
endif()
Find_package(ZLIB REQUIRED)
Find_package(Threads REQUIRED)
......@@ -184,16 +186,6 @@ set(libkstarstools_SRCS
tools/flagmanager.cpp
tools/horizonmanager.cpp
#FIXME Port to QML2
#tools/whatsinteresting/skyobjlistmodel.cpp
#tools/whatsinteresting/wiview.cpp
#tools/whatsinteresting/modelmanager.cpp
#tools/whatsinteresting/skyobjitem.cpp
#tools/whatsinteresting/wilpsettings.cpp
#tools/whatsinteresting/wiequipsettings.cpp
#tools/whatsinteresting/obsconditions.cpp
#tools/whatsinteresting/skyobjdescription.cpp
#FIXME Port to KF5
#tools/moonphasetool.cpp
......@@ -203,6 +195,20 @@ set(libkstarstools_SRCS
tools/starhopperdialog.cpp
)
if (${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0)
set(libkstarstools_SRCS
${libkstarstools_SRCS}
tools/whatsinteresting/skyobjlistmodel.cpp
tools/whatsinteresting/wiview.cpp
tools/whatsinteresting/modelmanager.cpp
tools/whatsinteresting/skyobjitem.cpp
tools/whatsinteresting/wilpsettings.cpp
tools/whatsinteresting/wiequipsettings.cpp
tools/whatsinteresting/obsconditions.cpp
tools/whatsinteresting/skyobjdescription.cpp
)
endif()
ki18n_wrap_ui(libkstarstools_SRCS
tools/altvstime.ui
tools/argchangeviewoption.ui
......@@ -242,13 +248,17 @@ ki18n_wrap_ui(libkstarstools_SRCS
tools/scriptnamedialog.ui
tools/skycalendar.ui
tools/wutdialog.ui
tools/flagmanager.ui
tools/whatsinteresting/wilpsettings.ui
tools/whatsinteresting/wiequipsettings.ui
tools/flagmanager.ui
tools/starhopperdialog.ui
tools/horizonmanager.ui
)
if (${KF5_VERSION} VERSION_EQUAL 5.18.0 OR ${KF5_VERSION} VERSION_GREATER 5.18.0)
ki18n_wrap_ui(libkstarstools_SRCS
tools/whatsinteresting/wilpsettings.ui
tools/whatsinteresting/wiequipsettings.ui
)
endif()
set(libkstarscomponents_SRCS
skycomponents/skylabeler.cpp
......@@ -554,8 +564,8 @@ target_link_libraries(KStarsLib
Qt5::PrintSupport
Qt5::Sql
Qt5::Svg
#Qt5::Qml
#Qt5::Quick
Qt5::Qml
Qt5::Quick
${ZLIB_LIBRARIES}
)
......
......@@ -63,9 +63,9 @@ KStars::KStars( bool doSplash, bool clockrun, const QString &startdate )
m_AstroCalc(0), m_AltVsTime(0), m_SkyCalendar(0), m_ScriptBuilder(0),
m_PlanetViewer(0), m_WUTDialog(0), m_JMoonTool(0), m_MoonPhaseTool(0), m_FlagManager(0), m_HorizonManager(0), m_EyepieceView(0),
//FIXME Port to QML2
#if 0
//#if 0
m_WIView(0), m_ObsConditions(0), m_wiDock(0),
#endif
//#endif
DialogIsObsolete(false), StartClockRunning( clockrun ),
StartDateString( startdate )
{
......@@ -359,12 +359,12 @@ void KStars::selectPreviousFov()
}
//FIXME Port to QML2
#if 0
//#if 0
void KStars::showWISettingsUI()
{
slotWISettings();
}
#endif
//#endif
void KStars::updateTime( const bool automaticDSTchange ) {
// Due to frequently use of this function save data and map pointers for speedup.
......
......@@ -500,13 +500,13 @@ private slots:
void slotWUT();
//FIXME Port to QML2
#if 0
//#if 0
/** action slot: open What's Interesting settings window */
void slotWISettings();
/** action slot: open What's Interesting window */
void slotShowWIView(int status);
#endif
//#endif
/** action slot: open Sky Calendar tool */
void slotCalendar();
......@@ -682,13 +682,13 @@ private:
#endif
// FIXME Port to QML2
#if 0
//#if 0
WIView *m_WIView;
WILPSettings *m_WISettings;
WIEquipSettings *m_WIEquipmentSettings;
ObsConditions *m_ObsConditions;
QDockWidget *m_wiDock;
#endif
//#endif
QActionGroup *projectionGroup, *cschemeGroup;
......
......@@ -30,8 +30,8 @@
#include <QDockWidget>
#include <QPointer>
#include <QInputDialog>
//#include <QQuickWindow>
//#include <QQuickView>
#include <QQuickWindow>
#include <QQuickView>
#include <QDebug>
#include <QAction>
#include <QFileDialog>
......@@ -82,11 +82,11 @@
#include "tools/eyepiecefield.h"
//FIXME Port to QML2
#if 0
//#if 0
#include "tools/whatsinteresting/wiview.h"
#include "tools/whatsinteresting/wilpsettings.h"
#include "tools/whatsinteresting/wiequipsettings.h"
#endif
//#endif
#include "tools/skycalendar.h"
#include "tools/scriptbuilder.h"
......@@ -412,7 +412,7 @@ void KStars::slotWUT() {
}
//FIXME Port to QML2
#if 0
//#if 0
void KStars::slotWISettings()
{
if (m_WIView && !m_wiDock->isVisible())
......@@ -487,7 +487,7 @@ void KStars::slotShowWIView(int status)
}
}
#endif
//#endif
void KStars::slotCalendar() {
if ( ! m_SkyCalendar ) m_SkyCalendar = new SkyCalendar(this);
......
......@@ -390,11 +390,11 @@ void KStars::initActions() {
<< QKeySequence(Qt::CTRL+Qt::Key_U );
//FIXME Port to QML2
#if 0
//#if 0
actionCollection()->addAction("whats_interesting", this, SLOT( slotWISettings() ) )
<< i18n("What's Interesting...")
<< QKeySequence(Qt::CTRL+Qt::Key_W );
#endif
//#endif
actionCollection()->addAction("skycalendar", this, SLOT( slotCalendar() ) )
<< i18n("Sky Calendar");
......
#install_files
install( FILES wiview.qml ScrollBar.qml
install( FILES wiview.qml
CategoryTitle.qml
DetailsItem.qml
leftArrow.png
settingsIcon.png
reloadIcon.png
......
import QtQuick 2.5
Text {
property string title
property color activeColor:"#e4800d"
property color disabledColor:"#6b6660"
id: categoryTitle
color: activeColor
text: title
anchors.centerIn: parent
font {
family: "Cantarell"
pixelSize: 16
bold: false
}
renderType: Text.NativeRendering
states: [
State {
name: "selected"
PropertyChanges {
target: categoryTitle
font {
pixelSize: 21
bold: true
}
}
},
State {
name: "selectedNoBold"
PropertyChanges {
target: categoryTitle
font {
pixelSize: 21
bold: false
}
}
},
State {
name: ""
PropertyChanges {
target: categoryTitle
font {
pixelSize: 16
bold: false
}
}
}
]
Behavior on font.pixelSize {
NumberAnimation {
duration: 150
}
}
}
import QtQuick 2.5
Text {
width: 164
height: 21
color: "#ffffff"
anchors.left: parent.left
anchors.leftMargin: 8
font{
pixelSize: 13
family: "Cantarell"
}
verticalAlignment: Text.AlignVCenter
}
......@@ -79,6 +79,8 @@ QVariant SkyObjItem::data(int role)
}
}
///Moved to skyobjlistmodel.cpp
/*
QHash<int, QByteArray> SkyObjItem::roleNames() const
{
QHash<int, QByteArray> roles;
......@@ -87,6 +89,7 @@ QHash<int, QByteArray> SkyObjItem::roleNames() const
roles[CategoryNameRole] = "typeName";
return roles;
}
*/
void SkyObjItem::setPosition(SkyObject* so)
{
......
......@@ -60,12 +60,6 @@ public:
*/
QVariant data(int role);
/**
* \brief Create and return a QHash<int, QByteArray> of rolenames for the SkyObjItem.
* \return QHash<int, QByteArray> of rolenames for the SkyObjItem.
*/
QHash<int, QByteArray> roleNames() const;
/**
* \brief Get name of sky-object associated with the SkyObjItem.
* \return Name of sky-object associated with the SkyObjItem as a QString
......
......@@ -20,9 +20,19 @@
SkyObjListModel::SkyObjListModel(SkyObjItem *soitem, QObject *parent): QAbstractListModel(parent)
{
//FIXME Needs porting to KF5
//Fixed in roleNames(). setRoleNames is not a member of QAbstractListModel anymore
//setRoleNames(soitem->roleNames());
}
QHash<int, QByteArray> SkyObjListModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[SkyObjItem::DispNameRole] = "dispName";
roles[SkyObjItem::CategoryRole] = "type";
roles[SkyObjItem::CategoryNameRole] = "typeName";
return roles;
}
void SkyObjListModel::addSkyObject(SkyObjItem *soitem)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
......
......@@ -42,6 +42,12 @@ public:
*/
void addSkyObject(SkyObjItem *sobj);
/**
* \brief Create and return a QHash<int, QByteArray> of rolenames for the SkyObjItem.
* \return QHash<int, QByteArray> of rolenames for the SkyObjItem.
*/
QHash<int, QByteArray> roleNames() const;
/**
* \brief Overridden method from QAbstractItemModel.
* \return The number of items in the sky-object list model.
......
......@@ -23,6 +23,8 @@
#include "wiview.h"
#include "skymap.h"
#include "dialogs/detaildialog.h"
#include <klocalizedcontext.h>
WIView::WIView(QWidget *parent, ObsConditions *obs) : QWidget(parent), m_Obs(obs), m_CurCategorySelected(-1)
{
......@@ -38,7 +40,10 @@ WIView::WIView(QWidget *parent, ObsConditions *obs) : QWidget(parent), m_Obs(obs
m_Ctxt = m_BaseView->rootContext();
m_BaseView->setSource(QStandardPaths::locate(QStandardPaths::DataLocation, "tools/whatsinteresting/qml/wiview.qml"));
///Use instead of KDeclarative
m_Ctxt->setContextObject(new KLocalizedContext(m_BaseView));
m_BaseView->setSource(QStandardPaths::locate(QStandardPaths::AppDataLocation, "tools/whatsinteresting/qml/wiview.qml"));
m_BaseObj = m_BaseView->rootObject();
......
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