Commit 74a8e78c authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

This patch adds an icon/button for the WI object inspector instead of just...

This patch adds an icon/button for the WI object inspector instead of just having it be on by default.  Also it changes the colors for whats interesting so they will work better with a red cover over your laptop.
parent 334f9eee
......@@ -547,7 +547,7 @@ void KStars::slotShowWIView()
m_wiDock->setAllowedAreas(Qt::RightDockWidgetArea);
QWidget * container = QWidget::createWindowContainer(m_WIView->getWIBaseView());
m_wiDock->setWidget(container);
m_wiDock->setMinimumWidth(300);
m_wiDock->setMinimumWidth(400);
addDockWidget(Qt::RightDockWidgetArea, m_wiDock);
m_wiDock->setVisible(true);
}
......
......@@ -14,4 +14,5 @@ install( FILES wiview.qml
downloadIcon.png
favoriteIcon.png
visibleIcon.png
inspectIcon.png
DESTINATION ${KDE_INSTALL_DATADIR}/kstars/tools/whatsinteresting/qml )
......@@ -750,7 +750,7 @@ Rectangle {
pointSize: 20
}
}
visible: (soListView.count > 0) ? false : true
visible: (soListView.count > 0 || container.state == "singleItemSelected") ? false : true
}
Rectangle {
......@@ -790,7 +790,7 @@ Rectangle {
textFormat: Text.RichText
x: image.width + 5
width: parent.width - image.width - 30
color: (soListItem.ListView.isCurrentItem) ? "white" : (mouseListArea.containsMouse||mouseImgArea.containsMouse) ? "yellow" : "#187988"
color: (soListItem.ListView.isCurrentItem) ? "white" : (mouseListArea.containsMouse||mouseImgArea.containsMouse) ? "yellow" : "gray"
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font{
......@@ -1067,7 +1067,7 @@ Rectangle {
Text {
id: descText
objectName: "descTextObj"
color: "#187988"
color: "white"
text: xi18n("text")
clip: true
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
......@@ -1386,7 +1386,7 @@ Rectangle {
pointSize: 20
}
}
visible: (soListView.count > 0) ? false : true
visible: (soListView.count > 0 || container.state == "singleItemSelected") ? false : true
}
} //end of detailsViewContainer
......@@ -1397,12 +1397,13 @@ Rectangle {
if (event.key == Qt.Key_Left||event.key == Qt.Key_Up) {
prevObjRect.prevObjClicked();
event.accepted = true;
soListView.positionViewAtIndex(soListView.currentIndex, ListView.Beginning)
}
if (event.key == Qt.Key_Right||event.key == Qt.Key_Down) {
nextObjRect.nextObjClicked();
event.accepted = true;
soListView.positionViewAtIndex(soListView.currentIndex, ListView.Beginning)
}
soListView.positionViewAtIndex(soListView.currentIndex, ListView.Beginning)
}
states: [
......@@ -1576,11 +1577,59 @@ Rectangle {
radius: 5
}
}
Image {
id: inspectIcon
objectName: "inspectIconObj"
state: "checked"
x: 50
y: container.height - 50
width: 28
height: 28
anchors{
verticalCenterOffset: 0
verticalCenter: backButton.verticalCenter
}
sourceSize{
height: 40
width: 40
}
smooth: true
fillMode: Image.Stretch
source: "inspectIcon.png"
signal inspectIconClicked(bool inspect)
MouseArea {
id: inspectMouseArea
anchors.fill: parent
hoverEnabled: true
onEntered: inspectForeground.opacity = buttonOpacity
onExited: inspectForeground.opacity = 0.0
onClicked: {
inspectIcon.inspectIconClicked(inspectIcon.state == "checked")
inspectIcon.state = (inspectIcon.state == "checked") ? "" : "checked"
}
}
Rectangle {
id: inspectForeground
radius: 5
opacity: 0
anchors.fill: parent
}
states: [
State {
name: "checked"
PropertyChanges {target: inspectIcon; opacity: 0.5}
}
]
}
Image {
id: reloadIcon
objectName: "reloadIconObj"
x: 50
x: 90
y: container.height - 50
width: 28
height: 28
......@@ -1630,7 +1679,7 @@ Rectangle {
id: visibleIcon
objectName: "visibleIconObj"
state: "checked"
x: 90
x: 130
y: container.height - 50
width: 28
height: 28
......@@ -1684,7 +1733,7 @@ Rectangle {
id: favoriteIcon
objectName: "favoriteIconObj"
state: "checked"
x: 130
x: 170
y: container.height - 50
width: 28
height: 28
......@@ -1743,7 +1792,7 @@ Rectangle {
Image {
id: downloadIcon
objectName: "downloadIconObj"
x: 170
x: 210
y: container.height - 50
width: 28
height: 28
......
......@@ -118,6 +118,9 @@ WIView::WIView(QWidget * parent) : QWidget(parent), m_CurrentObjectListName(-1)
QObject * settingsIconObj = m_BaseObj->findChild<QQuickItem *>("settingsIconObj");
connect(settingsIconObj, SIGNAL(settingsIconClicked()), this, SLOT(onSettingsIconClicked()));
inspectIconObj = m_BaseObj->findChild<QQuickItem *>("inspectIconObj");
connect(inspectIconObj, SIGNAL(inspectIconClicked(bool)), this, SLOT(onInspectIconClicked(bool)));
visibleIconObj = m_BaseObj->findChild<QQuickItem *>("visibleIconObj");
connect(visibleIconObj, SIGNAL(visibleIconClicked(bool)), this, SLOT(onVisibleIconClicked(bool)));
......@@ -133,7 +136,7 @@ WIView::WIView(QWidget * parent) : QWidget(parent), m_CurrentObjectListName(-1)
m_BaseView->setResizeMode(QQuickView::SizeRootObjectToView);
m_BaseView->show();
connect(KStars::Instance()->map(),SIGNAL(objectClicked(SkyObject*)),this, SLOT(inspectSkyObject(SkyObject*)));
connect(KStars::Instance()->map(),SIGNAL(objectClicked(SkyObject*)),this, SLOT(inspectSkyObjectOnClick(SkyObject*)));
manager = new QNetworkAccessManager();
......@@ -142,6 +145,8 @@ WIView::WIView(QWidget * parent) : QWidget(parent), m_CurrentObjectListName(-1)
connect(m_ModManager, SIGNAL(modelUpdated()),this,SLOT(refreshListView()));
m_ViewsRowObj->setProperty("enabled",false);
inspectOnClick = false;
}
WIView::~WIView()
......@@ -415,6 +420,12 @@ void WIView::inspectSkyObject(QString name){
inspectSkyObject(obj);
}
void WIView::inspectSkyObjectOnClick(SkyObject *obj){
if(inspectOnClick&&KStars::Instance()->isWIVisible()){
inspectSkyObject(obj);
}
}
void WIView::inspectSkyObject(SkyObject *obj){
if(obj){
if(obj->name()!="star"){
......@@ -587,7 +598,7 @@ void WIView::loadObjectDescription(SkyObjItem * soitem){
if(file.open(QIODevice::ReadOnly))
{
QTextStream in(&file);
QString line = in.readAll();
QString line = "<HTML><HEAD><style type=text/css>a {text-decoration: none;color: yellow}</style></HEAD><BODY>" + in.readAll() + "</BODY></HTML>";
descTextObj->setProperty("text", line);
file.close();
}
......
......@@ -116,6 +116,8 @@ class WIView : public QWidget
*/
void onSettingsIconClicked();
void onInspectIconClicked(bool checked){ inspectOnClick = checked; }
/**
* \brief public slot - Reload list of visible sky-objects.
*/
......@@ -135,7 +137,9 @@ class WIView : public QWidget
void saveObjectInfoBoxText(SkyObjItem * soitem, QString type, QString infoText);
void downloadWikipediaImage(SkyObjItem * soitem, QString imageURL);
void inspectSkyObject(QString name);
void inspectSkyObjectOnClick(SkyObject *obj);
void inspectSkyObject(SkyObject *obj);
bool inspectOnClickIsActive(){ return inspectOnClick; }
void updateObservingConditions();
void tryToUpdateWikipediaInfoInModel(bool onlyMissing);
void refreshListView();
......@@ -145,7 +149,7 @@ class WIView : public QWidget
private:
QQuickItem * m_BaseObj, *m_ViewsRowObj, *m_CategoryTitle, *m_SoListObj, *m_DetailsViewObj, *m_skyObjView, *m_ContainerObj, *m_ProgressBar, *m_loadingMessage,
*m_NextObj, *m_PrevObj, *m_CenterButtonObj, *m_SlewTelescopeButtonObj, *m_DetailsButtonObj, * visibleIconObj, * favoriteIconObj;
*m_NextObj, *m_PrevObj, *m_CenterButtonObj, *m_SlewTelescopeButtonObj, *m_DetailsButtonObj, * inspectIconObj, * visibleIconObj, * favoriteIconObj;
QQmlContext * m_Ctxt;
QObject * infoBoxText, * descTextObj;
......@@ -157,6 +161,7 @@ class WIView : public QWidget
QString m_CurrentObjectListName; ///Currently selected category from WI QML view
QString getWikipediaName(SkyObjItem * soitem);
QNetworkAccessManager * manager;
bool inspectOnClick;
};
......
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