--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef LOGS_DETAILS_DETAILS_VIEW_H
+#define LOGS_DETAILS_DETAILS_VIEW_H
+
+#include "Ui/View.h"
+
+namespace Ui
+{
+ class Genlist;
+}
+
+namespace Logs
+{
+ namespace Model
+ {
+ class LogGroup;
+ }
+ namespace Details
+ {
+ /**
+ * @brief Log details view.
+ */
+ class DetailsView : public Ui::View
+ {
+ public:
+
+ /**
+ * @brief Create log details view.
+ */
+ DetailsView(Model::LogGroup *group);
+
+ private:
+ virtual Evas_Object *onCreate(Evas_Object *parent) override;
+
+ Model::LogGroup *m_Group;
+ Ui::Genlist *m_Genlist;
+ };
+ }
+}
+
+#endif /* LOGS_DETAILS_DETAILS_VIEW_H */
typedef std::function<void(LogItem *item)> DeleteCallback;
/**
+ * @brief Item details callback
+ */
+ typedef std::function<void(LogItem *item)> DetailsCallback;
+
+ /**
* @brief Create log item
* @param[in] group Log group
* @param[in] mode Item mode
void setDeleteCallback(DeleteCallback callback);
/**
+ * @brief Set log details callback
+ * @param[in] callback Details callback
+ */
+ void setDetailsCallback(DetailsCallback callback);
+
+ /**
+ * @brief Get group
+ */
+ Model::LogGroup *getGroup() const;
+
+ /**
* @brief Remove group
*/
void removeGroup();
Evas_Object *createLayout(Evas_Object *parent, const char *layoutName);
Evas_Object *createIcon(Evas_Object *parent, const char *path);
const char *getImagePath(int type);
+ void onInfoIconPressed();
void updateItem();
void setUpdateCallback();
DeleteCallback m_OnDelete;
+ DetailsCallback m_OnDetails;
Model::LogGroup *m_Group;
ItemMode m_Mode;
};
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "Logs/Details/DetailsView.h"
+#include "Logs/Model/LogGroup.h"
+
+#include "App/Path.h"
+#include "Ui/Genlist.h"
+
+using namespace Logs::Model;
+using namespace Logs::Details;
+
+DetailsView::DetailsView(LogGroup *group)
+ : m_Group(group), m_Genlist(nullptr)
+{
+}
+
+Evas_Object *DetailsView::onCreate(Evas_Object *parent)
+{
+ m_Genlist = new Ui::Genlist();
+ return m_Genlist->create(parent);
+}
#include "Logs/List/LogItem.h"
#include "Logs/Model/Log.h"
#include "Logs/Model/LogGroup.h"
+#include "Logs/Details/DetailsView.h"
+#include "Utils/Callback.h"
#include "App/Path.h"
#include "Ui/Scale.h"
using namespace Ui;
using namespace Logs::List;
using namespace Logs::Model;
+using namespace Logs::Details;
namespace
{
}
LogItem::LogItem(LogGroup *group, ItemMode mode)
- :m_Group(group), m_Mode(mode)
+ : m_Group(group), m_Mode(mode)
{
setUpdateCallback();
}
m_OnDelete = std::move(callback);
}
+void LogItem::setDetailsCallback(DetailsCallback callback)
+{
+ m_OnDetails = std::move(callback);
+}
+
+void LogItem::onInfoIconPressed()
+{
+ if (m_OnDetails) {
+ m_OnDetails(this);
+ }
+}
+
+LogGroup *LogItem::getGroup() const
+{
+ return m_Group;
+}
+
void LogItem::removeGroup()
{
m_Group->remove();
if (m_Mode == ItemMode::Pick) {
return GenlistCheckItem::getContent(parent, part);
} else {
- return createIcon(parent, ICON_INFO);
+ Evas_Object *icon = createIcon(parent, ICON_INFO);
+ evas_object_propagate_events_set(icon, EINA_FALSE);
+ evas_object_smart_callback_add(icon, "clicked",
+ (Evas_Smart_Cb) makeCallback(&LogItem::onInfoIconPressed), this);
+ return icon;
}
}
#include "Logs/List/LogsView.h"
#include "Logs/List/LogGroupItem.h"
#include "Logs/List/LogItem.h"
+#include "Logs/Details/DetailsView.h"
#include "Ui/Genlist.h"
#include "Ui/Menu.h"
using namespace Logs::Model;
using namespace Logs::List;
+using namespace Logs::Details;
using namespace std::placeholders;
LogsView::LogsView(FilterType filterType)
}
});
+ item->setDetailsCallback([this](LogItem *item) {
+ getNavigator()->navigateTo(new DetailsView(item->getGroup()));
+ });
+
return item;
}