[Pkg-running-devel] [openambit] 05/131: Initial checkin of GUI

Christian Perrier bubulle at moszumanska.debian.org
Thu Jul 17 20:19:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

bubulle pushed a commit to branch master
in repository openambit.

commit bfaee164de815bf73c412c83aef66bf117e8b10b
Author: Emil Ljungdahl <emil at kratern.se>
Date:   Wed Dec 11 23:13:22 2013 +0100

    Initial checkin of GUI
---
 src/openambit/COPYING            |  674 ++++++++++++++++
 src/openambit/devicemanager.cpp  |  130 ++++
 src/openambit/devicemanager.h    |   72 ++
 src/openambit/logentry.cpp       |  105 +++
 src/openambit/logentry.h         |   47 ++
 src/openambit/logstore.cpp       | 1577 ++++++++++++++++++++++++++++++++++++++
 src/openambit/logstore.h         |  103 +++
 src/openambit/main.cpp           |   41 +
 src/openambit/mainwindow.cpp     |  181 +++++
 src/openambit/mainwindow.h       |   70 ++
 src/openambit/mainwindow.ui      |  326 ++++++++
 src/openambit/movescount.cpp     |  804 +++++++++++++++++++
 src/openambit/movescount.h       |   66 ++
 src/openambit/openambit.pro      |   38 +
 src/openambit/settings.cpp       |   32 +
 src/openambit/settings.h         |   39 +
 src/openambit/settingsdialog.cpp |  106 +++
 src/openambit/settingsdialog.h   |   55 ++
 src/openambit/settingsdialog.ui  |  244 ++++++
 19 files changed, 4710 insertions(+)

diff --git a/src/openambit/COPYING b/src/openambit/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/src/openambit/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/src/openambit/devicemanager.cpp b/src/openambit/devicemanager.cpp
new file mode 100644
index 0000000..b670d33
--- /dev/null
+++ b/src/openambit/devicemanager.cpp
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "devicemanager.h"
+
+#include <QTimer>
+#include <libambit.h>
+
+void DeviceManager::start()
+{
+    connect(&chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimerHit()));
+    chargeTimer.setInterval(10000);
+    chargeTimer.start();
+}
+
+DeviceManager::~DeviceManager()
+{
+    chargeTimer.stop();
+}
+
+void DeviceManager::detect()
+{
+    int res = -1;
+
+    mutex.lock();
+    if (this->deviceObject != NULL) {
+        libambit_close(this->deviceObject);
+    }
+    this->deviceObject = libambit_detect();
+
+    if (this->deviceObject != NULL && (res = libambit_device_info_get(this->deviceObject, &this->currentDeviceInfo)) == 0) {
+        emit deviceDetected(this->currentDeviceInfo, libambit_device_supported(this->deviceObject));
+    }
+    else {
+        emit deviceRemoved();
+    }
+    mutex.unlock();
+
+    if (res == 0) {
+        chargeTimerHit();
+    }
+}
+
+void DeviceManager::startSync(bool readAllLogs = false)
+{
+    int res = -1;
+    mutex.lock();
+    if (this->deviceObject != NULL) {
+        res = libambit_personal_settings_get(this->deviceObject, &currentPersonalSettings);
+
+        if (res != -1) {
+            res = libambit_log_read(this->deviceObject, readAllLogs ? NULL : &log_skip_cb, &log_push_cb, &log_progress_cb, this);
+        }
+    }
+    mutex.unlock();
+
+    emit syncFinished(res == 0);
+
+    if (res == -1) {
+        // Failed to read! We better try another detect
+        detect();
+    }
+}
+
+void DeviceManager::chargeTimerHit()
+{
+    int res = -1;
+    ambit_device_status_t status;
+
+    if (mutex.tryLock()) {
+        if (this->deviceObject != NULL) {
+            if ((res = libambit_device_status_get(this->deviceObject, &status)) == 0) {
+                emit deviceCharge(status.charge);
+            }
+        }
+        mutex.unlock();
+    }
+    else {
+        res = 0;
+    }
+
+    if (res != 0) {
+        // Failed to read! We better try another detect
+        detect();
+    }
+}
+
+int DeviceManager::log_skip_cb(void *ref, ambit_log_header_t *log_header)
+{
+    DeviceManager *manager = static_cast<DeviceManager*> (ref);
+    if (manager->logStore.logExists(QString(manager->currentDeviceInfo.serial), log_header)) {
+        return 0;
+    }
+    return 1;
+}
+
+void DeviceManager::log_push_cb(void *ref, ambit_log_entry_t *log_entry)
+{
+    DeviceManager *manager = static_cast<DeviceManager*> (ref);
+    LogEntry *entry = manager->logStore.store(QString(manager->currentDeviceInfo.serial), &manager->currentPersonalSettings, log_entry);
+    if (entry != NULL) {
+        manager->movesCount.sendLog(entry);
+    }
+
+    delete entry;
+}
+
+void DeviceManager::log_progress_cb(void *ref, uint16_t log_count, uint16_t log_current, uint8_t progress_percent)
+{
+    DeviceManager *manager = static_cast<DeviceManager*> (ref);
+    emit manager->syncProgressInform(QString("Downloading message %1 of %2").arg(log_current).arg(log_count), false, progress_percent);
+}
diff --git a/src/openambit/devicemanager.h b/src/openambit/devicemanager.h
new file mode 100644
index 0000000..5af7e77
--- /dev/null
+++ b/src/openambit/devicemanager.h
@@ -0,0 +1,72 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef DEVICEMANAGER_H
+#define DEVICEMANAGER_H
+
+#include <QObject>
+#include <QThread>
+#include <QMutex>
+#include <QTimer>
+#include <QMetaType>
+
+#include "settings.h"
+#include "logstore.h"
+#include "movescount.h"
+#include <libambit.h>
+
+class DeviceManager : public QObject
+{
+    Q_OBJECT
+public:
+    void start();
+    ~DeviceManager();
+signals:
+    void deviceDetected(ambit_device_info_t deviceInfo, bool supported);
+    void deviceRemoved(void);
+    void deviceCharge(quint8 percent);
+    void syncFinished(bool success);
+    void syncProgressInform(QString message, bool newRow, quint8 percentDone);
+public slots:
+    void detect(void);
+    void startSync(bool readAllLogs);
+
+private slots:
+    void chargeTimerHit();
+
+private:
+    static int log_skip_cb(void *ref, ambit_log_header_t *log_header);
+    static void log_push_cb(void *ref, ambit_log_entry_t *log_entry);
+    static void log_progress_cb(void *ref, uint16_t log_count, uint16_t log_current, uint8_t progress_percent);
+
+    ambit_object_t *deviceObject = NULL;
+    ambit_device_info_t currentDeviceInfo;
+    ambit_personal_settings_t currentPersonalSettings;
+
+    QMutex mutex;
+    QTimer chargeTimer;
+    MovesCount movesCount;
+    Settings settings;
+    LogStore logStore;
+
+};
+
+#endif // DEVICEMANAGER_H
diff --git a/src/openambit/logentry.cpp b/src/openambit/logentry.cpp
new file mode 100644
index 0000000..c687d0c
--- /dev/null
+++ b/src/openambit/logentry.cpp
@@ -0,0 +1,105 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "logentry.h"
+
+LogEntry::LogEntry()
+{
+}
+
+LogEntry::LogEntry(const LogEntry &other)
+{
+    u_int32_t i;
+
+    if (other.personalSettings != NULL) {
+        personalSettings = (ambit_personal_settings_t*)malloc(sizeof(ambit_personal_settings_t));
+        memcpy(personalSettings, other.personalSettings, sizeof(ambit_personal_settings_t));
+    }
+    else {
+        personalSettings = NULL;
+    }
+
+    if (other.logEntry != NULL) {
+        logEntry = (ambit_log_entry_t*)malloc(sizeof(ambit_log_entry_t));
+        memcpy(logEntry, other.logEntry, sizeof(ambit_log_entry_t));
+        if (other.logEntry->samples != NULL) {
+            logEntry->samples = (ambit_log_sample_t*)malloc(sizeof(ambit_log_sample_t)*other.logEntry->samples_count);
+            memcpy(logEntry->samples, other.logEntry->samples, sizeof(ambit_log_sample_t)*other.logEntry->samples_count);
+            for (i=0; i<other.logEntry->samples_count; i++) {
+                if (other.logEntry->samples[i].type == ambit_log_sample_type_periodic) {
+                    if (other.logEntry->samples[i].u.periodic.values != NULL) {
+                        logEntry->samples[i].u.periodic.values = (ambit_log_sample_periodic_value_t*)malloc(sizeof(ambit_log_sample_periodic_value_t)*other.logEntry->samples[i].u.periodic.value_count);
+                        memcpy(logEntry->samples[i].u.periodic.values, other.logEntry->samples[i].u.periodic.values, sizeof(ambit_log_sample_periodic_value_t)*other.logEntry->samples[i].u.periodic.value_count);
+                    }
+                }
+                if (other.logEntry->samples[i].type == ambit_log_sample_type_gps_base) {
+                    if (other.logEntry->samples[i].u.gps_base.satellites != NULL) {
+                        logEntry->samples[i].u.gps_base.satellites = (ambit_log_gps_satellite_t*)malloc(sizeof(ambit_log_gps_satellite_t)*logEntry->samples[i].u.gps_base.satellites_count);
+                        memcpy(logEntry->samples[i].u.gps_base.satellites, other.logEntry->samples[i].u.gps_base.satellites, sizeof(ambit_log_gps_satellite_t)*logEntry->samples[i].u.gps_base.satellites_count);
+                    }
+                }
+            }
+        }
+    }
+}
+
+LogEntry& LogEntry::operator=(const LogEntry &rhs)
+{
+    LogEntry tmp(rhs);
+
+    std::swap(device, tmp.device);
+    std::swap(time, tmp.time);
+    std::swap(personalSettings, tmp.personalSettings);
+    std::swap(logEntry, tmp.logEntry);
+
+    return *this;
+}
+
+LogEntry::~LogEntry()
+{
+    u_int32_t i;
+
+    if (personalSettings != NULL) {
+        free(personalSettings);
+        personalSettings = NULL;
+    }
+
+    if (logEntry != NULL) {
+        if (logEntry->samples != NULL) {
+            for (i=0; i<logEntry->samples_count; i++) {
+                if (logEntry->samples[i].type == ambit_log_sample_type_periodic) {
+                    if (logEntry->samples[i].u.periodic.values != NULL) {
+                        free(logEntry->samples[i].u.periodic.values);
+                    }
+                }
+                if (logEntry->samples[i].type == ambit_log_sample_type_gps_base) {
+                    if (logEntry->samples[i].u.gps_base.satellites != NULL) {
+                        free(logEntry->samples[i].u.gps_base.satellites);
+                    }
+                }
+            }
+            free(logEntry->samples);
+        }
+        free(logEntry);
+    }
+
+    logEntry = NULL;
+}
diff --git a/src/openambit/logentry.h b/src/openambit/logentry.h
new file mode 100644
index 0000000..62465bc
--- /dev/null
+++ b/src/openambit/logentry.h
@@ -0,0 +1,47 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef LOGENTRY_H
+#define LOGENTRY_H
+
+#include <QDateTime>
+#include <libambit.h>
+
+class LogEntry
+{
+public:
+    explicit LogEntry();
+    LogEntry(const LogEntry &other);
+    ~LogEntry();
+
+    LogEntry& operator=(const LogEntry &rhs);
+
+    QString device;
+    QDateTime time;
+    ambit_personal_settings_t *personalSettings = NULL;
+    ambit_log_entry_t *logEntry = NULL;
+signals:
+    
+public slots:
+    
+};
+
+#endif // LOGENTRY_H
diff --git a/src/openambit/logstore.cpp b/src/openambit/logstore.cpp
new file mode 100644
index 0000000..e57f089
--- /dev/null
+++ b/src/openambit/logstore.cpp
@@ -0,0 +1,1577 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "logstore.h"
+
+#include <QFile>
+#include <QStringList>
+#include <QDir>
+#include <QRegExp>
+
+#include <QDebug>
+
+typedef struct sample_type_names_s {
+    ambit_log_sample_type_t id;
+    QString XMLName;
+} sample_type_names_t;
+
+static sample_type_names_t sampleTypeNames[] = {
+    { ambit_log_sample_type_periodic, "periodic" },
+    { ambit_log_sample_type_logpause, "log-pause" },
+    { ambit_log_sample_type_logrestart, "log-restart" },
+    { ambit_log_sample_type_ibi, "ibi" },
+    { ambit_log_sample_type_ttff, "ttff" },
+    { ambit_log_sample_type_distance_source, "distance-source" },
+    { ambit_log_sample_type_lapinfo, "lap-info" },
+    { ambit_log_sample_type_altitude_source, "altitude-source" },
+    { ambit_log_sample_type_gps_base, "gps-base" },
+    { ambit_log_sample_type_gps_small, "gps-small" },
+    { ambit_log_sample_type_gps_tiny, "gps-tiny" },
+    { ambit_log_sample_type_time, "time" },
+    { ambit_log_sample_type_activity, "activity" },
+    { ambit_log_sample_type_position, "position" },
+    { (ambit_log_sample_type_t)0, "" }
+};
+
+typedef struct sample_distance_source_name_s {
+    u_int8_t source_id;
+    QString XMLName;
+} sample_distance_source_name_t;
+
+static sample_distance_source_name_t sampleDistanceSourceNames[] = {
+    { 0x02, "GPS" },
+    { 0x03, "Wrist" },
+    { 0, "" }
+};
+
+typedef struct sample_altitude_source_name_s {
+    u_int8_t source_id;
+    QString XMLName;
+} sample_altitude_source_name_t;
+
+static sample_altitude_source_name_t sampleAltitudeSourceNames[] = {
+    { 0x04, "Pressure" },
+    { 0, "" }
+};
+
+typedef struct sample_lap_event_type_s {
+    u_int8_t event_type;
+    QString XMLName;
+} sample_lap_event_type_t;
+
+static sample_lap_event_type_t sampleLapEventTypeNames[] = {
+    { 0x01, "Manual" },
+    { 0x14, "High Interval" },
+    { 0x15, "Low Interval" },
+    { 0x16, "Interval" },
+    { 0x1e, "Pause" },
+    { 0x1f, "Start" },
+    { 0, "" }
+};
+
+LogStore::LogStore(QObject *parent) :
+    QObject(parent)
+{
+    storagePath = QString(getenv("HOME")) + "/.openambit";
+}
+
+LogEntry *LogStore::store(QString device, ambit_personal_settings_t *personalSettings, ambit_log_entry_t *logEntry)
+{
+    LogEntry *retEntry = new LogEntry();
+    QDateTime dateTime(QDate(logEntry->header.date_time.year, logEntry->header.date_time.month, logEntry->header.date_time.day),
+                       QTime(logEntry->header.date_time.hour, logEntry->header.date_time.minute, logEntry->header.date_time.msec/1000));
+
+    XMLWriter writer(device, dateTime, personalSettings, logEntry);
+    QFile logfile(logEntryPath(device, dateTime));
+    logfile.open(QIODevice::WriteOnly);
+    writer.write(&logfile);
+    logfile.close();
+    logfile.open(QIODevice::ReadOnly);
+    XMLReader reader(retEntry);
+    if (!reader.read(&logfile)) {
+        delete retEntry;
+        retEntry = NULL;
+    }
+
+    return retEntry;
+}
+
+bool LogStore::logExists(QString device, ambit_log_header_t *logHeader)
+{
+    QDateTime dateTime(QDate(logHeader->date_time.year, logHeader->date_time.month, logHeader->date_time.day),
+                       QTime(logHeader->date_time.hour, logHeader->date_time.minute, logHeader->date_time.msec/1000));
+
+    return QFile::exists(logEntryPath(device, dateTime));
+}
+
+LogEntry *LogStore::read(QString device, QDateTime time)
+{
+    return read(logEntryPath(device, time));
+}
+
+LogEntry *LogStore::read(LogDirEntry dirEntry)
+{
+    return read(dirEntry.filename);
+}
+
+LogEntry *LogStore::read(QString filename)
+{
+    LogEntry *retEntry = new LogEntry();
+
+    if (QFile::exists(storagePath + "/" + filename)) {
+        QFile logfile(storagePath + "/" + filename);
+        logfile.open(QIODevice::ReadOnly);
+        XMLReader reader(retEntry);
+        if (!reader.read(&logfile)) {
+            QString error = reader.errorString();
+            qDebug() << error;
+            delete retEntry;
+            retEntry = NULL;
+        }
+    }
+
+    return retEntry;
+}
+
+QList<LogStore::LogDirEntry> LogStore::dir(QString device)
+{
+    QList<LogDirEntry> dirList;
+    QRegExp rx("log_([0-9a-zA-Z]+)_([0-9]{4})_([0-9]{2})_([0-9]{2})_([0-9]{2})_([0-9]{2})_([0-9]{2}).log");
+
+    QStringList nameFilter;
+    if (device == "") {
+        nameFilter.append("log_*.log");
+    }
+    else {
+        nameFilter.append("log_" + device + "_*.log");
+    }
+
+    QDir directory(storagePath);
+    QStringList matches = directory.entryList(nameFilter, QDir::Files, QDir::Name);
+    foreach (QString match, matches) {
+        if (rx.indexIn(match) >= 0) {
+            LogDirEntry dirEntry;
+            dirEntry.filename = rx.cap(0);
+            dirEntry.device = rx.cap(1);
+            dirEntry.time = QDateTime(QDate(rx.cap(2).toInt(), rx.cap(3).toInt(), rx.cap(4).toInt()),
+                                      QTime(rx.cap(5).toInt(), rx.cap(6).toInt(), rx.cap(7).toInt()));
+            dirList.append(dirEntry);
+        }
+    }
+
+    return dirList;
+}
+
+QString LogStore::logEntryPath(QString device, QDateTime time)
+{
+    return storagePath + "/log_" + device + "_" + time.toString("yyyy_MM_dd_hh_mm_ss") + ".log";
+}
+
+
+
+LogStore::XMLReader::XMLReader(LogEntry *logEntry) : logEntry(logEntry)
+{
+}
+
+bool LogStore::XMLReader::read(QIODevice *device)
+{
+    xml.setDevice(device);
+
+    if (xml.readNextStartElement()) {
+        if (xml.name() == "openambitlog" && xml.attributes().value("version") == "1.0") {
+            readRoot();
+        }
+        else {
+            xml.raiseError(QObject::tr("The file is not an openambit version 1.0 file."));
+        }
+    }
+
+    return !xml.error();
+}
+
+QString LogStore::XMLReader::errorString() const
+{
+    return QObject::tr("%1\nLine %2, column %3")
+            .arg(xml.errorString())
+            .arg(xml.lineNumber())
+            .arg(xml.columnNumber());
+}
+
+void LogStore::XMLReader::readRoot()
+{
+    Q_ASSERT(xml.isStartElement() && xml.name() == "openambitlog");
+
+    while (xml.readNextStartElement()) {
+        if (xml.name() == "SerialNumber") {
+            readSerial();
+        }
+        else if (xml.name() == "Time") {
+            readTime();
+        }
+        else if (xml.name() == "PersonalSettings") {
+            readPersonalSettings();
+        }
+        else if (xml.name() == "Log") {
+            readLog();
+        }
+        else {
+            xml.skipCurrentElement();
+        }
+    }
+}
+
+void LogStore::XMLReader::readSerial()
+{
+    Q_ASSERT(xml.isStartElement() && xml.name() == "SerialNumber");
+
+    logEntry->device = xml.readElementText();
+}
+
+void LogStore::XMLReader::readTime()
+{
+    Q_ASSERT(xml.isStartElement() && xml.name() == "Time");
+
+    QString datestring = xml.readElementText();
+    logEntry->time = QDateTime::fromString(datestring, Qt::ISODate);
+}
+
+void LogStore::XMLReader::readPersonalSettings()
+{
+    Q_ASSERT(xml.isStartElement() && xml.name() == "PersonalSettings");
+
+    if (logEntry->personalSettings == NULL) {
+        logEntry->personalSettings = (ambit_personal_settings_t*)malloc(sizeof(ambit_personal_settings_t));
+        memset(logEntry->personalSettings, 0, sizeof(ambit_personal_settings_t));
+    }
+
+    while (xml.readNextStartElement()) {
+        if (xml.name() == "SportModeButtonLock") {
+            logEntry->personalSettings->sportmode_button_lock = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "TimeModeButtonLock") {
+            logEntry->personalSettings->timemode_button_lock = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "CompassDeclination") {
+            logEntry->personalSettings->compass_declination = xml.readElementText().toInt();
+        }
+        else if (xml.name() == "UnitsMode") {
+            logEntry->personalSettings->units_mode = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Units") {
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "AirPressureUnit") {
+                    logEntry->personalSettings->units.pressure = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "AltitudeUnit") {
+                    logEntry->personalSettings->units.altitude = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "DistanceUnit") {
+                    logEntry->personalSettings->units.distance = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "HeightUnit") {
+                    logEntry->personalSettings->units.height = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "TemperatureUnit") {
+                    logEntry->personalSettings->units.temperature = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "VerticalSpeedUnit") {
+                    logEntry->personalSettings->units.verticalspeed = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "WeightUnit") {
+                    logEntry->personalSettings->units.weight = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "CompassUnit") {
+                    logEntry->personalSettings->units.compass = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "HRUnit") {
+                    logEntry->personalSettings->units.heartrate = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "SpeedUnit") {
+                    logEntry->personalSettings->units.speed = xml.readElementText().toUInt();
+                }
+                else {
+                    xml.skipCurrentElement();
+                }
+            }
+        }
+        else if (xml.name() == "GPSPositionFormat") {
+            logEntry->personalSettings->gps_position_format = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Language") {
+            logEntry->personalSettings->language = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "NavigationStyle") {
+            logEntry->personalSettings->navigation_style = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "GPSTimeKeeping") {
+            logEntry->personalSettings->sync_time_w_gps = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Use24hClock") {
+            logEntry->personalSettings->time_format = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Alarm") {
+            QTime time = QTime::fromString(xml.readElementText(), "hh:mm");
+            logEntry->personalSettings->alarm.hour = time.hour();
+            logEntry->personalSettings->alarm.minute = time.minute();
+        }
+        else if (xml.name() == "AlarmEnable") {
+            logEntry->personalSettings->alarm_enable = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "DualTime") {
+            QTime time = QTime::fromString(xml.readElementText(), "hh:mm");
+            logEntry->personalSettings->dual_time.hour = time.hour();
+            logEntry->personalSettings->dual_time.minute = time.minute();
+        }
+        else if (xml.name() == "DisplayDateMode") {
+            logEntry->personalSettings->date_format = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "TonesMode") {
+            logEntry->personalSettings->tones_mode = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BacklightMode") {
+            logEntry->personalSettings->backlight_mode = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BacklightBrightness") {
+            logEntry->personalSettings->backlight_brightness = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "DisplayBrightness") {
+            logEntry->personalSettings->display_brightness = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "DisplayIsNegative") {
+            logEntry->personalSettings->display_is_negative = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Weight") {
+            logEntry->personalSettings->weight = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BirthYear") {
+            logEntry->personalSettings->birthyear = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "MaxHR") {
+            logEntry->personalSettings->max_hr = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "RestHR") {
+            logEntry->personalSettings->rest_hr = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "FitnessLevel") {
+            logEntry->personalSettings->fitness_level = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "IsMale") {
+            logEntry->personalSettings->is_male = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Length") {
+            logEntry->personalSettings->length = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "AltiBaroMode") {
+            logEntry->personalSettings->alti_baro_mode = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "FusedAltiDisabled") {
+            logEntry->personalSettings->fused_alti_disabled = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BikePODCalibration") {
+            logEntry->personalSettings->bikepod_calibration = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BikePODCalibration2") {
+            logEntry->personalSettings->bikepod_calibration2 = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BikePODCalibration3") {
+            logEntry->personalSettings->bikepod_calibration3 = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "FootPODCalibration") {
+            logEntry->personalSettings->footpod_calibration = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "AutomaticBikePowerCalibration") {
+            logEntry->personalSettings->automatic_bikepower_calib = xml.readElementText().toUInt();
+        }
+        else {
+            xml.skipCurrentElement();
+        }
+    }
+}
+
+void LogStore::XMLReader::readLog()
+{
+    Q_ASSERT(xml.isStartElement() && xml.name() == "Log");
+
+    if (logEntry->logEntry == NULL) {
+        logEntry->logEntry = (ambit_log_entry_t*)calloc(1, sizeof(ambit_log_entry_t));
+    }
+
+    while (xml.readNextStartElement()) {
+        if (xml.name() == "Header") {
+            readLogHeader();
+        }
+        else if (xml.name() == "Samples") {
+            readLogSamples();
+        }
+        else {
+            xml.skipCurrentElement();
+        }
+    }
+}
+
+void LogStore::XMLReader::readLogHeader()
+{
+    Q_ASSERT(xml.isStartElement() && xml.name() == "Header");
+
+    while (xml.readNextStartElement()) {
+        if (xml.name() == "DateTime") {
+            QDateTime datetime = QDateTime::fromString(xml.readElementText(), Qt::ISODate);
+            logEntry->logEntry->header.date_time.year = datetime.date().year();
+            logEntry->logEntry->header.date_time.month = datetime.date().month();
+            logEntry->logEntry->header.date_time.day = datetime.date().day();
+            logEntry->logEntry->header.date_time.hour = datetime.time().hour();
+            logEntry->logEntry->header.date_time.minute = datetime.time().minute();
+            logEntry->logEntry->header.date_time.msec = datetime.time().second()*1000 + datetime.time().msec();
+        }
+        else if (xml.name() == "Duration") {
+            logEntry->logEntry->header.duration = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Ascent") {
+            logEntry->logEntry->header.ascent = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Descent") {
+            logEntry->logEntry->header.descent = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "AscentTime") {
+            logEntry->logEntry->header.ascent_time = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "DescentTime") {
+            logEntry->logEntry->header.descent_time = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "RecoveryTime") {
+            logEntry->logEntry->header.recovery_time = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Speed") {
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "Avg") {
+                    logEntry->logEntry->header.speed_avg = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "Max") {
+                    logEntry->logEntry->header.speed_max = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "MaxTime") {
+                    logEntry->logEntry->header.speed_max_time = xml.readElementText().toUInt();
+                }
+                else {
+                    xml.skipCurrentElement();
+                }
+            }
+        }
+        else if (xml.name() == "Altitude") {
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "Max") {
+                    logEntry->logEntry->header.altitude_max = xml.readElementText().toInt();
+                }
+                else if (xml.name() == "Min") {
+                    logEntry->logEntry->header.altitude_min = xml.readElementText().toInt();
+                }
+                else if (xml.name() == "MaxTime") {
+                    logEntry->logEntry->header.altitude_max_time = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "MinTime") {
+                    logEntry->logEntry->header.altitude_min_time = xml.readElementText().toUInt();
+                }
+                else {
+                    xml.skipCurrentElement();
+                }
+            }
+        }
+        else if (xml.name() == "HR") {
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "Avg") {
+                    logEntry->logEntry->header.heartrate_avg = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "Max") {
+                    logEntry->logEntry->header.heartrate_max = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "Min") {
+                    logEntry->logEntry->header.heartrate_min = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "MaxTime") {
+                    logEntry->logEntry->header.heartrate_max_time = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "MinTime") {
+                    logEntry->logEntry->header.heartrate_min_time = xml.readElementText().toUInt();
+                }
+                else {
+                    xml.skipCurrentElement();
+                }
+            }
+        }
+        else if (xml.name() == "PeakTrainingEffect") {
+            logEntry->logEntry->header.peak_training_effect = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "ActivityType") {
+            logEntry->logEntry->header.activity_type = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Activity") {
+            QByteArray ba = xml.readElementText().toLocal8Bit();
+            const char *c_str = ba.data();
+            strncpy(logEntry->logEntry->header.activity_name, c_str, 16);
+        }
+        else if (xml.name() == "Temperature") {
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "Max") {
+                    logEntry->logEntry->header.temperature_max = xml.readElementText().toInt();
+                }
+                else if (xml.name() == "Min") {
+                    logEntry->logEntry->header.temperature_min = xml.readElementText().toInt();
+                }
+                else if (xml.name() == "MaxTime") {
+                    logEntry->logEntry->header.temperature_max_time = xml.readElementText().toUInt();
+                }
+                else if (xml.name() == "MinTime") {
+                    logEntry->logEntry->header.temperature_min_time = xml.readElementText().toUInt();
+                }
+                else {
+                    xml.skipCurrentElement();
+                }
+            }
+        }
+        else if (xml.name() == "Distance") {
+            logEntry->logEntry->header.distance = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "LogItemCount") {
+            logEntry->logEntry->header.samples_count = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Energy") {
+            logEntry->logEntry->header.energy_consumption = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "TimeToFirstFix") {
+            logEntry->logEntry->header.first_fix_time = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BatteryChargeAtStart") {
+            logEntry->logEntry->header.battery_start = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "BatteryCharge") {
+            logEntry->logEntry->header.battery_end = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "DistanceBeforeCalibrationChange") {
+            logEntry->logEntry->header.distance_before_calib = xml.readElementText().toUInt();
+        }
+        else if (xml.name() == "Unknown1") {
+            QByteArray val = xml.readElementText().toLocal8Bit();
+            const char *c_str = val.data();
+            for (int i=0; i<5 && i<val.length()/2; i++) {
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown1[i]);
+                c_str += 2 * sizeof(char);
+            }
+        }
+        else if (xml.name() == "Unknown2") {
+            QByteArray val = xml.readElementText().toLocal8Bit();
+            const char *c_str = val.data();
+            sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown2);
+        }
+        else if (xml.name() == "Unknown3") {
+            QByteArray val = xml.readElementText().toLocal8Bit();
+            const char *c_str = val.data();
+            for (int i=0; i<6 && i<val.length()/2; i++) {
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown3[i]);
+                c_str += 2 * sizeof(char);
+            }
+        }
+        else if (xml.name() == "Unknown4") {
+            QByteArray val = xml.readElementText().toLocal8Bit();
+            const char *c_str = val.data();
+            for (int i=0; i<8 && i<val.length()/2; i++) {
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown4[i]);
+                c_str += 2 * sizeof(char);
+            }
+        }
+        else if (xml.name() == "Unknown5") {
+            QByteArray val = xml.readElementText().toLocal8Bit();
+            const char *c_str = val.data();
+            for (int i=0; i<4 && i<val.length()/2; i++) {
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown5[i]);
+                c_str += 2 * sizeof(char);
+            }
+        }
+        else if (xml.name() == "Unknown6") {
+            QByteArray val = xml.readElementText().toLocal8Bit();
+            const char *c_str = val.data();
+            for (int i=0; i<24 && i<val.length()/2; i++) {
+                sscanf(c_str, "%2hhx", &logEntry->logEntry->header.unknown6[i]);
+                c_str += 2 * sizeof(char);
+            }
+        }
+        else {
+            xml.skipCurrentElement();
+        }
+    }
+}
+
+void LogStore::XMLReader::readLogSamples()
+{
+    int sampleCount = 0;
+    ambit_log_sample_type_t type;
+
+    Q_ASSERT(xml.isStartElement() && xml.name() == "Samples");
+
+    if (logEntry->logEntry->samples == NULL) {
+        logEntry->logEntry->samples = (ambit_log_sample_t *)calloc(logEntry->logEntry->header.samples_count, sizeof(ambit_log_sample_t));
+        logEntry->logEntry->samples_count = logEntry->logEntry->header.samples_count;
+    }
+
+    while (xml.readNextStartElement()) {
+        if (xml.name() == "Sample") {
+            QList<ambit_log_sample_periodic_value_t> periodicValues;
+            int ibiCount = 0;
+            while (xml.readNextStartElement()) {
+                if (xml.name() == "Type") {
+                    type = (ambit_log_sample_type_t)xml.attributes().value("id").toString().toUInt();
+                    logEntry->logEntry->samples[sampleCount].type = type;
+                    xml.skipCurrentElement();
+                }
+                else if (xml.name() == "UTC") {
+                    QDateTime datetime = QDateTime::fromString(xml.readElementText(), "yyyy-MM-ddThh:mm:ss.zzzZ");
+                    logEntry->logEntry->samples[sampleCount].utc_time.year = datetime.date().year();
+                    logEntry->logEntry->samples[sampleCount].utc_time.month = datetime.date().month();
+                    logEntry->logEntry->samples[sampleCount].utc_time.day = datetime.date().day();
+                    logEntry->logEntry->samples[sampleCount].utc_time.hour = datetime.time().hour();
+                    logEntry->logEntry->samples[sampleCount].utc_time.minute = datetime.time().minute();
+                    logEntry->logEntry->samples[sampleCount].utc_time.msec = datetime.time().second()*1000 + datetime.time().msec();
+                }
+                else if (xml.name() == "Time") {
+                    logEntry->logEntry->samples[sampleCount].time = xml.readElementText().toUInt();
+                }
+                else {
+                    switch(type) {
+                    case ambit_log_sample_type_periodic:
+                        readPeriodicSample(&periodicValues);
+                        break;
+                    case ambit_log_sample_type_logpause:
+                        /* Should not get here! */
+                        xml.skipCurrentElement();
+                        break;
+                    case ambit_log_sample_type_logrestart:
+                        /* Should not get here! */
+                        xml.skipCurrentElement();
+                        break;
+                    case ambit_log_sample_type_ibi:
+                        if (xml.name() == "IBI") {
+                            logEntry->logEntry->samples[sampleCount].u.ibi.ibi[ibiCount] = xml.readElementText().toUInt();
+                            ibiCount++;
+                            logEntry->logEntry->samples[sampleCount].u.ibi.ibi_count = ibiCount;
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_ttff:
+                        logEntry->logEntry->samples[sampleCount].u.ttff = xml.readElementText().toUInt();
+                        break;
+                    case ambit_log_sample_type_distance_source:
+                        if (xml.name() == "DistanceSource") {
+                            int distanceId = xml.attributes().value("id").toString().toUInt();
+                            logEntry->logEntry->samples[sampleCount].u.distance_source = distanceId;
+                            xml.skipCurrentElement();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_lapinfo:
+                        if (xml.name() == "Lap") {
+                            while(xml.readNextStartElement()) {
+                                if (xml.name() == "Type") {
+                                    int lapTypeId = xml.attributes().value("id").toString().toUInt();
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.event_type = lapTypeId;
+                                    xml.skipCurrentElement();
+                                }
+                                else if (xml.name() == "DateTime") {
+                                    QDateTime datetime = QDateTime::fromString(xml.readElementText(), Qt::ISODate);
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.date_time.year = datetime.date().year();
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.date_time.month = datetime.date().month();
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.date_time.day = datetime.date().day();
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.date_time.hour = datetime.time().hour();
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.date_time.minute = datetime.time().minute();
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.date_time.msec = datetime.time().second()*1000 + datetime.time().msec();
+                                }
+                                else if (xml.name() == "Duration") {
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.duration = xml.readElementText().toUInt();
+                                }
+                                else if (xml.name() == "Distance") {
+                                    logEntry->logEntry->samples[sampleCount].u.lapinfo.distance = xml.readElementText().toUInt();
+                                }
+                                else {
+                                    /* Should not get here! */
+                                    xml.skipCurrentElement();
+                                }
+                            }
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_altitude_source:
+                        if (xml.name() == "AltitudeSource") {
+                            int altitudeSourceId = xml.attributes().value("id").toString().toUInt();
+                            logEntry->logEntry->samples[sampleCount].u.altitude_source.source_type = altitudeSourceId;
+                            xml.skipCurrentElement();
+                        }
+                        else if (xml.name() == "AltitudeOffset") {
+                            logEntry->logEntry->samples[sampleCount].u.altitude_source.altitude_offset = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "PressureOffset") {
+                            logEntry->logEntry->samples[sampleCount].u.altitude_source.pressure_offset = xml.readElementText().toInt();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_gps_base:
+                        if (xml.name() == "NavValid") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.navvalid = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "NavType") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.navtype = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "UTCReference") {
+                            QDateTime datetime = QDateTime::fromString(xml.readElementText(), "yyyy-MM-ddThh:mm:ss.zzzZ");
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.utc_base_time.year = datetime.date().year();
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.utc_base_time.month = datetime.date().month();
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.utc_base_time.day = datetime.date().day();
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.utc_base_time.hour = datetime.time().hour();
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.utc_base_time.minute = datetime.time().minute();
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.utc_base_time.msec = datetime.time().second()*1000 + datetime.time().msec();
+                        }
+                        else if (xml.name() == "Latitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.latitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "Longitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.longitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "GPSAltitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.altitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "GPSSpeed") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.speed = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "GPSHeading") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.heading = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "EHPE") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.ehpe = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "NumberOfSatellites") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.noofsatellites = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "GpsHDOP") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_base.hdop = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "Satellites") {
+                            QList<ambit_log_gps_satellite_t> satellites;
+                            while(xml.readNextStartElement()) {
+                                if (xml.name() == "Satellite") {
+                                    ambit_log_gps_satellite_t satellite;
+                                    while(xml.readNextStartElement()) {
+                                        if (xml.name() == "SV") {
+                                            satellite.sv = xml.readElementText().toUInt();
+                                        }
+                                        else if (xml.name() == "SNR") {
+                                            satellite.snr = xml.readElementText().toUInt();
+                                        }
+                                        else if (xml.name() == "State") {
+                                            satellite.state = xml.readElementText().toUInt();
+                                        }
+                                        else {
+                                            /* Should not get here! */
+                                            xml.skipCurrentElement();
+                                        }
+                                    }
+                                    satellites.append(satellite);
+                                }
+                                else {
+                                    /* Should not get here! */
+                                    xml.skipCurrentElement();
+                                }
+                            }
+                            if (satellites.count() > 0) {
+                                logEntry->logEntry->samples[sampleCount].u.gps_base.satellites_count = satellites.count();
+                                logEntry->logEntry->samples[sampleCount].u.gps_base.satellites = (ambit_log_gps_satellite_t*)calloc(satellites.count(), sizeof(ambit_log_gps_satellite_t));
+                                for (int i=0; i<satellites.count(); i++) {
+                                    logEntry->logEntry->samples[sampleCount].u.gps_base.satellites[i] = satellites.at(i);
+                                }
+                            }
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_gps_small:
+                        if (xml.name() == "Latitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_small.latitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "Longitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_small.longitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "EHPE") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_small.ehpe = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "NumberOfSatellites") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_small.noofsatellites = xml.readElementText().toUInt();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_gps_tiny:
+                        if (xml.name() == "Latitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_tiny.latitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "Longitude") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_tiny.longitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "EHPE") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_tiny.ehpe = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "Unknown") {
+                            logEntry->logEntry->samples[sampleCount].u.gps_tiny.unknown = xml.readElementText().toUInt();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_time:
+                        if (xml.name() == "TimeRef") {
+                            QTime timeref = QTime::fromString(xml.readElementText(), Qt::ISODate);
+                            logEntry->logEntry->samples[sampleCount].u.time.hour = timeref.hour();
+                            logEntry->logEntry->samples[sampleCount].u.time.minute = timeref.minute();
+                            logEntry->logEntry->samples[sampleCount].u.time.second = timeref.second();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_activity:
+                        if (xml.name() == "ActivityType") {
+                            logEntry->logEntry->samples[sampleCount].u.activity.activitytype = xml.readElementText().toUInt();
+                        }
+                        else if (xml.name() == "CustomModeId") {
+                            logEntry->logEntry->samples[sampleCount].u.activity.custommode = xml.readElementText().toUInt();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    case ambit_log_sample_type_position:
+                        if (xml.name() == "Latitude") {
+                            logEntry->logEntry->samples[sampleCount].u.position.latitude = xml.readElementText().toInt();
+                        }
+                        else if (xml.name() == "Longitude") {
+                            logEntry->logEntry->samples[sampleCount].u.position.longitude = xml.readElementText().toInt();
+                        }
+                        else {
+                            /* Should not get here! */
+                            xml.skipCurrentElement();
+                        }
+                        break;
+                    default:
+                        xml.skipCurrentElement();
+                    }
+                }
+            }
+            if (type == ambit_log_sample_type_periodic && periodicValues.count() > 0) {
+                logEntry->logEntry->samples[sampleCount].u.periodic.value_count = periodicValues.count();
+                logEntry->logEntry->samples[sampleCount].u.periodic.values = (ambit_log_sample_periodic_value_t*)calloc(periodicValues.count(), sizeof(ambit_log_sample_periodic_value_t));
+                for (int i=0; i<periodicValues.count(); i++) {
+                    logEntry->logEntry->samples[sampleCount].u.periodic.values[i] = periodicValues.at(i);
+                }
+            }
+            sampleCount++;
+        }
+        else {
+            xml.skipCurrentElement();
+        }
+    }
+}
+
+void LogStore::XMLReader::readPeriodicSample(QList<ambit_log_sample_periodic_value_t> *valueContent)
+{
+    ambit_log_sample_periodic_value_t value;
+
+    if (xml.name() == "Latitude") {
+        value.type = ambit_log_sample_periodic_type_latitude;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Longitude") {
+        value.type = ambit_log_sample_periodic_type_longitude;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Distance") {
+        value.type = ambit_log_sample_periodic_type_distance;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Speed") {
+        value.type = ambit_log_sample_periodic_type_speed;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "HR") {
+        value.type = ambit_log_sample_periodic_type_hr;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Time") {
+        value.type = ambit_log_sample_periodic_type_time;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "GPSSpeed") {
+        value.type = ambit_log_sample_periodic_type_gpsspeed;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "WristAccSpeed") {
+        value.type = ambit_log_sample_periodic_type_wristaccspeed;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "BikePodSpeed") {
+        value.type = ambit_log_sample_periodic_type_bikepodspeed;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "EHPE") {
+        value.type = ambit_log_sample_periodic_type_ehpe;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "EVPE") {
+        value.type = ambit_log_sample_periodic_type_evpe;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Altitude") {
+        value.type = ambit_log_sample_periodic_type_altitude;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "AbsPressure") {
+        value.type = ambit_log_sample_periodic_type_abspressure;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "EnergyConsumption") {
+        value.type = ambit_log_sample_periodic_type_energy;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Temperature") {
+        value.type = ambit_log_sample_periodic_type_temperature;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "BatteryCharge") {
+        value.type = ambit_log_sample_periodic_type_charge;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "GPSAltitude") {
+        value.type = ambit_log_sample_periodic_type_gpsaltitude;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "GPSHeading") {
+        value.type = ambit_log_sample_periodic_type_gpsheading;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "GpsHDOP") {
+        value.type = ambit_log_sample_periodic_type_gpshdop;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "GpsVDOP") {
+        value.type = ambit_log_sample_periodic_type_gpsvdop;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "WristCadence") {
+        value.type = ambit_log_sample_periodic_type_wristcadence;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "SNR") {
+        value.type = ambit_log_sample_periodic_type_snr;
+        QByteArray val = xml.readElementText().toLocal8Bit();
+        const char *c_str = val.data();
+        for (int i=0; i<16 && i<val.length()/2; i++) {
+            sscanf(c_str, "%2hhx", &value.u.snr[i]);
+            c_str += 2 * sizeof(char);
+        }
+        valueContent->append(value);
+    }
+    else if (xml.name() == "NumberOfSatellites") {
+        value.type = ambit_log_sample_periodic_type_noofsatellites;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "SeaLevelPressure") {
+        value.type = ambit_log_sample_periodic_type_sealevelpressure;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "VerticalSpeed") {
+        value.type = ambit_log_sample_periodic_type_verticalspeed;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "Cadence") {
+        value.type = ambit_log_sample_periodic_type_cadence;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "BikePower") {
+        value.type = ambit_log_sample_periodic_type_bikepower;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "SwimmingStrokeCount") {
+        value.type = ambit_log_sample_periodic_type_swimingstrokecnt;
+        value.u.latitude = xml.readElementText().toUInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "RuleOutput1") {
+        value.type = ambit_log_sample_periodic_type_ruleoutput1;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "RuleOutput2") {
+        value.type = ambit_log_sample_periodic_type_ruleoutput2;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "RuleOutput3") {
+        value.type = ambit_log_sample_periodic_type_ruleoutput3;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "RuleOutput4") {
+        value.type = ambit_log_sample_periodic_type_ruleoutput4;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else if (xml.name() == "RuleOutput5") {
+        value.type = ambit_log_sample_periodic_type_ruleoutput5;
+        value.u.latitude = xml.readElementText().toInt();
+        valueContent->append(value);
+    }
+    else {
+        xml.skipCurrentElement();
+    }
+}
+
+
+LogStore::XMLWriter::XMLWriter(QString serial, QDateTime time, ambit_personal_settings_t *personalSettings, ambit_log_entry_t *logEntry) :
+    serial(serial), time(time), personalSettings(personalSettings), logEntry(logEntry)
+{
+    xml.setAutoFormatting(true);
+}
+
+bool LogStore::XMLWriter::write(QIODevice *device)
+{
+    bool ret = true;
+
+    xml.setDevice(device);
+
+    xml.writeStartDocument();
+    xml.writeDTD("<!DOCTYPE openambitlog>");
+    xml.writeStartElement("openambitlog");
+    xml.writeAttribute("version", "1.0");
+
+    xml.writeTextElement("SerialNumber", serial);
+    xml.writeTextElement("Time", time.toString(Qt::ISODate));
+    ret = writePersonalSettings();
+    if (ret) {
+        ret = writeLogEntry();
+    }
+
+    xml.writeEndDocument();
+
+    return ret;
+}
+
+bool LogStore::XMLWriter::writePersonalSettings()
+{
+    xml.writeStartElement("PersonalSettings");
+    xml.writeTextElement("SportModeButtonLock", QString("%1").arg(personalSettings->sportmode_button_lock));
+    xml.writeTextElement("TimeModeButtonLock", QString("%1").arg(personalSettings->timemode_button_lock));
+    xml.writeTextElement("CompassDeclination", QString("%1").arg(personalSettings->compass_declination));
+    xml.writeTextElement("UnitsMode", QString("%1").arg(personalSettings->units_mode));
+    xml.writeStartElement("Units");
+        xml.writeTextElement("AirPressureUnit", QString("%1").arg(personalSettings->units.pressure));
+        xml.writeTextElement("AltitudeUnit", QString("%1").arg(personalSettings->units.altitude));
+        xml.writeTextElement("DistanceUnit", QString("%1").arg(personalSettings->units.distance));
+        xml.writeTextElement("HeightUnit", QString("%1").arg(personalSettings->units.height));
+        xml.writeTextElement("TemperatureUnit", QString("%1").arg(personalSettings->units.temperature));
+        xml.writeTextElement("VerticalSpeedUnit", QString("%1").arg(personalSettings->units.verticalspeed));
+        xml.writeTextElement("WeightUnit", QString("%1").arg(personalSettings->units.weight));
+        xml.writeTextElement("CompassUnit", QString("%1").arg(personalSettings->units.compass));
+        xml.writeTextElement("HRUnit", QString("%1").arg(personalSettings->units.heartrate));
+        xml.writeTextElement("SpeedUnit", QString("%1").arg(personalSettings->units.speed));
+    xml.writeEndElement();
+    xml.writeTextElement("GPSPositionFormat", QString("%1").arg(personalSettings->gps_position_format));
+    xml.writeTextElement("Language", QString("%1").arg(personalSettings->language));
+    xml.writeTextElement("NavigationStyle", QString("%1").arg(personalSettings->navigation_style));
+    xml.writeTextElement("GPSTimeKeeping", QString("%1").arg(personalSettings->sync_time_w_gps));
+    xml.writeTextElement("Use24hClock", QString("%1").arg(personalSettings->time_format));
+    QString timeFormat;
+    timeFormat.sprintf("%02u:%02u", personalSettings->alarm.hour, personalSettings->alarm.minute);
+    xml.writeTextElement("Alarm", timeFormat.sprintf("%02u:%02u", personalSettings->alarm.hour, personalSettings->alarm.minute));
+    xml.writeTextElement("AlarmEnable", QString("%1").arg(personalSettings->alarm_enable));
+    xml.writeTextElement("DualTime", timeFormat.sprintf("%02u:%02u", personalSettings->dual_time.hour, personalSettings->dual_time.minute));
+    xml.writeTextElement("DisplayDateMode", QString("%1").arg(personalSettings->date_format));
+    xml.writeTextElement("TonesMode", QString("%1").arg(personalSettings->tones_mode));
+    xml.writeTextElement("BacklightMode", QString("%1").arg(personalSettings->backlight_mode));
+    xml.writeTextElement("BacklightBrightness", QString("%1").arg(personalSettings->backlight_brightness));
+    xml.writeTextElement("DisplayBrightness", QString("%1").arg(personalSettings->display_brightness));
+    xml.writeTextElement("DisplayIsNegative", QString("%1").arg(personalSettings->display_is_negative));
+    xml.writeTextElement("Weight", QString("%1").arg(personalSettings->weight));
+    xml.writeTextElement("BirthYear", QString("%1").arg(personalSettings->birthyear));
+    xml.writeTextElement("MaxHR", QString("%1").arg(personalSettings->max_hr));
+    xml.writeTextElement("RestHR", QString("%1").arg(personalSettings->rest_hr));
+    xml.writeTextElement("FitnessLevel", QString("%1").arg(personalSettings->fitness_level));
+    xml.writeTextElement("IsMale", QString("%1").arg(personalSettings->is_male));
+    xml.writeTextElement("Length", QString("%1").arg(personalSettings->length));
+    xml.writeTextElement("AltiBaroMode", QString("%1").arg(personalSettings->alti_baro_mode));
+    xml.writeTextElement("FusedAltiDisabled", QString("%1").arg(personalSettings->fused_alti_disabled));
+    xml.writeTextElement("BikePODCalibration", QString("%1").arg(personalSettings->bikepod_calibration));
+    xml.writeTextElement("BikePODCalibration2", QString("%1").arg(personalSettings->bikepod_calibration2));
+    xml.writeTextElement("BikePODCalibration3", QString("%1").arg(personalSettings->bikepod_calibration3));
+    xml.writeTextElement("FootPODCalibration", QString("%1").arg(personalSettings->footpod_calibration));
+    xml.writeTextElement("AutomaticBikePowerCalibration", QString("%1").arg(personalSettings->automatic_bikepower_calib));
+
+    xml.writeEndElement();
+
+    return true;
+}
+
+bool LogStore::XMLWriter::writeLogEntry()
+{
+    u_int32_t i;
+
+    xml.writeStartElement("Log");
+    xml.writeStartElement("Header");
+    QDateTime dateTime(QDate(logEntry->header.date_time.year, logEntry->header.date_time.month, logEntry->header.date_time.day), QTime(logEntry->header.date_time.hour, logEntry->header.date_time.minute, 0).addMSecs(logEntry->header.date_time.msec));
+    xml.writeTextElement("DateTime", dateTime.toString(Qt::ISODate));
+    xml.writeTextElement("Duration", QString("%1").arg(logEntry->header.duration));
+    xml.writeTextElement("Ascent", QString("%1").arg(logEntry->header.ascent));
+    xml.writeTextElement("Descent", QString("%1").arg(logEntry->header.descent));
+    xml.writeTextElement("AscentTime", QString("%1").arg(logEntry->header.ascent_time));
+    xml.writeTextElement("DescentTime", QString("%1").arg(logEntry->header.descent_time));
+    xml.writeTextElement("RecoveryTime", QString("%1").arg(logEntry->header.recovery_time));
+    xml.writeStartElement("Speed");
+    xml.writeTextElement("Avg", QString("%1").arg(logEntry->header.speed_avg));
+    xml.writeTextElement("Max", QString("%1").arg(logEntry->header.speed_max));
+    xml.writeTextElement("MaxTime", QString("%1").arg(logEntry->header.speed_max_time));
+    xml.writeEndElement();
+    xml.writeStartElement("Altitude");
+    xml.writeTextElement("Max", QString("%1").arg(logEntry->header.altitude_max));
+    xml.writeTextElement("Min", QString("%1").arg(logEntry->header.altitude_min));
+    xml.writeTextElement("MaxTime", QString("%1").arg(logEntry->header.altitude_max_time));
+    xml.writeTextElement("MinTime", QString("%1").arg(logEntry->header.altitude_min_time));
+    xml.writeEndElement();
+    xml.writeStartElement("HR");
+    xml.writeTextElement("Avg", QString("%1").arg(logEntry->header.heartrate_avg));
+    xml.writeTextElement("Max", QString("%1").arg(logEntry->header.heartrate_max));
+    xml.writeTextElement("Min", QString("%1").arg(logEntry->header.heartrate_min));
+    xml.writeTextElement("MaxTime", QString("%1").arg(logEntry->header.heartrate_max_time));
+    xml.writeTextElement("MinTime", QString("%1").arg(logEntry->header.heartrate_min_time));
+    xml.writeEndElement();
+    xml.writeTextElement("PeakTrainingEffect", QString("%1").arg(logEntry->header.peak_training_effect));
+    xml.writeTextElement("ActivityType", QString("%1").arg(logEntry->header.activity_type));
+    xml.writeTextElement("Activity", QString(logEntry->header.activity_name));
+    xml.writeStartElement("Temperature");
+    xml.writeTextElement("Max", QString("%1").arg(logEntry->header.temperature_max));
+    xml.writeTextElement("Min", QString("%1").arg(logEntry->header.temperature_min));
+    xml.writeTextElement("MaxTime", QString("%1").arg(logEntry->header.temperature_max_time));
+    xml.writeTextElement("MinTime", QString("%1").arg(logEntry->header.temperature_min_time));
+    xml.writeEndElement();
+    xml.writeTextElement("Distance", QString("%1").arg(logEntry->header.distance));
+    xml.writeTextElement("LogItemCount", QString("%1").arg(logEntry->header.samples_count));
+    xml.writeTextElement("Energy", QString("%1").arg(logEntry->header.energy_consumption));
+    xml.writeTextElement("TimeToFirstFix", QString("%1").arg(logEntry->header.first_fix_time));
+    xml.writeTextElement("BatteryChargeAtStart", QString("%1").arg(logEntry->header.battery_start));
+    xml.writeTextElement("BatteryCharge", QString("%1").arg(logEntry->header.battery_end));
+    xml.writeTextElement("DistanceBeforeCalibrationChange", QString("%1").arg(logEntry->header.distance_before_calib));
+
+    QString hexstring;
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x%02x", logEntry->header.unknown1[0],
+                                                          logEntry->header.unknown1[1],
+                                                          logEntry->header.unknown1[2],
+                                                          logEntry->header.unknown1[3],
+                                                          logEntry->header.unknown1[4]);
+    xml.writeTextElement("Unknown1", hexstring);
+    hexstring = hexstring.sprintf("%02x", logEntry->header.unknown2);
+    xml.writeTextElement("Unknown2", hexstring);
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x%02x%02x", logEntry->header.unknown3[0],
+                                                              logEntry->header.unknown3[1],
+                                                              logEntry->header.unknown3[2],
+                                                              logEntry->header.unknown3[3],
+                                                              logEntry->header.unknown3[4],
+                                                              logEntry->header.unknown3[5]);
+    xml.writeTextElement("Unknown3", hexstring);
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x%02x%02x%02x%02x", logEntry->header.unknown4[0],
+                                                                      logEntry->header.unknown4[1],
+                                                                      logEntry->header.unknown4[2],
+                                                                      logEntry->header.unknown4[3],
+                                                                      logEntry->header.unknown4[4],
+                                                                      logEntry->header.unknown4[5],
+                                                                      logEntry->header.unknown4[6],
+                                                                      logEntry->header.unknown4[7]);
+    xml.writeTextElement("Unknown4", hexstring);
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x", logEntry->header.unknown5[0],
+                                                      logEntry->header.unknown5[1],
+                                                      logEntry->header.unknown5[2],
+                                                      logEntry->header.unknown5[3]);
+    xml.writeTextElement("Unknown5", hexstring);
+    hexstring = hexstring.sprintf("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+                                  logEntry->header.unknown6[0],
+                                  logEntry->header.unknown6[1],
+                                  logEntry->header.unknown6[2],
+                                  logEntry->header.unknown6[3],
+                                  logEntry->header.unknown6[4],
+                                  logEntry->header.unknown6[5],
+                                  logEntry->header.unknown6[6],
+                                  logEntry->header.unknown6[7],
+                                  logEntry->header.unknown6[8],
+                                  logEntry->header.unknown6[9],
+                                  logEntry->header.unknown6[10],
+                                  logEntry->header.unknown6[11],
+                                  logEntry->header.unknown6[12],
+                                  logEntry->header.unknown6[13],
+                                  logEntry->header.unknown6[14],
+                                  logEntry->header.unknown6[15],
+                                  logEntry->header.unknown6[16],
+                                  logEntry->header.unknown6[17],
+                                  logEntry->header.unknown6[18],
+                                  logEntry->header.unknown6[19],
+                                  logEntry->header.unknown6[20],
+                                  logEntry->header.unknown6[21],
+                                  logEntry->header.unknown6[22],
+                                  logEntry->header.unknown6[23]);
+    xml.writeTextElement("Unknown6", hexstring);
+
+    xml.writeEndElement();
+    xml.writeStartElement("Samples");
+    for (i=0; i<logEntry->samples_count; i++) {
+        writeLogSample(&logEntry->samples[i]);
+    }
+    xml.writeEndElement();
+    xml.writeEndElement();
+
+    return true;
+}
+
+bool LogStore::XMLWriter::writeLogSample(ambit_log_sample_t *sample)
+{
+    sample_type_names_t *sample_type_name;
+    sample_distance_source_name_t *distance_source_name;
+    sample_altitude_source_name_t *altitude_source_name;
+    sample_lap_event_type_t *lap_type_name;
+    int i;
+
+    xml.writeStartElement("Sample");
+    xml.writeStartElement("Type");
+    xml.writeAttribute("id", QString("%1").arg(sample->type));
+    for (sample_type_name = &sampleTypeNames[0]; sample_type_name->XMLName != NULL; sample_type_name++) {
+        if (sample_type_name->id == sample->type) {
+            xml.writeCharacters(QString(sample_type_name->XMLName));
+            break;
+        }
+    }
+    xml.writeEndElement();
+    QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addMSecs(sample->utc_time.msec));
+    dateTime.setTimeSpec(Qt::UTC);
+    xml.writeTextElement("UTC", dateTime.toString("yyyy-MM-ddThh:mm:ss.zzzZ"));
+    xml.writeTextElement("Time", QString("%1").arg(sample->time));
+    switch(sample->type) {
+    case ambit_log_sample_type_periodic:
+        writePeriodicSample(sample);
+        break;
+    case ambit_log_sample_type_logpause:
+        break;
+    case ambit_log_sample_type_logrestart:
+        break;
+    case ambit_log_sample_type_ibi:
+        for (i=0; i<sample->u.ibi.ibi_count; i++) {
+            xml.writeTextElement("IBI", QString("%1").arg(sample->u.ibi.ibi[i]));
+        }
+        break;
+    case ambit_log_sample_type_ttff:
+        xml.writeTextElement("ttff", QString("%1").arg(sample->u.ttff));
+        break;
+    case ambit_log_sample_type_distance_source:
+    {
+        xml.writeStartElement("DistanceSource");
+        xml.writeAttribute("id", QString("%1").arg(sample->u.distance_source));
+        for (distance_source_name = &sampleDistanceSourceNames[0]; distance_source_name->XMLName != ""; distance_source_name++) {
+            if (distance_source_name->source_id == sample->u.distance_source) {
+                xml.writeCharacters(QString(distance_source_name->XMLName));
+                break;
+            }
+        }
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_lapinfo:
+    {
+        xml.writeStartElement("Lap");
+        xml.writeStartElement("Type");
+        xml.writeAttribute("id", QString("%1").arg(sample->u.lapinfo.event_type));
+        for (lap_type_name = &sampleLapEventTypeNames[0]; lap_type_name->XMLName != ""; lap_type_name++) {
+            if (lap_type_name->event_type == sample->u.lapinfo.event_type) {
+                xml.writeCharacters(QString(lap_type_name->XMLName));
+            }
+        }
+        xml.writeEndElement();
+        QDateTime dateTime(QDate(sample->u.lapinfo.date_time.year, sample->u.lapinfo.date_time.month, sample->u.lapinfo.date_time.day), QTime(sample->u.lapinfo.date_time.hour, sample->u.lapinfo.date_time.minute, 0).addMSecs(sample->u.lapinfo.date_time.msec));
+        xml.writeTextElement("DateTime", dateTime.toString(Qt::ISODate));
+        xml.writeTextElement("Duration", QString("%1").arg(sample->u.lapinfo.duration));
+        xml.writeTextElement("Distance", QString("%1").arg(sample->u.lapinfo.distance));
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_altitude_source:
+    {
+        xml.writeStartElement("AltitudeSource");
+        xml.writeAttribute("id", QString("%1").arg(sample->u.altitude_source.source_type));
+        for (altitude_source_name = &sampleAltitudeSourceNames[0]; altitude_source_name->XMLName != ""; altitude_source_name++) {
+            if (altitude_source_name->source_id == sample->u.altitude_source.source_type) {
+                xml.writeCharacters(QString(altitude_source_name->XMLName));
+                break;
+            }
+        }
+        xml.writeEndElement();
+        xml.writeTextElement("AltitudeOffset", QString("%1").arg(sample->u.altitude_source.altitude_offset));
+        xml.writeTextElement("PressureOffset", QString("%1").arg(sample->u.altitude_source.pressure_offset));
+        break;
+    }
+    case ambit_log_sample_type_gps_base:
+    {
+        xml.writeTextElement("NavValid", QString("%1").arg(sample->u.gps_base.navvalid));
+        xml.writeTextElement("NavType", QString("%1").arg(sample->u.gps_base.navtype));
+        QDateTime dateTime(QDate(sample->u.gps_base.utc_base_time.year, sample->u.gps_base.utc_base_time.month, sample->u.gps_base.utc_base_time.day), QTime(sample->u.gps_base.utc_base_time.hour, sample->u.gps_base.utc_base_time.minute, 0).addMSecs(sample->u.gps_base.utc_base_time.msec));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTCReference", dateTime.toString("yyyy-MM-ddThh:mm:ss.zzzZ"));
+        xml.writeTextElement("Latitude", QString("%1").arg(sample->u.gps_base.latitude));
+        xml.writeTextElement("Longitude", QString("%1").arg(sample->u.gps_base.longitude));
+        xml.writeTextElement("GPSAltitude", QString("%1").arg(sample->u.gps_base.altitude));
+        xml.writeTextElement("GPSSpeed", QString("%1").arg(sample->u.gps_base.speed));
+        xml.writeTextElement("GPSHeading", QString("%1").arg(sample->u.gps_base.heading));
+        xml.writeTextElement("EHPE", QString("%1").arg(sample->u.gps_base.ehpe));
+        xml.writeTextElement("NumberOfSatellites", QString("%1").arg(sample->u.gps_base.noofsatellites));
+        xml.writeTextElement("GpsHDOP", QString("%1").arg(sample->u.gps_base.hdop));
+        xml.writeStartElement("Satellites");
+        ambit_log_gps_satellite_t *satellite;
+        for (i=0; i<sample->u.gps_base.satellites_count; i++) {
+            xml.writeStartElement("Satellite");
+            satellite = &sample->u.gps_base.satellites[i];
+            xml.writeTextElement("SV", QString("%1").arg(satellite->sv));
+            xml.writeTextElement("SNR", QString("%1").arg(satellite->snr));
+            xml.writeTextElement("State", QString("%1").arg(satellite->state));
+            xml.writeEndElement();
+        }
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_gps_small:
+    {
+        xml.writeTextElement("Latitude", QString("%1").arg(sample->u.gps_small.latitude));
+        xml.writeTextElement("Longitude", QString("%1").arg(sample->u.gps_small.longitude));
+        xml.writeTextElement("EHPE", QString("%1").arg(sample->u.gps_small.ehpe));
+        xml.writeTextElement("NumberOfSatellites", QString("%1").arg(sample->u.gps_small.noofsatellites));
+        break;
+    }
+    case ambit_log_sample_type_gps_tiny:
+    {
+        xml.writeTextElement("Latitude", QString("%1").arg(sample->u.gps_tiny.latitude));
+        xml.writeTextElement("Longitude", QString("%1").arg(sample->u.gps_tiny.longitude));
+        xml.writeTextElement("EHPE", QString("%1").arg(sample->u.gps_tiny.ehpe));
+        xml.writeTextElement("Unknown", QString("%1").arg(sample->u.gps_tiny.unknown));
+        break;
+    }
+    case ambit_log_sample_type_time:
+    {
+        QTime timeref(sample->u.time.hour, sample->u.time.minute, sample->u.time.second);
+        xml.writeTextElement("TimeRef", timeref.toString(Qt::ISODate));
+        break;
+    }
+    case ambit_log_sample_type_activity:
+        xml.writeTextElement("ActivityType", QString("%1").arg(sample->u.activity.activitytype));
+        xml.writeTextElement("CustomModeId", QString("%1").arg(sample->u.activity.custommode));
+        break;
+    case ambit_log_sample_type_position:
+        xml.writeTextElement("Latitude", QString("%1").arg(sample->u.position.latitude));
+        xml.writeTextElement("Longitude", QString("%1").arg(sample->u.position.longitude));
+        break;
+    }
+
+    xml.writeEndElement();
+
+    return true;
+}
+
+bool LogStore::XMLWriter::writePeriodicSample(ambit_log_sample_t *sample)
+{
+    int i;
+    ambit_log_sample_periodic_value_t *value;
+
+    for (i=0; i<sample->u.periodic.value_count; i++) {
+        value = &sample->u.periodic.values[i];
+
+        switch(value->type) {
+        case ambit_log_sample_periodic_type_latitude:
+            xml.writeTextElement("Latitude", QString("%1").arg(value->u.latitude));
+            break;
+        case ambit_log_sample_periodic_type_longitude:
+            xml.writeTextElement("Longitude", QString("%1").arg(value->u.longitude));
+            break;
+        case ambit_log_sample_periodic_type_distance:
+            xml.writeTextElement("Distance", QString("%1").arg(value->u.distance));
+            break;
+        case ambit_log_sample_periodic_type_speed:
+            xml.writeTextElement("Speed", QString("%1").arg(value->u.speed));
+            break;
+        case ambit_log_sample_periodic_type_hr:
+            xml.writeTextElement("HR", QString("%1").arg(value->u.hr));
+            break;
+        case ambit_log_sample_periodic_type_time:
+            xml.writeTextElement("Time", QString("%1").arg(value->u.time));
+            break;
+        case ambit_log_sample_periodic_type_gpsspeed:
+            xml.writeTextElement("GPSSpeed", QString("%1").arg(value->u.gpsspeed));
+            break;
+        case ambit_log_sample_periodic_type_wristaccspeed:
+            xml.writeTextElement("WristAccSpeed", QString("%1").arg(value->u.wristaccspeed));
+            break;
+        case ambit_log_sample_periodic_type_bikepodspeed:
+            xml.writeTextElement("BikePodSpeed", QString("%1").arg(value->u.bikepodspeed));
+            break;
+        case ambit_log_sample_periodic_type_ehpe:
+            xml.writeTextElement("EHPE", QString("%1").arg(value->u.ehpe));
+            break;
+        case ambit_log_sample_periodic_type_evpe:
+            xml.writeTextElement("EVPE", QString("%1").arg(value->u.evpe));
+            break;
+        case ambit_log_sample_periodic_type_altitude:
+            xml.writeTextElement("Altitude", QString("%1").arg(value->u.altitude));
+            break;
+        case ambit_log_sample_periodic_type_abspressure:
+            xml.writeTextElement("AbsPressure", QString("%1").arg(value->u.abspressure));
+            break;
+        case ambit_log_sample_periodic_type_energy:
+            xml.writeTextElement("EnergyConsumption", QString("%1").arg(value->u.energy));
+            break;
+        case ambit_log_sample_periodic_type_temperature:
+            xml.writeTextElement("Temperature", QString("%1").arg(value->u.temperature));
+            break;
+        case ambit_log_sample_periodic_type_charge:
+            xml.writeTextElement("BatteryCharge", QString("%1").arg(value->u.charge));
+            break;
+        case ambit_log_sample_periodic_type_gpsaltitude:
+            xml.writeTextElement("GPSAltitude", QString("%1").arg(value->u.gpsaltitude));
+            break;
+        case ambit_log_sample_periodic_type_gpsheading:
+            xml.writeTextElement("GPSHeading", QString("%1").arg(value->u.gpsheading));
+            break;
+        case ambit_log_sample_periodic_type_gpshdop:
+            xml.writeTextElement("GpsHDOP", QString("%1").arg(value->u.gpshdop));
+            break;
+        case ambit_log_sample_periodic_type_gpsvdop:
+            xml.writeTextElement("GpsVDOP", QString("%1").arg(value->u.gpsvdop));
+            break;
+        case ambit_log_sample_periodic_type_wristcadence:
+            xml.writeTextElement("WristCadence", QString("%1").arg(value->u.wristcadence));
+            break;
+        case ambit_log_sample_periodic_type_snr:
+        {
+            QString snr = QString("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x")
+                                           .arg(value->u.snr[0])
+                                           .arg(value->u.snr[1])
+                                           .arg(value->u.snr[2])
+                                           .arg(value->u.snr[3])
+                                           .arg(value->u.snr[4])
+                                           .arg(value->u.snr[5])
+                                           .arg(value->u.snr[6])
+                                           .arg(value->u.snr[7])
+                                           .arg(value->u.snr[8])
+                                           .arg(value->u.snr[9])
+                                           .arg(value->u.snr[10])
+                                           .arg(value->u.snr[11])
+                                           .arg(value->u.snr[12])
+                                           .arg(value->u.snr[13])
+                                           .arg(value->u.snr[14])
+                                           .arg(value->u.snr[15]);
+            xml.writeTextElement("SNR", snr);
+            break;
+        }
+        case ambit_log_sample_periodic_type_noofsatellites:
+            xml.writeTextElement("NumberOfSatellites", QString("%1").arg(value->u.noofsatellites));
+            break;
+        case ambit_log_sample_periodic_type_sealevelpressure:
+            xml.writeTextElement("SeaLevelPressure", QString("%1").arg(value->u.sealevelpressure));
+            break;
+        case ambit_log_sample_periodic_type_verticalspeed:
+            xml.writeTextElement("VerticalSpeed", QString("%1").arg(value->u.verticalspeed));
+            break;
+        case ambit_log_sample_periodic_type_cadence:
+            xml.writeTextElement("Cadence", QString("%1").arg(value->u.cadence));
+            break;
+        case ambit_log_sample_periodic_type_bikepower:
+            xml.writeTextElement("BikePower", QString("%1").arg(value->u.bikepower));
+            break;
+        case ambit_log_sample_periodic_type_swimingstrokecnt:
+            xml.writeTextElement("SwimmingStrokeCount", QString("%1").arg(value->u.swimingstrokecnt));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput1:
+            xml.writeTextElement("RuleOutput1", QString("%1").arg(value->u.ruleoutput1));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput2:
+            xml.writeTextElement("RuleOutput2", QString("%1").arg(value->u.ruleoutput2));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput3:
+            xml.writeTextElement("RuleOutput3", QString("%1").arg(value->u.ruleoutput3));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput4:
+            xml.writeTextElement("RuleOutput4", QString("%1").arg(value->u.ruleoutput4));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput5:
+            xml.writeTextElement("RuleOutput5", QString("%1").arg(value->u.ruleoutput5));
+            break;
+        }
+    }
+
+    return true;
+}
diff --git a/src/openambit/logstore.h b/src/openambit/logstore.h
new file mode 100644
index 0000000..adaf484
--- /dev/null
+++ b/src/openambit/logstore.h
@@ -0,0 +1,103 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef LOGSTORE_H
+#define LOGSTORE_H
+
+#include <QObject>
+#include <QDateTime>
+#include <QList>
+#include <QIODevice>
+#include <QXmlStreamReader>
+#include <QXmlStreamWriter>
+#include <libambit.h>
+
+#include "logentry.h"
+
+class LogStore : public QObject
+{
+    Q_OBJECT
+public:
+    class LogDirEntry
+    {
+    public:
+        QString device;
+        QDateTime time;
+        QString filename;
+    };
+
+    explicit LogStore(QObject *parent = 0);
+    LogEntry *store(QString device, ambit_personal_settings_t *personalSettings, ambit_log_entry_t *logEntry);
+    bool logExists(QString device, ambit_log_header_t *logHeader);
+    LogEntry *read(QString device, QDateTime time);
+    LogEntry *read(LogDirEntry dirEntry);
+    LogEntry *read(QString filename);
+    QList<LogDirEntry> dir(QString device = "");
+signals:
+    
+public slots:
+
+private:
+    QString logEntryPath(QString device, QDateTime time);
+
+    QString storagePath;
+
+    class XMLReader
+    {
+    public:
+        XMLReader(LogEntry *logEntry);
+        bool read(QIODevice *device);
+
+        QString errorString() const;
+    private:
+        void readRoot();
+        void readSerial();
+        void readTime();
+        void readPersonalSettings();
+        void readLog();
+        void readLogHeader();
+        void readLogSamples();
+        void readPeriodicSample(QList<ambit_log_sample_periodic_value_t> *valueContent);
+        QXmlStreamReader xml;
+        LogEntry *logEntry;
+    };
+
+    class XMLWriter
+    {
+    public:
+        XMLWriter(QString serial, QDateTime time, ambit_personal_settings_t *personalSettings, ambit_log_entry_t *logEntry);
+        bool write(QIODevice *device);
+
+    private:
+        bool writePersonalSettings();
+        bool writeLogEntry();
+        bool writeLogSample(ambit_log_sample_t *sample);
+        bool writePeriodicSample(ambit_log_sample_t *sample);
+
+        QString serial;
+        QDateTime time;
+        QXmlStreamWriter xml;
+        ambit_personal_settings_t *personalSettings;
+        ambit_log_entry_t *logEntry;
+    };
+};
+
+#endif // LOGSTORE_H
diff --git a/src/openambit/main.cpp b/src/openambit/main.cpp
new file mode 100644
index 0000000..f8df990
--- /dev/null
+++ b/src/openambit/main.cpp
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "mainwindow.h"
+#include <QApplication>
+#include <QSettings>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+
+    // Set application settings
+    QCoreApplication::setOrganizationName("openambit");
+    QCoreApplication::setApplicationName("openambit");
+#ifdef Q_WS_X11
+    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, "~/.openambit/openambit.conf");
+#endif
+
+    w.show();
+    
+    return a.exec();
+}
diff --git a/src/openambit/mainwindow.cpp b/src/openambit/mainwindow.cpp
new file mode 100644
index 0000000..a56545f
--- /dev/null
+++ b/src/openambit/mainwindow.cpp
@@ -0,0 +1,181 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+#include <QListWidgetItem>
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+
+    // Setup UI parts
+    QIcon warningIcon = QIcon::fromTheme("dialog-warning");
+    ui->labelNotSupportedIcon->setPixmap(warningIcon.pixmap(8,8));
+    ui->labelNotSupportedIcon->setHidden(true);
+    ui->labelNotSupported->setHidden(true);
+    ui->labelCharge->setHidden(true);
+    ui->chargeIndicator->setHidden(true);
+    ui->buttonSyncNow->setHidden(true);
+    ui->syncProgressBar->setHidden(true);
+
+    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
+
+    // Setup device manager
+    deviceManager = new DeviceManager();
+    deviceManager->moveToThread(&deviceWorkerThread);
+    qRegisterMetaType<ambit_device_info_t>("ambit_device_info_t");
+    connect(deviceManager, SIGNAL(deviceDetected(ambit_device_info_t,bool)), this, SLOT(deviceDetected(ambit_device_info_t,bool)), Qt::QueuedConnection);
+    connect(deviceManager, SIGNAL(deviceRemoved()), this, SLOT(deviceRemoved()), Qt::QueuedConnection);
+    connect(deviceManager, SIGNAL(deviceCharge(quint8)), this, SLOT(deviceCharge(quint8)), Qt::QueuedConnection);
+    connect(deviceManager, SIGNAL(syncFinished(bool)), this, SLOT(syncFinished(bool)), Qt::QueuedConnection);
+    connect(deviceManager, SIGNAL(syncProgressInform(QString,bool,quint8)), this, SLOT(syncProgressInform(QString,bool,quint8)), Qt::QueuedConnection);
+    connect(ui->buttonDeviceReload, SIGNAL(clicked()), deviceManager, SLOT(detect()));
+    connect(ui->buttonSyncNow, SIGNAL(clicked()), this, SLOT(syncNowClicked()));
+    connect(this, SIGNAL(syncNow(bool)), deviceManager, SLOT(startSync(bool)));
+    deviceWorkerThread.start();
+    deviceManager->start();
+    deviceManager->detect();
+
+    // Setup log list
+    connect(ui->logsList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(logItemSelected(QListWidgetItem*,QListWidgetItem*)));
+    ui->logsList->setContextMenuPolicy(Qt::CustomContextMenu);
+    connect(ui->logsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenuForLogItem(QPoint)));
+
+    updateLogList();
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::showSettings()
+{
+    settingsDialog = new SettingsDialog(this);
+    settingsDialog->setModal(true);
+    settingsDialog->show();
+}
+
+void MainWindow::syncNowClicked()
+{
+    ui->buttonSyncNow->setEnabled(false);
+    ui->syncProgressBar->setHidden(false);
+    ui->syncProgressBar->setValue(0);
+    emit MainWindow::syncNow(false);
+}
+
+void MainWindow::deviceDetected(ambit_device_info_t deviceInfo, bool supported)
+{
+    ui->labelDeviceDetected->setText(deviceInfo.name);
+    ui->labelSerial->setText(deviceInfo.serial);
+    if (!supported) {
+        ui->labelNotSupportedIcon->setHidden(false);
+        ui->labelNotSupported->setHidden(false);
+        ui->labelCharge->setHidden(true);
+        ui->chargeIndicator->setHidden(true);
+        ui->buttonSyncNow->setHidden(true);
+        ui->syncProgressBar->setHidden(true);
+    }
+    else {
+        ui->labelNotSupportedIcon->setHidden(true);
+        ui->labelNotSupported->setHidden(true);
+        ui->labelCharge->setHidden(false);
+        ui->chargeIndicator->setHidden(false);
+        ui->buttonSyncNow->setHidden(false);
+    }
+}
+
+void MainWindow::deviceRemoved(void)
+{
+    ui->labelDeviceDetected->setText(tr("No device detected"));
+    ui->labelSerial->setText("");
+    ui->labelNotSupportedIcon->setHidden(true);
+    ui->labelNotSupported->setHidden(true);
+    ui->labelCharge->setHidden(true);
+    ui->chargeIndicator->setHidden(true);
+    ui->buttonSyncNow->setHidden(true);
+    ui->syncProgressBar->setHidden(true);
+}
+
+void MainWindow::deviceCharge(quint8 percent)
+{
+    ui->chargeIndicator->setValue(percent);
+}
+
+void MainWindow::syncFinished(bool success)
+{
+    ui->buttonSyncNow->setEnabled(true);
+    ui->syncProgressBar->setHidden(true);
+}
+
+void MainWindow::syncProgressInform(QString message, bool newRow, quint8 percentDone)
+{
+    ui->syncProgressBar->setValue(percentDone);
+}
+
+void MainWindow::logItemSelected(QListWidgetItem *current,QListWidgetItem *previous)
+{
+    LogEntry *logEntry = NULL;
+
+    Q_UNUSED(previous);
+
+    if (current != NULL) {
+        logEntry = logStore.read(current->data(Qt::UserRole).toString());
+
+        delete logEntry;
+    }
+}
+
+void MainWindow::showContextMenuForLogItem(const QPoint &pos)
+{
+    QMenu contextMenu(tr("Context menu"), this);
+    QAction *action = new QAction(tr("Write Movescount file"), this);
+    connect(action, SIGNAL(triggered()), this, SLOT(logItemWriteMovescount()));
+    contextMenu.addAction(action);
+    contextMenu.exec(mapToGlobal(pos));
+}
+
+void MainWindow::logItemWriteMovescount()
+{
+    LogEntry *logEntry = NULL;
+
+    logEntry = logStore.read(ui->logsList->selectedItems().at(0)->data(Qt::UserRole).toString());
+    if (logEntry != NULL) {
+        movesCount.sendLog(logEntry);
+        delete logEntry;
+    }
+}
+
+void MainWindow::updateLogList()
+{
+    QList<LogStore::LogDirEntry> entries = logStore.dir();
+    ui->logsList->clear();
+    foreach (LogStore::LogDirEntry entry, entries) {
+        QListWidgetItem *item = new QListWidgetItem(entry.time.toString());
+        item->setText(entry.time.toString());
+        item->setData(Qt::UserRole, QVariant(entry.filename));
+        ui->logsList->addItem(item);
+    }
+}
diff --git a/src/openambit/mainwindow.h b/src/openambit/mainwindow.h
new file mode 100644
index 0000000..7a7ec93
--- /dev/null
+++ b/src/openambit/mainwindow.h
@@ -0,0 +1,70 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include "devicemanager.h"
+#include "settingsdialog.h"
+#include <QMainWindow>
+#include <QThread>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+    
+public:
+    explicit MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+signals:
+    void syncNow(bool readAll);
+
+private slots:
+    void showSettings();
+
+    void syncNowClicked();
+
+    void deviceDetected(ambit_device_info_t deviceInfo, bool supported);
+    void deviceRemoved();
+    void deviceCharge(quint8 percent);
+    void syncFinished(bool success);
+    void syncProgressInform(QString message, bool newRow, quint8 percentDone);
+
+    void logItemSelected(QListWidgetItem *current,QListWidgetItem *previous);
+    void showContextMenuForLogItem(const QPoint &pos);
+    void logItemWriteMovescount();
+    void updateLogList();
+    
+private:
+    Ui::MainWindow *ui;
+    SettingsDialog *settingsDialog;
+    DeviceManager *deviceManager;
+    LogStore logStore;
+    MovesCount movesCount;
+    QThread deviceWorkerThread;
+};
+
+#endif // MAINWINDOW_H
diff --git a/src/openambit/mainwindow.ui b/src/openambit/mainwindow.ui
new file mode 100644
index 0000000..c1b6e10
--- /dev/null
+++ b/src/openambit/mainwindow.ui
@@ -0,0 +1,326 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>872</width>
+    <height>542</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>openambit</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="QListWidget" name="logsList">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="horizontalSpacer">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QWidget" name="deviceSyncWidget" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>240</width>
+        <height>0</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>16777215</height>
+       </size>
+      </property>
+      <property name="layoutDirection">
+       <enum>Qt::LeftToRight</enum>
+      </property>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+       <property name="leftMargin">
+        <number>9</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QGroupBox" name="groupBox">
+         <property name="title">
+          <string>Device</string>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_2">
+          <property name="spacing">
+           <number>6</number>
+          </property>
+          <property name="leftMargin">
+           <number>9</number>
+          </property>
+          <property name="topMargin">
+           <number>0</number>
+          </property>
+          <property name="rightMargin">
+           <number>9</number>
+          </property>
+          <property name="bottomMargin">
+           <number>0</number>
+          </property>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item>
+             <widget class="QLabel" name="labelDeviceDetected">
+              <property name="maximumSize">
+               <size>
+                <width>16777215</width>
+                <height>16777215</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>No device detected</string>
+              </property>
+              <property name="alignment">
+               <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QToolButton" name="buttonDeviceReload">
+              <property name="text">
+               <string/>
+              </property>
+              <property name="icon">
+               <iconset theme="view-refresh">
+                <normaloff/>
+               </iconset>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="QLabel" name="labelSerial">
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QLabel" name="labelNotSupported">
+              <property name="enabled">
+               <bool>true</bool>
+              </property>
+              <property name="text">
+               <string>Device not supported yet!</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLabel" name="labelNotSupportedIcon">
+              <property name="text">
+               <string/>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <layout class="QHBoxLayout" name="horizontalLayoutCharge">
+            <item>
+             <widget class="QLabel" name="labelCharge">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="text">
+               <string>Charge:</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QProgressBar" name="chargeIndicator">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                <horstretch>0</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>16777215</width>
+                <height>16</height>
+               </size>
+              </property>
+              <property name="value">
+               <number>0</number>
+              </property>
+              <property name="textVisible">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item>
+           <widget class="Line" name="line">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <spacer name="verticalSpacer">
+            <property name="orientation">
+             <enum>Qt::Vertical</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>20</width>
+              <height>40</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item>
+           <widget class="QProgressBar" name="syncProgressBar">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="value">
+             <number>24</number>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QPushButton" name="buttonSyncNow">
+            <property name="text">
+             <string>Sync now</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>872</width>
+     <height>20</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuOpenambit">
+    <property name="title">
+     <string>&File</string>
+    </property>
+    <addaction name="actionSettings"/>
+    <addaction name="separator"/>
+    <addaction name="actionE_xit"/>
+   </widget>
+   <widget class="QMenu" name="menu_Help">
+    <property name="title">
+     <string>&Help</string>
+    </property>
+    <addaction name="actionAbout_openambit"/>
+   </widget>
+   <addaction name="menuOpenambit"/>
+   <addaction name="menu_Help"/>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+  <action name="actionAbout_openambit">
+   <property name="icon">
+    <iconset theme="help-about">
+     <normaloff/>
+    </iconset>
+   </property>
+   <property name="text">
+    <string>About openambit...</string>
+   </property>
+   <property name="iconText">
+    <string>About openambit...</string>
+   </property>
+   <property name="toolTip">
+    <string>About openambit...</string>
+   </property>
+  </action>
+  <action name="actionE_xit">
+   <property name="icon">
+    <iconset theme="application-exit">
+     <normaloff/>
+    </iconset>
+   </property>
+   <property name="text">
+    <string>E&xit</string>
+   </property>
+  </action>
+  <action name="actionSettings">
+   <property name="icon">
+    <iconset theme="preferences-system">
+     <normaloff/>
+    </iconset>
+   </property>
+   <property name="text">
+    <string>&Settings</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>actionE_xit</sender>
+   <signal>triggered()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>199</x>
+     <y>149</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/openambit/movescount.cpp b/src/openambit/movescount.cpp
new file mode 100644
index 0000000..f9ae122
--- /dev/null
+++ b/src/openambit/movescount.cpp
@@ -0,0 +1,804 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "movescount.h"
+#include <QFile>
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+typedef struct typename_lookup_entry_s {
+    u_int8_t id;
+    QString XMLName;
+} typename_lookup_entry_t;
+
+static typename_lookup_entry_t sampleDistanceSourceNames[] = {
+    { 0x02, "Gps" },
+    { 0x03, "Wrist" },
+    { 0, "" }
+};
+
+static typename_lookup_entry_t sampleAltitudeSourceNames[] = {
+    { 0x04, "Pressure" },
+    { 0, "" }
+};
+
+static typename_lookup_entry_t sampleLapEventTypeNames[] = {
+    { 0x01, "Manual" },
+    { 0x14, "High Interval" },
+    { 0x15, "Low Interval" },
+    { 0x16, "Interval" },
+    { 0x1e, "Pause" },
+    { 0x1f, "Start" },
+    { 0, "" }
+};
+
+static typename_lookup_entry_t sampleActivityNames[] = {
+    { 0x01, "Not Specified Sport" },
+    { 0x02, "Multisport" },
+    { 0x03, "Run" },
+    { 0x04, "Cycling" },
+    { 0x05, "Mountain Biking" },
+    { 0x06, "UNDEFINED7" },
+    { 0x07, "Skating" },
+    { 0x08, "Aerobics" },
+    { 0x09, "Yoga Pilates" },
+    { 0x0a, "Trekking" },
+    { 0x0b, "Walking" },
+    { 0x0c, "Sailing" },
+    { 0x0d, "Kayaking" },
+    { 0x0e, "Rowing" },
+    { 0x0f, "Climbing" },
+    { 0x10, "Indoor Cycling" },
+    { 0x11, "Circuit Training" },
+    { 0x12, "Triathlon" },
+    { 0x13, "Alpine Skiing" },
+    { 0x14, "Snowboarding" },
+    { 0x15, "Crosscountry Skiing" },
+    { 0x16, "Weight Training" },
+    { 0x17, "Basketball" },
+    { 0x18, "Soccer" },
+    { 0x19, "Ice Hockey" },
+    { 0x1a, "Volleyball" },
+    { 0x1b, "Football" },
+    { 0x1c, "Softball" },
+    { 0x1d, "Cheerleading" },
+    { 0x1e, "Baseball" },
+    { 0x1f, "UNDEFINED32" },
+    { 0x20, "Tennis" },
+    { 0x21, "Badminton" },
+    { 0x22, "Table Tenni" },
+    { 0x23, "Racquet Ball" },
+    { 0x24, "Squash" },
+    { 0x25, "Combat Sport" },
+    { 0x26, "Boxing" },
+    { 0x27, "Floorball" },
+    { 0x28, "UNDEFINED41" },
+    { 0x29, "UNDEFINED42" },
+    { 0x2a, "UNDEFINED43" },
+    { 0x2b, "UNDEFINED44" },
+    { 0x2c, "UNDEFINED45" },
+    { 0x2d, "UNDEFINED46" },
+    { 0x2e, "UNDEFINED47" },
+    { 0x2f, "UNDEFINED48" },
+    { 0x30, "UNDEFINED49" },
+    { 0x31, "UNDEFINED50" },
+    { 0x32, "Scuba Diving" },
+    { 0x33, "Free Diving" },
+    { 0x34, "UNDEFINED53" },
+    { 0x35, "UNDEFINED54" },
+    { 0x36, "UNDEFINED55" },
+    { 0x37, "UNDEFINED56" },
+    { 0x38, "UNDEFINED57" },
+    { 0x39, "UNDEFINED58" },
+    { 0x3a, "UNDEFINED59" },
+    { 0x3b, "UNDEFINED60" },
+    { 0x3c, "Adventure Racing" },
+    { 0x3d, "Bowling" },
+    { 0x3e, "Cricket" },
+    { 0x3f, "Crosstrainer" },
+    { 0x40, "Dancing" },
+    { 0x41, "Golf" },
+    { 0x42, "Gymnastics" },
+    { 0x43, "Handball" },
+    { 0x44, "Horseback Riding" },
+    { 0x45, "Ice Skating" },
+    { 0x46, "Indoor Rowing" },
+    { 0x47, "Canoeing" },
+    { 0x48, "Motorsports" },
+    { 0x49, "Mountaineering" },
+    { 0x4a, "Orienteering" },
+    { 0x4b, "Rugby" },
+    { 0x4c, "UNDEFINED77" },
+    { 0x4d, "Ski Touring" },
+    { 0x4e, "Stretching" },
+    { 0x4f, "Telemark Skiing" },
+    { 0x50, "Track And Field" },
+    { 0x51, "Trail Running" },
+    { 0x52, "Openwater Swimming" },
+    { 0x53, "UNDEFINED84" },
+    { 0x54, "UNDEFINED85" },
+    { 0x55, "UNDEFINED86" },
+    { 0x56, "UNDEFINED87" },
+    { 0x57, "UNDEFINED88" },
+    { 0x58, "UNDEFINED89" },
+    { 0x59, "UNDEFINED90" },
+    { 0x5a, "UNDEFINED91" },
+    { 0x5b, "UNDEFINED92" },
+    { 0x5c, "UNDEFINED93" },
+    { 0x5d, "UNDEFINED94" },
+    { 0x5e, "UNDEFINED95" },
+    { 0x5f, "UNDEFINED96" },
+    { 0x60, "UNDEFINED97" },
+    { 0x61, "UNDEFINED98" },
+    { 0x62, "UNDEFINED99" },
+    { 0x63, "Other" },
+    { 0x64, "Butterfly" },
+    { 0x65, "Backstroke" },
+    { 0x66, "Breaststroke" },
+    { 0x67, "Freestyle" },
+    { 0x68, "Drill" },
+    { 0, "" }
+};
+
+MovesCount::MovesCount(QObject *parent) :
+    QObject(parent)
+{
+    storagePath = QString(getenv("HOME")) + "/.openambit/movescount";
+}
+
+void MovesCount::sendLog(LogEntry *logEntry)
+{
+    XMLWriter writer(logEntry);
+    QFile logfile(logEntryPath(logEntry));
+    logfile.open(QIODevice::WriteOnly | QIODevice::Truncate);
+
+    writer.write(&logfile);
+
+    logfile.close();
+}
+
+QString MovesCount::logEntryPath(LogEntry *logEntry)
+{
+    return storagePath + "/log-" + logEntry->device + "-" + logEntry->time.toString("yyyy-MM-ddThh_mm_ss") + "-0.log";
+}
+
+MovesCount::XMLWriter::XMLWriter(LogEntry *logEntry) :
+    logEntry(logEntry)
+{
+    xml.setAutoFormatting(true);
+    xml.setAutoFormattingIndent(-1);
+}
+
+bool MovesCount::XMLWriter::write(QIODevice *device)
+{
+    bool ret = true;
+
+    xml.setDevice(device);
+
+    xml.writeStartDocument();
+    ret = writeLogEntry();
+    xml.writeEndDocument();
+
+    return ret;
+}
+
+bool MovesCount::XMLWriter::writeLogEntry()
+{
+    u_int32_t i;
+
+    xml.writeStartElement("header");
+    xml.writeTextElement("Duration", QString::number((double)logEntry->logEntry->header.duration/1000.0, 'g', 16));
+    xml.writeTextElement("Ascent", QString("%1").arg(logEntry->logEntry->header.ascent));
+    xml.writeTextElement("Descent", QString("%1").arg(logEntry->logEntry->header.descent));
+    xml.writeTextElement("AscentTime", QString::number((double)logEntry->logEntry->header.ascent_time/1000.0, 'g', 16));
+    xml.writeTextElement("DescentTime", QString::number((double)logEntry->logEntry->header.descent_time/1000.0, 'g', 16));
+    xml.writeTextElement("RecoveryTime", QString::number((double)logEntry->logEntry->header.recovery_time/1000.0, 'g', 16));
+    xml.writeStartElement("Speed");
+    xml.writeTextElement("Avg", QString::number((double)logEntry->logEntry->header.speed_avg/3600.0, 'g', 16));
+    xml.writeTextElement("Max", QString::number((double)logEntry->logEntry->header.speed_max/3600.0, 'g', 16));
+    xml.writeTextElement("MaxTime", QString::number((double)logEntry->logEntry->header.speed_max_time/1000.0, 'g', 16));
+    xml.writeEndElement();
+    // We have no idea about cadence yet, but we better include an empty tag!
+    xml.writeStartElement("Cadence");
+    xml.writeTextElement("MaxTime", QString::number(0));
+    xml.writeEndElement();
+    xml.writeStartElement("Altitude");
+    xml.writeTextElement("Max", QString("%1").arg(logEntry->logEntry->header.altitude_max));
+    xml.writeTextElement("Min", QString("%1").arg(logEntry->logEntry->header.altitude_min));
+    xml.writeTextElement("MaxTime", QString::number((double)logEntry->logEntry->header.altitude_max_time/1000.0, 'g', 16));
+    xml.writeTextElement("MinTime", QString::number((double)logEntry->logEntry->header.altitude_min_time/1000.0, 'g', 16));
+    xml.writeEndElement();
+    // Only include HR if heartrate seems to be present
+    if (logEntry->logEntry->header.heartrate_avg != 0) {
+        xml.writeStartElement("HR");
+        xml.writeTextElement("Avg", QString::number((double)logEntry->logEntry->header.heartrate_avg/logEntry->personalSettings->rest_hr, 'g', 16));
+        xml.writeTextElement("Max", QString::number((double)logEntry->logEntry->header.heartrate_max/logEntry->personalSettings->rest_hr, 'g', 16));
+        xml.writeTextElement("Min", QString::number((double)logEntry->logEntry->header.heartrate_min/logEntry->personalSettings->rest_hr, 'g', 16));
+        xml.writeTextElement("MaxTime", QString::number((double)logEntry->logEntry->header.heartrate_max_time/1000.0, 'g', 16));
+        xml.writeTextElement("MinTime", QString::number((double)logEntry->logEntry->header.heartrate_min_time/1000.0, 'g', 16));
+        xml.writeEndElement();
+        xml.writeTextElement("PeakTrainingEffect", QString::number((double)logEntry->logEntry->header.peak_training_effect/10.0, 'g', 16));
+    }
+    xml.writeTextElement("ActivityType", QString("%1").arg(logEntry->logEntry->header.activity_type));
+    xml.writeTextElement("Activity", QString(logEntry->logEntry->header.activity_name));
+    xml.writeStartElement("Temperature");
+    xml.writeTextElement("Max", QString::number((double)logEntry->logEntry->header.temperature_max/10.0 + 273.15, 'g', 16));
+    xml.writeTextElement("Min", QString::number((double)logEntry->logEntry->header.temperature_min/10.0 + 273.15, 'g', 16));
+    xml.writeTextElement("MaxTime", QString::number((double)logEntry->logEntry->header.temperature_max_time/1000.0, 'g', 16));
+    xml.writeTextElement("MinTime", QString::number((double)logEntry->logEntry->header.temperature_min_time/1000.0, 'g', 16));
+    xml.writeEndElement();
+    xml.writeTextElement("Distance", QString("%1").arg(logEntry->logEntry->header.distance));
+    xml.writeTextElement("LogItemCount", QString("%1").arg(logEntry->logEntry->header.samples_count));
+    // Only include energy if heartrate seems to be present
+    if (logEntry->logEntry->header.heartrate_avg != 0) {
+        xml.writeTextElement("Energy", QString::number((double)logEntry->logEntry->header.energy_consumption*4186.8, 'g', 16)); // kcal to Joule
+    }
+    xml.writeTextElement("TimeToFirstFix", QString::number((double)logEntry->logEntry->header.first_fix_time/1000.0, 'g', 16));
+    xml.writeTextElement("BatteryChargeAtStart", QString::number((double)logEntry->logEntry->header.battery_start/100.0, 'g', 16));
+    xml.writeTextElement("BatteryCharge", QString::number((double)logEntry->logEntry->header.battery_end/100.0, 'g', 16));
+    xml.writeTextElement("DistanceBeforeCalibrationChange", QString("%1").arg(logEntry->logEntry->header.distance_before_calib));
+    QDateTime dateTime(QDate(logEntry->logEntry->header.date_time.year,
+                             logEntry->logEntry->header.date_time.month,
+                             logEntry->logEntry->header.date_time.day),
+                       QTime(logEntry->logEntry->header.date_time.hour,
+                             logEntry->logEntry->header.date_time.minute, 0).addMSecs(logEntry->logEntry->header.date_time.msec));
+    xml.writeTextElement("DateTime", dateTime.toString(Qt::ISODate));
+    xml.writeEndElement();
+    QList<quint16> ibis;
+    xml.writeStartElement("Samples");
+    QList<int> order = rearrangeSamples();
+    foreach(int index, order) {
+        writeLogSample(&logEntry->logEntry->samples[index], &ibis);
+    }
+
+    xml.writeEndElement();
+    if (ibis.count() > 0) {
+        xml.writeStartElement("IBI");
+        for (i=0; i<(u_int32_t)ibis.count(); i++) {
+            if (i > 0) {
+                xml.writeCharacters(" ");
+            }
+            xml.writeCharacters(QString("%1").arg(ibis.at(i)));
+        }
+        xml.writeEndElement();
+    }
+
+    return true;
+}
+
+bool MovesCount::XMLWriter::writeLogSample(ambit_log_sample_t *sample, QList<quint16> *ibis)
+{
+    typename_lookup_entry_t *name_lookup;
+    int i;
+
+    switch(sample->type) {
+    case ambit_log_sample_type_periodic:
+        xml.writeStartElement("Sample");
+        writePeriodicSample(sample);
+        xml.writeEndElement();
+        break;
+    case ambit_log_sample_type_logpause:
+    {
+        //! TODO: Unknown representation!
+        break;
+    }
+    case ambit_log_sample_type_logrestart:
+    {
+        //! TODO: Unknown representation!
+        break;
+    }
+    case ambit_log_sample_type_ibi:
+        for (i=0; i<sample->u.ibi.ibi_count; i++) {
+            ibis->append(sample->u.ibi.ibi[i]);
+        }
+        break;
+    case ambit_log_sample_type_ttff:
+        /* Unknown! */
+        break;
+    case ambit_log_sample_type_distance_source:
+    {
+        xml.writeStartElement("Sample");
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        xml.writeStartElement("Events");
+        xml.writeStartElement("Distance");
+        xml.writeStartElement("Source");
+        for (name_lookup = &sampleDistanceSourceNames[0]; name_lookup->XMLName != ""; name_lookup++) {
+            if (name_lookup->id == sample->u.distance_source) {
+                xml.writeCharacters(QString(name_lookup->XMLName));
+                break;
+            }
+        }
+        xml.writeEndElement();
+        QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addMSecs(sample->utc_time.msec));
+        dateTime.setTimeSpec(Qt::UTC);
+        if (sample->u.distance_source == 0x02) {
+            // Only include UTC time for GPS source
+            xml.writeTextElement("UTC", dateTimeString(dateTime));
+        }
+        xml.writeEndElement();
+        xml.writeEndElement();
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_lapinfo:
+    {
+        xml.writeStartElement("Sample");
+        QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addMSecs(sample->utc_time.msec));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        xml.writeStartElement("Events");
+        if (sample->u.lapinfo.event_type == 0x1e || sample->u.lapinfo.event_type == 0x1f) {
+            xml.writeStartElement("Pause");
+            xml.writeTextElement("Type", QString("%1").arg(sample->u.lapinfo.event_type));
+            xml.writeTextElement("Duration", QString::number((double)sample->u.lapinfo.duration/1000.0, 'g', 16));
+            xml.writeTextElement("Distance", QString("%1").arg(sample->u.lapinfo.distance));
+            xml.writeTextElement("State", sample->u.lapinfo.event_type == 0x1e ? "True" : "False");
+            xml.writeEndElement();
+        }
+        else {
+            xml.writeStartElement("Lap");
+            xml.writeStartElement("Type");
+            for (name_lookup = &sampleLapEventTypeNames[0]; name_lookup->XMLName != ""; name_lookup++) {
+                if (name_lookup->id == sample->u.lapinfo.event_type) {
+                    xml.writeCharacters(QString(name_lookup->XMLName));
+                }
+            }
+            xml.writeEndElement();
+            xml.writeTextElement("Duration", QString::number((double)sample->u.lapinfo.duration/1000.0, 'g', 16));
+            xml.writeTextElement("Distance", QString("%1").arg(sample->u.lapinfo.distance));
+            xml.writeEndElement();
+        }
+        xml.writeEndElement();
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_altitude_source:
+    {
+        xml.writeStartElement("Sample");
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        xml.writeStartElement("Events");
+        xml.writeStartElement("Altitude");
+        xml.writeStartElement("Source");
+        for (name_lookup = &sampleAltitudeSourceNames[0]; name_lookup->XMLName != ""; name_lookup++) {
+            if (name_lookup->id == sample->u.altitude_source.source_type) {
+                xml.writeCharacters(QString(name_lookup->XMLName));
+                break;
+            }
+        }
+        xml.writeEndElement();
+        xml.writeTextElement("AltitudeOffset", QString("%1").arg(sample->u.altitude_source.altitude_offset));
+        xml.writeTextElement("PressureOffset", QString("%1").arg(sample->u.altitude_source.pressure_offset*10));
+        QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addMSecs(sample->utc_time.msec));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeEndElement();
+        xml.writeEndElement();
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_gps_base:
+    {
+        xml.writeStartElement("Sample");
+        QString sprintfer;
+        QString navtype = sprintfer.sprintf("0x%04x", sample->u.gps_base.navtype);
+        xml.writeTextElement("NavType", navtype);
+        if (sample->u.gps_base.navvalid == 0x0000) {
+            xml.writeTextElement("NavValid", "validated");
+        }
+        else {
+            xml.writeTextElement("NavValid", "not validated");
+        }
+        QString navTypeExplanation;
+
+        if ((sample->u.gps_base.navtype & 0x0007) == 0) {
+            navTypeExplanation = "no fix";
+        }
+        else {
+            switch ((sample->u.gps_base.navtype & 0x0007)) {
+            case 0x01:
+                navTypeExplanation = "1-SV KF solution";
+                break;
+            case 0x02:
+                navTypeExplanation = "2-SV KF solution";
+                break;
+            case 0x03:
+                navTypeExplanation = "3-SV KF solution";
+                break;
+            case 0x04:
+                navTypeExplanation = "4 or more SV KF solution";
+                break;
+            case 0x05:
+                navTypeExplanation = "2-D least-squares solution";
+                break;
+            case 0x06:
+                navTypeExplanation = "3-D least-squares solution";
+                break;
+            case 0x07:
+                navTypeExplanation = "DR solution (see bits 8, 14-15)";
+                break;
+            }
+            if ((sample->u.gps_base.navtype & 0x0008)) {
+                navTypeExplanation += ", trickle";
+            }
+            switch ((sample->u.gps_base.navtype & 0x0030) >> 4) {
+            case 0x01:
+                navTypeExplanation += ", KF alti hold";
+                break;
+            case 0x02:
+                navTypeExplanation += ", user alti hold";
+                break;
+            case 0x03:
+                navTypeExplanation += ", always alti hold";
+                break;
+            }
+            if ((sample->u.gps_base.navtype & 0x0040)) {
+                navTypeExplanation += ", DOP exceeded";
+            }
+            if ((sample->u.gps_base.navtype & 0x0080)) {
+                navTypeExplanation += ", DGPS corr";
+            }
+            if ((sample->u.gps_base.navtype & 0x0200)) {
+                navTypeExplanation += ", overdetermined";
+            }
+            if ((sample->u.gps_base.navtype & 0x0400)) {
+                navTypeExplanation += ", velo DR timeout";
+            }
+            if ((sample->u.gps_base.navtype & 0x1000)) {
+                navTypeExplanation += ", invalid velocity";
+            }
+            if ((sample->u.gps_base.navtype & 0x2000)) {
+                navTypeExplanation += ", alti hold disabled";
+            }
+        }
+        xml.writeTextElement("NavTypeExplanation", navTypeExplanation);
+        xml.writeStartElement("Satellites");
+        ambit_log_gps_satellite_t *satellite;
+        for (i=0; i<sample->u.gps_base.satellites_count; i++) {
+            xml.writeStartElement("Satellite");
+            satellite = &sample->u.gps_base.satellites[i];
+            xml.writeTextElement("SV", QString("%1").arg(satellite->sv));
+            xml.writeTextElement("SNR", QString("%1").arg(satellite->snr));
+            //! TODO: What parts of state should be used to determine this!?
+            if (satellite->state & 0x20) {
+                xml.writeTextElement("CodeLocked", "true");
+            }
+            else {
+                xml.writeTextElement("CodeLocked", "false");
+            }
+            if (satellite->state & 0x80) {
+                xml.writeTextElement("Ephemeris", "true");
+            }
+            else {
+                xml.writeTextElement("Ephemeris", "false");
+            }
+            QString stateText;
+            if (satellite->state == 0) {
+                stateText = "State 0";
+            }
+            else {
+                stateText = sprintfer.sprintf("State 0x%02x", satellite->state);
+            }
+            xml.writeTextElement("Custom", stateText);
+            xml.writeEndElement();
+        }
+        xml.writeEndElement();
+        xml.writeTextElement("GPSAltitude", QString::number((double)sample->u.gps_base.altitude/100.0, 'g', 16));
+        xml.writeTextElement("GPSHeading", QString::number((double)sample->u.gps_base.heading*M_PI/180/100, 'g', 16));
+        xml.writeTextElement("GPSSpeed", QString::number((double)sample->u.gps_base.speed/100.0, 'g', 16));
+        xml.writeTextElement("GpsHDOP", QString::number((double)sample->u.gps_base.hdop/5.0, 'g', 16));
+        xml.writeTextElement("NumberOfSatellites", QString("%1").arg(sample->u.gps_base.noofsatellites));
+        xml.writeTextElement("Latitude", QString::number((double)sample->u.gps_base.latitude*M_PI/180/10000000, 'g', 16)); // degrees -> radians
+        xml.writeTextElement("Longitude", QString::number((double)sample->u.gps_base.longitude*M_PI/180/10000000, 'g', 16)); // degrees -> radians
+        xml.writeTextElement("EHPE", QString::number((double)sample->u.gps_base.ehpe/100.0, 'g', 16));
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        QDateTime dateTime(QDate(sample->u.gps_base.utc_base_time.year, sample->u.gps_base.utc_base_time.month, sample->u.gps_base.utc_base_time.day), QTime(sample->u.gps_base.utc_base_time.hour, sample->u.gps_base.utc_base_time.minute, 0).addMSecs(sample->u.gps_base.utc_base_time.msec));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeTextElement("SampleType", "gps-base");
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_gps_small:
+    {
+        xml.writeStartElement("Sample");
+        xml.writeTextElement("NumberOfSatellites", QString("%1").arg(sample->u.gps_small.noofsatellites));
+        xml.writeTextElement("Latitude", QString::number((double)sample->u.gps_small.latitude*M_PI/180/10000000, 'g', 16));
+        xml.writeTextElement("Longitude", QString::number((double)sample->u.gps_small.longitude*M_PI/180/10000000, 'g', 16));
+        xml.writeTextElement("EHPE", QString::number((double)sample->u.gps_small.ehpe/100.0, 'g', 16));
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        // "Mimic" moveslinks strange second handling
+        int seconds = sample->utc_time.msec/1000;
+        if ((sample->utc_time.msec % 1000) >= 100) {
+            seconds++;
+        }
+        QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addSecs(seconds));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeTextElement("SampleType", "gps-small");
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_gps_tiny:
+    {
+        xml.writeStartElement("Sample");
+        xml.writeTextElement("Latitude", QString::number((double)sample->u.gps_tiny.latitude*M_PI/180/10000000, 'g', 16));
+        xml.writeTextElement("Longitude", QString::number((double)sample->u.gps_tiny.longitude*M_PI/180/10000000, 'g', 16));
+        xml.writeTextElement("EHPE", QString::number((double)sample->u.gps_tiny.ehpe/100.0, 'g', 16));
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        // "Mimic" moveslinks strange second handling
+        int seconds = sample->utc_time.msec/1000;
+        if ((sample->utc_time.msec % 1000) >= 100) {
+            seconds++;
+        }
+        QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addSecs(seconds));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeTextElement("SampleType", "gps-tiny");
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_time:
+    {
+        //! TODO: Unknown representation!
+        break;
+    }
+    case ambit_log_sample_type_activity:
+    {
+        xml.writeStartElement("Sample");
+        xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+        xml.writeStartElement("Events");
+        xml.writeStartElement("Activity");
+        xml.writeTextElement("CustomModeId", QString("%1").arg(sample->u.activity.custommode));
+        xml.writeStartElement("Type");
+        typename_lookup_entry_t *name_lookup;
+        for (name_lookup = &sampleActivityNames[0]; name_lookup->XMLName != ""; name_lookup++) {
+            if (name_lookup->id == sample->u.activity.activitytype) {
+                xml.writeCharacters(QString(name_lookup->XMLName));
+                break;
+            }
+        }
+        xml.writeEndElement();
+        xml.writeEndElement();
+        xml.writeEndElement();
+        QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addMSecs(sample->utc_time.msec));
+        dateTime.setTimeSpec(Qt::UTC);
+        xml.writeTextElement("UTC", dateTimeString(dateTime));
+        xml.writeEndElement();
+        break;
+    }
+    case ambit_log_sample_type_position:
+        //! TODO: Unknown representation!
+        break;
+    }
+
+    return true;
+}
+
+bool MovesCount::XMLWriter::writePeriodicSample(ambit_log_sample_t *sample)
+{
+    int i;
+    ambit_log_sample_periodic_value_t *value;
+
+    for (i=0; i<sample->u.periodic.value_count; i++) {
+        value = &sample->u.periodic.values[i];
+
+        switch(value->type) {
+        case ambit_log_sample_periodic_type_latitude:
+            xml.writeTextElement("Latitude", QString::number((double)value->u.latitude*M_PI/180/10000000, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_longitude:
+            xml.writeTextElement("Longitude", QString::number((double)value->u.longitude*M_PI/180/10000000, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_distance:
+            xml.writeTextElement("Distance", QString("%1").arg(value->u.distance));
+            break;
+        case ambit_log_sample_periodic_type_speed:
+            xml.writeTextElement("Speed", QString::number((double)value->u.speed/100.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_hr:
+            xml.writeTextElement("HR", QString::number((double)value->u.hr/logEntry->personalSettings->rest_hr, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_time:
+            xml.writeTextElement("Time", QString::number((double)value->u.time/1000.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_gpsspeed:
+            xml.writeTextElement("GPSSpeed", QString::number((double)value->u.gpsspeed/100.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_wristaccspeed:
+            xml.writeTextElement("WristAccSpeed", QString::number((double)value->u.wristaccspeed/100.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_bikepodspeed:
+            xml.writeTextElement("BikePodSpeed", QString::number((double)value->u.bikepodspeed/100.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_ehpe:
+            xml.writeTextElement("EHPE", QString("%1").arg(value->u.ehpe));
+            break;
+        case ambit_log_sample_periodic_type_evpe:
+            xml.writeTextElement("EVPE", QString("%1").arg(value->u.evpe));
+            break;
+        case ambit_log_sample_periodic_type_altitude:
+            xml.writeTextElement("Altitude", QString("%1").arg(value->u.altitude));
+            break;
+        case ambit_log_sample_periodic_type_abspressure:
+            xml.writeTextElement("AbsPressure", QString("%1").arg(value->u.abspressure*10));
+            break;
+        case ambit_log_sample_periodic_type_energy:
+            xml.writeTextElement("EnergyConsumption", QString::number((double)value->u.energy*6.978, 'g', 16)); // WTF is this unit!?
+            break;
+        case ambit_log_sample_periodic_type_temperature:
+            xml.writeTextElement("Temperature", QString::number((double)value->u.temperature/10.0 + 273.15, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_charge:
+            xml.writeTextElement("BatteryCharge", QString::number((double)value->u.charge/100.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_gpsaltitude:
+            xml.writeTextElement("GPSAltitude", QString("%1").arg(value->u.gpsaltitude));
+            break;
+        case ambit_log_sample_periodic_type_gpsheading:
+            xml.writeTextElement("GPSHeading", QString::number((double)value->u.gpsheading*M_PI/180/10000000, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_gpshdop:
+            xml.writeTextElement("GpsHDOP", QString("%1").arg(value->u.gpshdop));
+            break;
+        case ambit_log_sample_periodic_type_gpsvdop:
+            xml.writeTextElement("GpsVDOP", QString("%1").arg(value->u.gpsvdop));
+            break;
+        case ambit_log_sample_periodic_type_wristcadence:
+            xml.writeTextElement("WristCadence", QString("%1").arg(value->u.wristcadence));
+            break;
+        case ambit_log_sample_periodic_type_snr:
+        {
+            QString snr = QString("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x")
+                                           .arg(value->u.snr[0])
+                                           .arg(value->u.snr[1])
+                                           .arg(value->u.snr[2])
+                                           .arg(value->u.snr[3])
+                                           .arg(value->u.snr[4])
+                                           .arg(value->u.snr[5])
+                                           .arg(value->u.snr[6])
+                                           .arg(value->u.snr[7])
+                                           .arg(value->u.snr[8])
+                                           .arg(value->u.snr[9])
+                                           .arg(value->u.snr[10])
+                                           .arg(value->u.snr[11])
+                                           .arg(value->u.snr[12])
+                                           .arg(value->u.snr[13])
+                                           .arg(value->u.snr[14])
+                                           .arg(value->u.snr[15]);
+            xml.writeTextElement("SNR", snr);
+            break;
+        }
+        case ambit_log_sample_periodic_type_noofsatellites:
+            xml.writeTextElement("NumberOfSatellites", QString("%1").arg(value->u.noofsatellites));
+            break;
+        case ambit_log_sample_periodic_type_sealevelpressure:
+            xml.writeTextElement("SeaLevelPressure", QString("%1").arg(value->u.sealevelpressure*10));
+            break;
+        case ambit_log_sample_periodic_type_verticalspeed:
+            xml.writeTextElement("VerticalSpeed", QString::number((double)value->u.verticalspeed/100.0, 'g', 16));
+            break;
+        case ambit_log_sample_periodic_type_cadence:
+            xml.writeTextElement("Cadence", QString("%1").arg(value->u.cadence));
+            break;
+        case ambit_log_sample_periodic_type_bikepower:
+            xml.writeTextElement("BikePower", QString("%1").arg(value->u.bikepower));
+            break;
+        case ambit_log_sample_periodic_type_swimingstrokecnt:
+            xml.writeTextElement("SwimmingStrokeCount", QString("%1").arg(value->u.swimingstrokecnt));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput1:
+            xml.writeTextElement("RuleOutput1", QString("%1").arg(value->u.ruleoutput1));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput2:
+            xml.writeTextElement("RuleOutput2", QString("%1").arg(value->u.ruleoutput2));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput3:
+            xml.writeTextElement("RuleOutput3", QString("%1").arg(value->u.ruleoutput3));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput4:
+            xml.writeTextElement("RuleOutput4", QString("%1").arg(value->u.ruleoutput4));
+            break;
+        case ambit_log_sample_periodic_type_ruleoutput5:
+            xml.writeTextElement("RuleOutput5", QString("%1").arg(value->u.ruleoutput5));
+            break;
+        }
+    }
+
+    xml.writeTextElement("Time", QString::number((double)sample->time/1000.0, 'g', 16));
+    xml.writeTextElement("SampleType", "periodic");
+    QDateTime dateTime(QDate(sample->utc_time.year, sample->utc_time.month, sample->utc_time.day), QTime(sample->utc_time.hour, sample->utc_time.minute, 0).addMSecs(sample->utc_time.msec));
+    dateTime.setTimeSpec(Qt::UTC);
+    xml.writeTextElement("UTC", dateTimeString(dateTime));
+
+    return true;
+}
+
+QString MovesCount::XMLWriter::dateTimeString(QDateTime &dateTime)
+{
+    if (dateTime.time().msec() != 0) {
+        return dateTime.toString("yyyy-MM-ddThh:mm:ss.zzzZ");
+    }
+    else {
+        return dateTime.toString("yyyy-MM-ddThh:mm:ssZ");
+    }
+}
+
+QList<int> MovesCount::XMLWriter::rearrangeSamples()
+{
+    QList<int> sampleList;
+    u_int32_t index = 0;
+    u_int32_t lastMatching = 0;
+
+    while (index < logEntry->logEntry->samples_count) {
+        // First find all entries with the same time
+        lastMatching = index;
+        while (lastMatching + 1 < logEntry->logEntry->samples_count &&
+               logEntry->logEntry->samples[index].time == logEntry->logEntry->samples[lastMatching+1].time) {
+            lastMatching++;
+        }
+
+        // Put start/stop at top
+        for (u_int32_t i=index; i<=lastMatching; i++) {
+            if (logEntry->logEntry->samples[i].type == ambit_log_sample_type_lapinfo &&
+                (logEntry->logEntry->samples[i].u.lapinfo.event_type == 0x1e ||
+                 logEntry->logEntry->samples[i].u.lapinfo.event_type == 0x1f)) {
+                sampleList.append(i);
+            }
+        }
+
+        // Then any gps-entries
+        for (u_int32_t i=index; i<=lastMatching; i++) {
+            if (logEntry->logEntry->samples[i].type == ambit_log_sample_type_gps_base ||
+                logEntry->logEntry->samples[i].type == ambit_log_sample_type_gps_small ||
+                logEntry->logEntry->samples[i].type == ambit_log_sample_type_gps_tiny) {
+                sampleList.append(i);
+            }
+        }
+
+        // Then periodic samples
+        for (u_int32_t i=index; i<=lastMatching; i++) {
+            if (logEntry->logEntry->samples[i].type == ambit_log_sample_type_periodic) {
+                sampleList.append(i);
+            }
+        }
+
+        // Then any other!
+        for (u_int32_t i=index; i<=lastMatching; i++) {
+            if (logEntry->logEntry->samples[i].type != ambit_log_sample_type_gps_base &&
+                logEntry->logEntry->samples[i].type != ambit_log_sample_type_gps_small &&
+                logEntry->logEntry->samples[i].type != ambit_log_sample_type_gps_tiny &&
+                logEntry->logEntry->samples[i].type != ambit_log_sample_type_periodic &&
+                !(logEntry->logEntry->samples[i].type == ambit_log_sample_type_lapinfo &&
+                    (logEntry->logEntry->samples[i].u.lapinfo.event_type == 0x1e ||
+                     logEntry->logEntry->samples[i].u.lapinfo.event_type == 0x1f))) {
+                sampleList.append(i);
+            }
+        }
+
+        index = lastMatching + 1;
+    }
+
+    return sampleList;
+}
diff --git a/src/openambit/movescount.h b/src/openambit/movescount.h
new file mode 100644
index 0000000..626c8a5
--- /dev/null
+++ b/src/openambit/movescount.h
@@ -0,0 +1,66 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef MOVESCOUNT_H
+#define MOVESCOUNT_H
+
+#include <QObject>
+#include <QList>
+#include <QIODevice>
+#include <QXmlStreamWriter>
+#include "logentry.h"
+
+class MovesCount : public QObject
+{
+    Q_OBJECT
+public:
+    explicit MovesCount(QObject *parent = 0);
+    
+signals:
+    
+public slots:
+    void sendLog(LogEntry *logEntry);
+
+private:
+    QString logEntryPath(LogEntry *logEntry);
+
+    QString storagePath;
+
+    class XMLWriter
+    {
+    public:
+        XMLWriter(LogEntry *logEntry);
+        bool write(QIODevice *device);
+
+    private:
+        bool writeLogEntry();
+        bool writeLogSample(ambit_log_sample_t *sample, QList<quint16> *ibis);
+        bool writePeriodicSample(ambit_log_sample_t *sample);
+
+        QString dateTimeString(QDateTime &dateTime);
+        QList<int> rearrangeSamples();
+
+        LogEntry *logEntry;
+        QXmlStreamWriter xml;
+    };
+};
+
+#endif // MOVESCOUNT_H
diff --git a/src/openambit/openambit.pro b/src/openambit/openambit.pro
new file mode 100644
index 0000000..2ba0508
--- /dev/null
+++ b/src/openambit/openambit.pro
@@ -0,0 +1,38 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2013-11-24T20:10:24
+#
+#-------------------------------------------------
+
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = openambit
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+        mainwindow.cpp \
+    devicemanager.cpp \
+    settingsdialog.cpp \
+    settings.cpp \
+    logstore.cpp \
+    logentry.cpp \
+    movescount.cpp
+
+HEADERS  += mainwindow.h \
+    devicemanager.h \
+    settingsdialog.h \
+    settings.h \
+    logstore.h \
+    logentry.h \
+    movescount.h
+
+FORMS    += mainwindow.ui \
+    settingsdialog.ui
+
+INCLUDEPATH += ../libambit
+QMAKE_LIBDIR += ../build/libambit
+
+LIBS += -lambit
diff --git a/src/openambit/settings.cpp b/src/openambit/settings.cpp
new file mode 100644
index 0000000..a413cd5
--- /dev/null
+++ b/src/openambit/settings.cpp
@@ -0,0 +1,32 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "settings.h"
+#include <QString>
+
+Settings::Settings(QObject *parent) :
+#ifdef Q_OS_LINUX
+    QSettings(QString(getenv("HOME")) + "/.openambit/openambit.conf", NativeFormat, parent)
+#else
+    QSettings(parent)
+#endif
+{
+}
diff --git a/src/openambit/settings.h b/src/openambit/settings.h
new file mode 100644
index 0000000..0f1e307
--- /dev/null
+++ b/src/openambit/settings.h
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
+#include <QSettings>
+
+class Settings : public QSettings
+{
+    Q_OBJECT
+public:
+    explicit Settings(QObject *parent = 0);
+    
+signals:
+    
+public slots:
+    
+};
+
+#endif // SETTINGS_H
diff --git a/src/openambit/settingsdialog.cpp b/src/openambit/settingsdialog.cpp
new file mode 100644
index 0000000..6d7710e
--- /dev/null
+++ b/src/openambit/settingsdialog.cpp
@@ -0,0 +1,106 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#include "settingsdialog.h"
+#include "ui_settingsdialog.h"
+
+SettingsDialog::SettingsDialog(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::SettingsDialog)
+{
+    ui->setupUi(this);
+
+    readSettings();
+
+    showHideUserSettings();
+
+    connect(ui->listSettingGroups, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
+    connect(ui->checkBoxMovescountEnable, SIGNAL(clicked()), this, SLOT(showHideUserSettings()));
+}
+
+SettingsDialog::~SettingsDialog()
+{
+    delete ui;
+}
+
+void SettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
+{
+    if (!current)
+        current = previous;
+
+    ui->stackedWidget->setCurrentIndex(ui->listSettingGroups->row(current));
+}
+
+void SettingsDialog::accept()
+{
+    writeSettings();
+    this->close();
+}
+
+void SettingsDialog::showHideUserSettings()
+{
+    if (ui->checkBoxMovescountEnable->isChecked()) {
+        ui->lineEditUsername->setHidden(false);
+        ui->lineEditPassword->setHidden(false);
+    }
+    else {
+        ui->lineEditUsername->setHidden(true);
+        ui->lineEditPassword->setHidden(true);
+    }
+}
+
+void SettingsDialog::readSettings()
+{
+    settings.beginGroup("syncSettings");
+    ui->checkBoxSyncTime->setChecked(settings.value("syncTime", true).toBool());
+    ui->checkBoxSyncOrbit->setChecked(settings.value("syncOrbit", true).toBool());
+    settings.endGroup();
+
+    settings.beginGroup("movescountSettings");
+    ui->checkBoxNewVersions->setChecked(settings.value("checkNewVersions", true).toBool());
+    ui->checkBoxMovescountEnable->setChecked(settings.value("movescountEnable", false).toBool());
+    ui->lineEditUsername->setText(settings.value("username", "").toString());
+    ui->lineEditPassword->setText(settings.value("password", "").toString());
+    ui->checkBoxDebugFiles->setChecked(settings.value("storeDebugFiles", true).toBool());
+    settings.endGroup();
+}
+
+void SettingsDialog::writeSettings()
+{
+    settings.beginGroup("syncSettings");
+    settings.setValue("syncTime", ui->checkBoxSyncTime->isChecked());
+    settings.setValue("syncOrbit", ui->checkBoxSyncOrbit->isChecked());
+    settings.endGroup();
+
+    settings.beginGroup("movescountSettings");
+    settings.setValue("checkNewVersions", ui->checkBoxNewVersions->isChecked());
+    settings.setValue("movescountEnable", ui->checkBoxMovescountEnable->isChecked());
+    if (ui->checkBoxMovescountEnable->isChecked()) {
+        settings.setValue("username", ui->lineEditUsername->text());
+        settings.setValue("password", ui->lineEditPassword->text());
+    }
+    else {
+        settings.setValue("username", "");
+        settings.setValue("password", "");
+    }
+    settings.setValue("storeDebugFiles", ui->checkBoxDebugFiles->isChecked());
+    settings.endGroup();
+}
diff --git a/src/openambit/settingsdialog.h b/src/openambit/settingsdialog.h
new file mode 100644
index 0000000..d05d4f0
--- /dev/null
+++ b/src/openambit/settingsdialog.h
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2013 Emil Ljungdahl
+ *
+ * This file is part of Openambit.
+ *
+ * Openambit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Contributors:
+ *
+ */
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+#include "settings.h"
+
+class QListWidgetItem;
+
+namespace Ui {
+class SettingsDialog;
+}
+
+class SettingsDialog : public QDialog
+{
+    Q_OBJECT
+    
+public:
+    explicit SettingsDialog(QWidget *parent = 0);
+    ~SettingsDialog();
+
+public slots:
+    void changePage(QListWidgetItem *current, QListWidgetItem *previous);
+    void accept();
+    void showHideUserSettings();
+    
+private:
+    void readSettings();
+    void writeSettings();
+
+    Ui::SettingsDialog *ui;
+    Settings settings;
+};
+
+#endif // SETTINGSDIALOG_H
diff --git a/src/openambit/settingsdialog.ui b/src/openambit/settingsdialog.ui
new file mode 100644
index 0000000..5f2339e
--- /dev/null
+++ b/src/openambit/settingsdialog.ui
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>682</width>
+    <height>438</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QListWidget" name="listSettingGroups">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>180</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>180</width>
+         <height>16777215</height>
+        </size>
+       </property>
+       <property name="baseSize">
+        <size>
+         <width>180</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="resizeMode">
+        <enum>QListView::Fixed</enum>
+       </property>
+       <item>
+        <property name="text">
+         <string>General</string>
+        </property>
+        <property name="icon">
+         <iconset theme="preferences-system">
+          <normaloff/>
+         </iconset>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Device sync</string>
+        </property>
+        <property name="icon">
+         <iconset theme="clock">
+          <normaloff/>
+         </iconset>
+        </property>
+       </item>
+       <item>
+        <property name="text">
+         <string>Movescount</string>
+        </property>
+        <property name="icon">
+         <iconset theme="internet-web-browser">
+          <normaloff/>
+         </iconset>
+        </property>
+       </item>
+      </widget>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QStackedWidget" name="stackedWidget">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <widget class="QWidget" name="generalSettingsPage">
+          <layout class="QVBoxLayout" name="verticalLayout_5">
+           <item>
+            <widget class="QGroupBox" name="groupBox">
+             <property name="title">
+              <string>General settings</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="deviceSyncPage">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <layout class="QVBoxLayout" name="verticalLayout_2">
+           <item>
+            <widget class="QGroupBox" name="groupDeviceSync">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="title">
+              <string>Device syncronisation settings</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout">
+              <item row="0" column="0">
+               <widget class="QCheckBox" name="checkBoxSyncTime">
+                <property name="text">
+                 <string>Sync time from computer</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QCheckBox" name="checkBoxSyncOrbit">
+                <property name="text">
+                 <string>Sync orbital data (from Movescount)</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="movesCountPage">
+          <layout class="QVBoxLayout" name="verticalLayout_4">
+           <item>
+            <widget class="QGroupBox" name="groupMovescount">
+             <property name="title">
+              <string>Movescount connectivity</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_2">
+              <item row="0" column="0">
+               <widget class="QCheckBox" name="checkBoxNewVersions">
+                <property name="text">
+                 <string>Check Movescount for new versions</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QCheckBox" name="checkBoxMovescountEnable">
+                <property name="text">
+                 <string>Sync logs with Movescount</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLineEdit" name="lineEditUsername">
+                <property name="placeholderText">
+                 <string>Username</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="0">
+               <widget class="QLineEdit" name="lineEditPassword">
+                <property name="echoMode">
+                 <enum>QLineEdit::Password</enum>
+                </property>
+                <property name="placeholderText">
+                 <string>Password</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QCheckBox" name="checkBoxDebugFiles">
+                <property name="text">
+                 <string>Generate debug files (XMLs stored in ~/.openambit/movescount)</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>SettingsDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>SettingsDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/openambit.git



More information about the Pkg-running-devel mailing list