corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject incubator-corinthia git commit: First (non useable) version of Corinthia editor
Date Tue, 10 Mar 2015 21:44:59 GMT
Repository: incubator-corinthia
Updated Branches:
  refs/heads/master e3820933b -> 9bb460de4


First (non useable) version of Corinthia editor

Added consumers/corinthia as the basis for the new desktop editor based on Qt5.4
CMakeLists.txt is working with Qt, assuming Qt is standard installed.
Source code is copied/modified from a example, and need a lot of massaging.
The editor is stopped for a while, because Qt only runs with 64bit on windows.
Need to fix CMakeLists.txt so the Qt installation + compiler choise can be set
Need to fix 64bit/32bit conflict
In order to test the current code, uncomment #test in the central CMakeList.txt


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/9bb460de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/9bb460de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/9bb460de

Branch: refs/heads/master
Commit: 9bb460de460d6ce3a19e499d44e3399dbad62e78
Parents: e382093
Author: jani <jani@apache.org>
Authored: Tue Mar 10 22:40:44 2015 +0100
Committer: jani <jani@apache.org>
Committed: Tue Mar 10 22:40:44 2015 +0100

----------------------------------------------------------------------
 CMakeLists.txt                         |  1 +
 consumers/corinthia/src/CMakeLists.txt | 69 +++++++++++++++++++++++++++
 consumers/corinthia/src/desktop.cpp    | 53 +++++++++++++++++++++
 consumers/corinthia/src/desktop.ui     | 72 +++++++++++++++++++++++++++++
 consumers/corinthia/src/editWindows.h  | 36 +++++++++++++++
 consumers/corinthia/src/main.cpp       | 30 ++++++++++++
 6 files changed, 261 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9bb460de/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7eb3585..d6dde54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,3 +58,4 @@ add_subdirectory(DocFormats)
 add_subdirectory(consumers/dftest/src)
 add_subdirectory(consumers/dfconvert/src)
 add_subdirectory(consumers/dfutil/src)
+#TEST add_subdirectory(consumers/corinthia/src)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9bb460de/consumers/corinthia/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/CMakeLists.txt b/consumers/corinthia/src/CMakeLists.txt
new file mode 100644
index 0000000..61dbc47
--- /dev/null
+++ b/consumers/corinthia/src/CMakeLists.txt
@@ -0,0 +1,69 @@
+#
+# 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.
+
+
+
+###
+## global definitions
+###
+cmake_minimum_required(VERSION 2.8)
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+
+
+###
+## group source objects
+###
+set(SOURCES
+    editWindows.h
+    desktop.cpp
+    main.cpp)
+set(UI_SOURCES
+    desktop.ui)
+
+
+
+###
+# Common include for all platform files
+###
+include_directories()
+include_directories(SYSTEM ${INCLUDE_DIRS})
+include_directories(.)
+link_directories(${LIB_DIRS})
+
+
+
+###
+## Qt magic
+###
+set(CMAKE_PREFIX_PATH         "C:/Qt/5.4/msvc2013_64")
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC             ON)
+
+find_package(Qt5Widgets REQUIRED)
+include_directories("C:/Qt/5.4/msvc2013_64/include")
+
+qt5_wrap_ui(UI_HEADERS ${UI_SOURCES})
+source_group("Generated UI Headers" FILES ${UI_HEADERS})
+
+
+
+
+###
+# executable (release artifact)
+###
+add_executable(corinthia ${SOURCES} ${UI_HEADERS} ${UI_FILES})
+qt5_use_modules(corinthia Widgets)
+target_link_libraries(corinthia DocFormats ${LIBS})
+source_group(src FILES ${SOURCES})
+set_property(TARGET corinthia PROPERTY FOLDER consumers)

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9bb460de/consumers/corinthia/src/desktop.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/desktop.cpp b/consumers/corinthia/src/desktop.cpp
new file mode 100644
index 0000000..c7cb188
--- /dev/null
+++ b/consumers/corinthia/src/desktop.cpp
@@ -0,0 +1,53 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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 <QtWebKit/QWebElement>
+#include <QtWebKitWidgets/QWebFrame>
+#include "editWindows.h"
+
+
+
+DesktopWindow::DesktopWindow(QWidget *parent)
+              : QWidget(parent)
+{
+    setupUi(this);
+}
+
+
+
+void DesktopWindow::on_elementLineEdit_returnPressed()
+{
+    QWebFrame *frame               = webView->page()->mainFrame();
+    QWebElement document           = frame->documentElement();
+    QWebElementCollection elements = document.findAll(elementLineEdit->text());
+
+    foreach (QWebElement element, elements)
+        element.setAttribute("style", "background-color: #f0f090");
+}
+
+
+
+void DesktopWindow::on_highlightButton_clicked()
+{
+    on_elementLineEdit_returnPressed();
+}
+
+
+
+void DesktopWindow::setUrl(const QUrl &url)
+{
+    webView->setUrl(url);
+}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9bb460de/consumers/corinthia/src/desktop.ui
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/desktop.ui b/consumers/corinthia/src/desktop.ui
new file mode 100644
index 0000000..2db697f
--- /dev/null
+++ b/consumers/corinthia/src/desktop.ui
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DesktopWindow</class>
+ <widget class="QWidget" name="Window">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>640</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Web Element Selector</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QWebView" name="webView">
+     <property name="url">
+      <url>
+       <string>http://webkit.org/</string>
+      </url>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <layout class="QFormLayout" name="formLayout">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::ExpandingFieldsGrow</enum>
+       </property>
+       <item row="0" column="0">
+        <widget class="QLabel" name="elementLabel">
+         <property name="text">
+          <string>&amp;Element:</string>
+         </property>
+         <property name="buddy">
+          <cstring>elementLineEdit</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QLineEdit" name="elementLineEdit">
+         <property name="text">
+          <string>li a</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <widget class="QPushButton" name="highlightButton">
+       <property name="text">
+        <string>&amp;Highlight</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QWebView</class>
+   <extends>QWidget</extends>
+   <header>QtWebKit/QWebView</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9bb460de/consumers/corinthia/src/editWindows.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/editWindows.h b/consumers/corinthia/src/editWindows.h
new file mode 100644
index 0000000..a49a6d6
--- /dev/null
+++ b/consumers/corinthia/src/editWindows.h
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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 editWindows_h 
+#define editWindows_h
+#include <QtCore/QUrl>
+#include <QtWidgets/QWidget>
+#include "ui_desktop.h"
+
+class DesktopWindow : public QWidget, private Ui::DesktopWindow
+{
+        Q_OBJECT
+
+    public:
+        DesktopWindow(QWidget *parent = 0);
+        void setUrl(const QUrl &url);
+
+    public slots:
+        void on_elementLineEdit_returnPressed();
+        void on_highlightButton_clicked();
+};
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/9bb460de/consumers/corinthia/src/main.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/main.cpp b/consumers/corinthia/src/main.cpp
new file mode 100644
index 0000000..399b0a6
--- /dev/null
+++ b/consumers/corinthia/src/main.cpp
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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 <QtGUi/QtGui>
+#include "editWindows.h"
+
+
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+
+    DesktopWindow desktop;
+    desktop.setUrl(QUrl("http://corinthia.apache.org"));
+    desktop.show();
+    return app.exec();
+}


Mime
View raw message