Commit a46a0365 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Initial go at migrating whatisinteresting to Qt5

parent 62cf5aee
add_subdirectory( data )
add_subdirectory( icons )
add_subdirectory( htmesh )
#TODO Port to KF5
#add_subdirectory( tools/whatsinteresting/qml)
add_subdirectory( tools/whatsinteresting/qml)
Find_package(ZLIB REQUIRED)
Find_package(Threads REQUIRED)
......@@ -153,16 +152,16 @@ set(libkstarstools_SRCS
tools/scriptfunction.cpp
tools/skycalendar.cpp
tools/wutdialog.cpp
#FIXME Port to KF5
# 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
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
tools/flagmanager.cpp
#FIXME Port to KF5
# tools/moonphasetool.cpp
tools/starhopper.cpp
tools/eyepiecefield.cpp
......@@ -226,9 +225,8 @@ qt5_wrap_ui(libkstarstools_SRCS
tools/skycalendar.ui
tools/wutdialog.ui
tools/flagmanager.ui
#FIXME needs porting
# tools/whatsinteresting/wilpsettings.ui
# tools/whatsinteresting/wiequipsettings.ui
tools/whatsinteresting/wilpsettings.ui
tools/whatsinteresting/wiequipsettings.ui
)
......@@ -492,6 +490,8 @@ target_link_libraries(KStarsLib
Qt5::Sql
Qt5::Svg
Qt5::Multimedia
Qt5::Qml
Qt5::Quick
${ZLIB_LIBRARIES}
)
......
......@@ -30,7 +30,8 @@
#include <QDockWidget>
#include <QPointer>
#include <QInputDialog>
#include <QQuickWindow>
#include <QQuickView>
#include <QDebug>
#include <QAction>
#include <QFileDialog>
......@@ -39,17 +40,15 @@
#include <QProcess>
#include <QIcon>
#include <QTemporaryFile>
#include <QStandardPaths>
#include <QInputDialog>
#include <KActionCollection>
#include <KActionMenu>
#include <KToggleAction>
#include <KMessageBox>
#include <ktip.h>
#include <QStandardPaths>
#include <kconfigdialog.h>
#include <kinputdialog.h>
#include <KTipDialog>
#include <KConfigDialog>
#include <kns3/downloaddialog.h>
......@@ -80,10 +79,9 @@
#include "tools/astrocalc.h"
#include "tools/altvstime.h"
#include "tools/wutdialog.h"
//FIXME Port to KF5
//#include "tools/whatsinteresting/wiview.h"
//#include "tools/whatsinteresting/wilpsettings.h"
//#include "tools/whatsinteresting/wiequipsettings.h"
#include "tools/whatsinteresting/wiview.h"
#include "tools/whatsinteresting/wilpsettings.h"
#include "tools/whatsinteresting/wiequipsettings.h"
#include "tools/skycalendar.h"
#include "tools/scriptbuilder.h"
#include "tools/planetviewer.h"
......@@ -297,8 +295,6 @@ void KStars::slotWUT() {
void KStars::slotWISettings()
{
/*FIXME Port to KF5
*
if (wi && !wiDock->isVisible())
{
slotShowWIView(1);
......@@ -321,13 +317,11 @@ void KStars::slotWISettings()
dialog->addPage(wiLPSettings, xi18n("Light Pollution Settings"));
dialog->addPage(wiEquipSettings, xi18n("Equipment Settings - Equipment Type and Parameters"));
dialog->show();
*/
}
void KStars::slotShowWIView(int status)
{
#if 0
//FIXME Port to KF5
if (status == 0) return; //Cancelled
int bortle = Options::bortleClass();
......@@ -360,8 +354,9 @@ void KStars::slotShowWIView(int status)
wiDock = new QDockWidget(this);
wiDock->setObjectName("What's Interesting");
wiDock->setAllowedAreas(Qt::RightDockWidgetArea);
wiDock->setWidget(wi->getWIBaseView());
wiDock->setMinimumWidth(wi->getWIBaseView()->width());
QWidget *container = QWidget::createWindowContainer(wi->getWIBaseView());
wiDock->setWidget(container);
wiDock->setMinimumWidth(container->width());
addDockWidget(Qt::RightDockWidgetArea, wiDock);
wiDock->setVisible(true);
}
......@@ -370,7 +365,6 @@ void KStars::slotShowWIView(int status)
wi->updateModels(wiObsConditions);
wiDock->setVisible(true);
}
#endif
}
void KStars::slotCalendar() {
......
......@@ -381,11 +381,9 @@ void KStars::initActions() {
actionCollection()->addAction("whats_up_tonight", this, SLOT( slotWUT() ) )
<< xi18n("What's up Tonight")
<< QKeySequence(Qt::CTRL+Qt::Key_U );
/* FIXME Enable once port to KF5 is complete for whats_interesting
actionCollection()->addAction("whats_interesting", this, SLOT( slotWISettings() ) )
<< xi18n("What's Interesting...")
<< QKeySequence(Qt::CTRL+Qt::Key_W );
*/
actionCollection()->addAction("skycalendar", this, SLOT( slotCalendar() ) )
<< xi18n("Sky Calendar");
......
......@@ -16,63 +16,60 @@
***************************************************************************/
//FIXME Needs porting to KF5
//#include "QDeclarativeView"
#include "QGraphicsObject"
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
#include <QStandardPaths>
#include <QGraphicsObject>
#include "wiview.h"
#include "skymap.h"
#include "dialogs/detaildialog.h"
#include "QStandardPaths"
#include "kdeclarative.h"
WIView::WIView(QWidget *parent, ObsConditions *obs) : QWidget(parent), m_Obs(obs), m_CurCategorySelected(-1)
{
m_ModManager = new ModelManager(m_Obs);
m_BaseView = new QDeclarativeView();
m_BaseView = new QQuickView();
///To use i18n() instead of qsTr() in qml/wiview.qml for translation
KDeclarative kd;
kd.setDeclarativeEngine(m_BaseView->engine());
kd.initialize();
kd.setupBindings();
//KDeclarative kd;
// kd.setDeclarativeEngine(m_BaseView->engine());
//kd.initialize();
//kd.setupBindings();
m_Ctxt = m_BaseView->rootContext();
m_BaseView->setSource(QStandardPaths::locate(QStandardPaths::DataLocation, "tools/whatsinteresting/qml/wiview.qml"));
m_BaseObj = dynamic_cast<QObject *>(m_BaseView->rootObject());
m_BaseObj = m_BaseView->rootObject();
//soTypeTextObj = m_BaseObj->findChild<QObject *>("soTypeTextObj");
m_ViewsRowObj = m_BaseObj->findChild<QObject *>("viewsRowObj");
m_ViewsRowObj = m_BaseObj->findChild<QQuickItem*>(QString("viewsRowObj"));
connect(m_ViewsRowObj, SIGNAL(categorySelected(int)), this, SLOT(onCategorySelected(int)));
m_SoListObj = m_BaseObj->findChild<QObject *>("soListObj");
m_SoListObj = m_BaseObj->findChild<QQuickItem *>("soListObj");
connect(m_SoListObj, SIGNAL(soListItemClicked(int, QString, int)), this, SLOT(onSoListItemClicked(int, QString, int)));
m_DetailsViewObj = m_BaseObj->findChild<QObject *>("detailsViewObj");
m_DetailsViewObj = m_BaseObj->findChild<QQuickItem *>("detailsViewObj");
m_NextObj = m_BaseObj->findChild<QObject *>("nextObj");
m_NextObj = m_BaseObj->findChild<QQuickItem *>("nextObj");
connect(m_NextObj, SIGNAL(nextObjClicked()), this, SLOT(onNextObjClicked()));
m_PrevObj = m_BaseObj->findChild<QObject *>("prevObj");
m_PrevObj = m_BaseObj->findChild<QQuickItem *>("prevObj");
connect(m_PrevObj, SIGNAL(prevObjClicked()), this, SLOT(onPrevObjClicked()));
m_SlewButtonObj = m_BaseObj->findChild<QObject *>("slewButtonObj");
m_SlewButtonObj = m_BaseObj->findChild<QQuickItem*>("slewButtonObj");
connect(m_SlewButtonObj, SIGNAL(slewButtonClicked()), this, SLOT(onSlewButtonClicked()));
m_DetailsButtonObj = m_BaseObj->findChild<QObject *>("detailsButtonObj");
m_DetailsButtonObj = m_BaseObj->findChild<QQuickItem *>("detailsButtonObj");
connect(m_DetailsButtonObj, SIGNAL(detailsButtonClicked()), this, SLOT(onDetailsButtonClicked()));
QObject *settingsIconObj = m_BaseObj->findChild<QObject *>("settingsIconObj");
QObject *settingsIconObj = m_BaseObj->findChild<QQuickItem *>("settingsIconObj");
connect(settingsIconObj, SIGNAL(settingsIconClicked()), this, SLOT(onSettingsIconClicked()));
QObject *reloadIconObj = m_BaseObj->findChild<QObject *>("reloadIconObj");
QObject *reloadIconObj = m_BaseObj->findChild<QQuickItem*>("reloadIconObj");
connect(reloadIconObj, SIGNAL(reloadIconClicked()), this, SLOT(onReloadIconClicked()));
m_BaseView->setResizeMode(QDeclarativeView::SizeRootObjectToView);
m_BaseView->setResizeMode(QQuickView::SizeRootObjectToView);
m_BaseView->show();
}
......
......@@ -18,9 +18,10 @@
#ifndef WIVIEW_H
#define WIVIEW_H
class QDeclarativeView;
class QQuickView;
class QQuickItem;
#include <QtDeclarative/QDeclarativeContext>
#include <QQmlContext>
#include "skyobject.h"
#include "modelmanager.h"
#include "skyobjlistmodel.h"
......@@ -29,7 +30,7 @@ class QDeclarativeView;
/**
* \class WIView
* \brief Manages the QML user interface for What's Interesting.
* WIView is used to display the QML UI using a QDeclarativeView.
* WIView is used to display the QML UI using a QQuickView.
* It acts on all signals emitted by the UI and manages the data
* sent to the UI for display.
* \author Samikshan Bairagya
......@@ -61,7 +62,7 @@ public:
*/
void updateModels(ObsConditions *obs);
inline QDeclarativeView *getWIBaseView() const { return m_BaseView; }
inline QQuickView *getWIBaseView() const { return m_BaseView; }
public slots:
......@@ -112,10 +113,10 @@ public slots:
void onReloadIconClicked();
private:
QObject *m_BaseObj, *m_ViewsRowObj, *m_SoListObj, *m_DetailsViewObj,
QQuickItem *m_BaseObj, *m_ViewsRowObj, *m_SoListObj, *m_DetailsViewObj,
*m_NextObj, *m_PrevObj, *m_SlewButtonObj, *m_DetailsButtonObj;
QDeclarativeContext *m_Ctxt;
QDeclarativeView *m_BaseView;
QQmlContext *m_Ctxt;
QQuickView *m_BaseView;
ObsConditions *m_Obs;
ModelManager *m_ModManager;
SkyObjItem *m_CurSoItem; ///Current sky-object item.
......
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