Qt XML Stream Lint Example. --> to head
Sat Feb 20 18:23:58 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Fix analog-clock timer interval
Mon Feb 8 18:04:52 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Load qt.webkit, .uitools & .phonon optionaly.
Sun Feb 7 16:06:42 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Qt XML Stream Lint Example.
diff -rN -u old-qt.examples/cl-smoke.qt.examples.asd new-qt.examples/cl-smoke.qt.examples.asd
--- old-qt.examples/cl-smoke.qt.examples.asd 2014-10-30 07:35:48.000000000 +0100
+++ new-qt.examples/cl-smoke.qt.examples.asd 2014-10-30 07:35:48.000000000 +0100
@@ -1,11 +1,17 @@
+;; :weakly-depends-on loaded the system to late to use #+feature for
+;; components; thus we load them earlyer.
+(dolist (system '(:cl-smoke.qt.webkit :cl-smoke.qt.uitools
+ :cl-smoke.qt.phonon))
+ (when (asdf:find-system system nil)
+ (asdf:oos 'asdf:load-op system)))
+
(defsystem :cl-smoke.qt.examples
:name :cl-smoke.qt.examples
:version (0 0 1)
:author "Tobias Rautenkranz"
:license "X11 & GPL"
:description "Qt examples."
- :depends-on (:cl-smoke.qt.gui :cl-smoke.qt.webkit :cl-smoke.qt.uitools
- :cl-smoke.qt.phonon)
+ :depends-on (:cl-smoke.qt.gui)
;;:cl-opengl :cl-glu :cl-smoke.qt.opengl)
:components
@@ -13,18 +19,22 @@
:components
((:file "package")
(:file "hello-world" :depends-on ("package"))
+ #+qt.phonon
(:file "video" :depends-on ("package"))
(:file "hello-world-quit" :depends-on ("package"))
(:file "i18n-hello-world" :depends-on ("package"))
(:file "tick-tack-toe" :depends-on ("package"))
(:file "launcher" :depends-on ("package"))
+ #+qt.uitools
(:file "ui" :depends-on ("package"))
(:file "repl" :depends-on ("package"))
+ #+qt.webkit
(:file "class-browser" :depends-on ("package"))
(:module "qt"
:depends-on ("package")
:components
((:file "analog-clock")
+ (:file "xmlstreamlint")
(:file "colliding-mice")))))))
;;(:module "origami"
;; :depends-on ("package")
diff -rN -u old-qt.examples/src/package.lisp new-qt.examples/src/package.lisp
--- old-qt.examples/src/package.lisp 2014-10-30 07:35:48.000000000 +0100
+++ new-qt.examples/src/package.lisp 2014-10-30 07:35:48.000000000 +0100
@@ -8,10 +8,12 @@
#:hello-world-quit
#:hello-world-gc
+ #+qt.webkit
#:class-browser
#:tick-tack-toe
#:repl
+ #+qt.phonon
#:play-video
;;#:origami
@@ -20,6 +22,7 @@
#:analog-clock
#:colliding-mice
+ #+qt.uitools
#:load-ui-file))
(in-package #:qt.examples)
diff -rN -u old-qt.examples/src/qt/analog-clock.lisp new-qt.examples/src/qt/analog-clock.lisp
--- old-qt.examples/src/qt/analog-clock.lisp 2014-10-30 07:35:48.000000000 +0100
+++ new-qt.examples/src/qt/analog-clock.lisp 2014-10-30 07:35:48.000000000 +0100
@@ -47,7 +47,7 @@
(let ((timer (make-instance 'qt:timer :arg0 clock)))
(qt:connect (qt:get-signal timer "timeout()")
(qt:get-slot clock "update()"))
- (cxx:start timer))
+ (cxx:start timer 1000))
(setf (cxx:window-title clock) "Analog Clock")
(cxx:resize clock 200 200))
diff -rN -u old-qt.examples/src/qt/xmlstreamlint.lisp new-qt.examples/src/qt/xmlstreamlint.lisp
--- old-qt.examples/src/qt/xmlstreamlint.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.examples/src/qt/xmlstreamlint.lisp 2014-10-30 07:35:48.000000000 +0100
@@ -0,0 +1,66 @@
+;;; Copyright (c) 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
+;;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+;;; Contact: Qt Software Information (qt-info@nokia.com)
+;;;
+;;; This file is part of the examples of the Qt Toolkit.
+;;;
+;;; $QT_BEGIN_LICENSE:LGPL$
+;;; Commercial Usage
+;;; Licensees holding valid Qt Commercial licenses may use this file in
+;;; accordance with the Qt Commercial License Agreement provided with the
+;;; Software or, alternatively, in accordance with the terms contained in
+;;; a written agreement between you and Nokia.
+;;;
+;;; GNU Lesser General Public License Usage
+;;; Alternatively, this file may be used under the terms of the GNU Lesser
+;;; General Public License version 2.1 as published by the Free Software
+;;; Foundation and appearing in the file LICENSE.LGPL included in the
+;;; packaging of this file. Please review the following information to
+;;; ensure the GNU Lesser General Public License version 2.1 requirements
+;;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+;;;
+;;; In addition, as a special exception, Nokia gives you certain
+;;; additional rights. These rights are described in the Nokia Qt LGPL
+;;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+;;; package.
+;;;
+;;; GNU General Public License Usage
+;;; Alternatively, this file may be used under the terms of the GNU
+;;; General Public License version 3.0 as published by the Free Software
+;;; Foundation and appearing in the file LICENSE.GPL included in the
+;;; packaging of this file. Please review the following information to
+;;; ensure the GNU General Public License version 3.0 requirements will be
+;;; met: http://www.gnu.org/copyleft/gpl.html.
+;;;
+;;; If you are unsure which license is appropriate for your use, please
+;;; contact the sales department at qt-sales@nokia.com.
+;;; $QT_END_LICENSE$
+
+(in-package :qt.examples)
+
+;; Small example using only qt.core
+
+(defun xml-lint (input-file-path)
+ "Reads the XML from the file at INPUT-FILE-PATH and returns a copy."
+ (qt:with-core-app ()
+ (let ((input-file (make-instance 'qt:file
+ :arg0 input-file-path)))
+ (unless (cxx:exists input-file)
+ (error "File ~A does not exist." input-file-path))
+ (unless (cxx:open input-file qt:iodevice.+read-only+)
+ (error "Failed to open file ~A." input-file-path))
+
+ (let* ((reader (make-instance 'qt:xml-stream-reader
+ :arg0 input-file))
+ (output (make-instance 'qt:byte-array))
+ (writer (make-instance 'qt:xml-stream-writer
+ :arg0 output)))
+ (loop until (cxx:at-end reader) do
+ (cxx:read-next reader)
+ (when (cxx:has-error reader)
+ (error "Error: ~A in file ~A at line ~A, column ~A."
+ (cxx:error-string reader)
+ input-file-path
+ (cxx:line-number reader) (cxx:column-number reader)))
+ (cxx:write-current-token writer reader))
+ (cxx:data output)))))