commit bf0521e91a6c1c4b0d01f3a0b076d789ebc2ae7c Author: Dmytro Bogovych Date: Mon Sep 24 22:25:14 2018 +0300 - initial import into git diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..1824e14 --- /dev/null +++ b/TODO.txt @@ -0,0 +1,3 @@ +1) Save & load columns width in time table +2) Make hierarchical time table +3) Add tray icon diff --git a/articles/Intro.rtf b/articles/Intro.rtf new file mode 100644 index 0000000..8bc2950 --- /dev/null +++ b/articles/Intro.rtf @@ -0,0 +1,14 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0 +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural + +\f0\fs24 \cf0 Litt is little idea & time tracker. It combines functionality of outliner & time tracker in single application.\ +\ +The reason of creating of this application was the lack of open source standards based outliner & time tracker. Litt includes password based protection and is based on open source database sqlcipher. So all your data are not lost in proprietary storage - they can be retrieved from database (of course if you will provide password).\ +\ +To ease the time tracking Litt can use automatic stop/start time tracking.\ +Application can stop time tracking automatically if idle interval is detected and start tracking again if user activity is discovered again. \ +Unlike other time trackers - Litt does NOT capture screenshots. Litt does NOT checks running applications name. Litt is intended to guard your private data - not to gather them. \ +} \ No newline at end of file diff --git a/client/Info.plist b/client/Info.plist new file mode 100644 index 0000000..da7de3c --- /dev/null +++ b/client/Info.plist @@ -0,0 +1,22 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + appicon.icns + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + Litt + CFBundleIdentifier + com.yourcompany.Litt + NOTE + This file was generated by Qt/QMake. + + diff --git a/client/License.rtf b/client/License.rtf new file mode 100644 index 0000000..c1a02d4 --- /dev/null +++ b/client/License.rtf @@ -0,0 +1,839 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\froman\fcharset0 TimesNewRomanPSMT;\f1\fnil\fcharset0 Verdana;} +{\colortbl;\red255\green255\blue255;\red38\green38\blue38;\red249\green249\blue249;} +\paperw11900\paperh16840\margl1440\margr1440\vieww17660\viewh14260\viewkind0 +\deftab720 +\pard\pardeftab720 + +\f0\fs24 \cf2 \cb3 COPYRIGHTS: +\f1\fs26 \ + +\f0\fs24 Copyright 2015 Satorilight.com. All Rights Reserved. +\f1\fs26 \ +\ + +\f0\fs24 The Litt software is Copyright 2015 Satorilight.com. All +\f1\fs26 \ + +\f0\fs24 rights reserved. This software may not, in whole or in any part, be +\f1\fs26 \ + +\f0\fs24 copied, reproduced, transmitted, translated (into any language, natural +\f1\fs26 \ + +\f0\fs24 or computer), stored in a retrieval system, reduced to any electronic +\f1\fs26 \ + +\f0\fs24 medium or machine readable format, or by any other form or means +\f1\fs26 \ + +\f0\fs24 without prior consent, in writing, from Satorilight.com. +\f1\fs26 \ +\ +\ + +\f0\fs24 You are granted a limited license to use this software. The software +\f1\fs26 \ + +\f0\fs24 may be used or copied only in accordance with the terms of that +\f1\fs26 \ + +\f0\fs24 license, which is described in the following paragraphs. +\f1\fs26 \ +\ +\ + +\f0\fs24 LICENSE: +\f1\fs26 \ + +\f0\fs24 "THE SOFTWARE" SHALL BE TAKEN TO MEAN THE SOFTWARE +\f1\fs26 \ + +\f0\fs24 CONTAINED IN THIS PACKAGE AND ANY SUBEQUENT +\f1\fs26 \ + +\f0\fs24 VERSIONS OR UPGRADES RECEIVED AS A RESULT OF HAVING +\f1\fs26 \ + +\f0\fs24 PURCHASED OR DOWNLOADING THIS PACKAGE. "BUYER" SHALL BE TAKEN AS +\f1\fs26 \ + +\f0\fs24 THE ORIGINAL PURCHASER OR DOWNLOADER OF THE SOFTWARE. +\f1\fs26 \ +\ + +\f0\fs24 BUYER HAS THE NON-EXCLUSIVE RIGHT TO USE THE +\f1\fs26 \ + +\f0\fs24 SOFTWARE ON ANY COMPUTER. +\f1\fs26 \ + +\f0\fs24 BUYER MAY NOT DISTRIBUTE COPIES OF THE SOFTWARE OR +\f1\fs26 \ + +\f0\fs24 THE ACCOMPANYING DOCUMENTATION TO OTHERS EITHER +\f1\fs26 \ + +\f0\fs24 FOR A FEE OR WITHOUT CHARGE. BUYER MAY NOT MODIFY +\f1\fs26 \ + +\f0\fs24 OR TRANSLATE THE PROGRAM OR DOCUMENTATION. USER +\f1\fs26 \ + +\f0\fs24 MAY NOT DISASSEMBLE THE PROGRAM OR ALLOW IT TO BE +\f1\fs26 \ + +\f0\fs24 DISASSEMBLED INTO ITS CONTITUENT SOURCE CODE. +\f1\fs26 \ +\ + +\f0\fs24 BUYER'S USE OF THE SOFTWARE INDICATES HIS/HER +\f1\fs26 \ + +\f0\fs24 ACCEPTANCE OF THESE TERMS AND CONDITIONS. IF BUYER +\f1\fs26 \ + +\f0\fs24 DOES NOT AGREE TO THESE CONDITIONS, RETURN THE +\f1\fs26 \ + +\f0\fs24 DISTRIBUTION MEDIA, DOCUMENTATION, AND ASSOCIATED +\f1\fs26 \ + +\f0\fs24 MATERIALS TO THE VENDOR FROM WHOM THE SOFTWARE +\f1\fs26 \ + +\f0\fs24 WAS PURCHASED, AND ERASE THE SOFTWARE FROM ANY +\f1\fs26 \ + +\f0\fs24 AND ALL STORAGE DEVICES UPON WHICH IT MAY HAVE BEEN +\f1\fs26 \ + +\f0\fs24 INSTALLED. +\f1\fs26 \ +\ +\ + +\f0\fs24 DISCLAIMER / LIMITATION OF LIABILITY: +\f1\fs26 \ + +\f0\fs24 BUYER ACKNOWLEDGES THAT THE SOFTWARE MAY NOT BE +\f1\fs26 \ + +\f0\fs24 FREE FROM DEFECTS AND MAY NOT SATISFY ALL OF BUYER'S +\f1\fs26 \ + +\f0\fs24 NEEDS. IN NO EVENT WILL SATORILIGHT.COM BE LIABLE FOR +\f1\fs26 \ + +\f0\fs24 DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGE +\f1\fs26 \ + +\f0\fs24 OR DAMAGES RESULTING FROM LOSS OF USE, OR LOSS OF +\f1\fs26 \ + +\f0\fs24 ANTICIPATED PROFITS RESULTING FROM ANY DEFECT IN THE +\f1\fs26 \ + +\f0\fs24 PROGRAM, EVEN IF IT HAS BEEN ADVISED OF THE +\f1\fs26 \ + +\f0\fs24 POSSIBILITY OF SUCH DAMAGE. SOME LAWS DO NOT ALLOW +\f1\fs26 \ + +\f0\fs24 THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES OR +\f1\fs26 \ + +\f0\fs24 LIABILITIES FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, +\f1\fs26 \ + +\f0\fs24 SO THE ABOVE LIMITATIONS OR EXCLUSION MAY NOT APPLY. +\f1\fs26 \ +\ + +\f0\fs24 SPECIFIC RESTRICTIONS: +\f1\fs26 \ + +\f0\fs24 IN ACCORDANCE WITH THE COMPUTER SOFTWARE RENTAL +\f1\fs26 \ + +\f0\fs24 ACT OF 1990, THIS SOFTWARE MAY NOT BE RENTED, LENT OR +\f1\fs26 \ + +\f0\fs24 LEASED. +\f1\fs26 \ +\ + +\f0\fs24 THE SOFTWARE AND ACCOMPANYING DOCUMENTATION MAY +\f1\fs26 \ + +\f0\fs24 NOT BE PROVIDED BY A "BACKUP SERVICE" OR ANY OTHER +\f1\fs26 \ + +\f0\fs24 VENDOR WHICH DOES NOT PROVIDE AN ORIGINAL PACKAGE +\f1\fs26 \ + +\f0\fs24 AS COMPOSED BY SATORILIGHT.COM, INCLUDING BUT NOT +\f1\fs26 \ + +\f0\fs24 LIMITED TO ALL ORIGINAL DISTRIBUTION MEDIA, +\f1\fs26 \ + +\f0\fs24 DOCUMENTATION, REGISTRATION CARDS, AND INSERTIONS.\ +\ +SQLCipher license:\ +\ +\ +Copyright (c) 2008-2012 Zetetic LLC\ + All rights reserved.\ + \ + Redistribution and use in source and binary forms, with or without\ + modification, are permitted provided that the following conditions are met:\ + * Redistributions of source code must retain the above copyright\ + notice, this list of conditions and the following disclaimer.\ + * Redistributions in binary form must reproduce the above copyright\ + notice, this list of conditions and the following disclaimer in the\ + documentation and/or other materials provided with the distribution.\ + * Neither the name of the ZETETIC LLC nor the\ + names of its contributors may be used to endorse or promote products\ + derived from this software without specific prior written permission.\ + \ + THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\ + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\ + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\ + DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\ + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\ + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\ + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\ + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\ + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\ + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\ +\ +Qt LGPL license:\ + GNU LESSER GENERAL PUBLIC LICENSE\ + Version 3, 29 June 2007\ +\ + Copyright (C) 2007 Free Software Foundation, Inc. \ + Everyone is permitted to copy and distribute verbatim copies\ + of this license document, but changing it is not allowed.\ +\ + This version of the GNU Lesser General Public License incorporates\ +the terms and conditions of version 3 of the GNU General Public\ +License, supplemented by the additional permissions listed below.\ +\ + 0. Additional Definitions.\ +\ + As used herein, "this License" refers to version 3 of the GNU Lesser\ +General Public License, and the "GNU GPL" refers to version 3 of the GNU\ +General Public License.\ +\ + "The Library" refers to a covered work governed by this License,\ +other than an Application or a Combined Work as defined below.\ +\ + An "Application" is any work that makes use of an interface provided\ +by the Library, but which is not otherwise based on the Library.\ +Defining a subclass of a class defined by the Library is deemed a mode\ +of using an interface provided by the Library.\ +\ + A "Combined Work" is a work produced by combining or linking an\ +Application with the Library. The particular version of the Library\ +with which the Combined Work was made is also called the "Linked\ +Version".\ +\ + The "Minimal Corresponding Source" for a Combined Work means the\ +Corresponding Source for the Combined Work, excluding any source code\ +for portions of the Combined Work that, considered in isolation, are\ +based on the Application, and not on the Linked Version.\ +\ + The "Corresponding Application Code" for a Combined Work means the\ +object code and/or source code for the Application, including any data\ +and utility programs needed for reproducing the Combined Work from the\ +Application, but excluding the System Libraries of the Combined Work.\ +\ + 1. Exception to Section 3 of the GNU GPL.\ +\ + You may convey a covered work under sections 3 and 4 of this License\ +without being bound by section 3 of the GNU GPL.\ +\ + 2. Conveying Modified Versions.\ +\ + If you modify a copy of the Library, and, in your modifications, a\ +facility refers to a function or data to be supplied by an Application\ +that uses the facility (other than as an argument passed when the\ +facility is invoked), then you may convey a copy of the modified\ +version:\ +\ + a) under this License, provided that you make a good faith effort to\ + ensure that, in the event an Application does not supply the\ + function or data, the facility still operates, and performs\ + whatever part of its purpose remains meaningful, or\ +\ + b) under the GNU GPL, with none of the additional permissions of\ + this License applicable to that copy.\ +\ + 3. Object Code Incorporating Material from Library Header Files.\ +\ + The object code form of an Application may incorporate material from\ +a header file that is part of the Library. You may convey such object\ +code under terms of your choice, provided that, if the incorporated\ +material is not limited to numerical parameters, data structure\ +layouts and accessors, or small macros, inline functions and templates\ +(ten or fewer lines in length), you do both of the following:\ +\ + a) Give prominent notice with each copy of the object code that the\ + Library is used in it and that the Library and its use are\ + covered by this License.\ +\ + b) Accompany the object code with a copy of the GNU GPL and this license\ + document.\ +\ + 4. Combined Works.\ +\ + You may convey a Combined Work under terms of your choice that,\ +taken together, effectively do not restrict modification of the\ +portions of the Library contained in the Combined Work and reverse\ +engineering for debugging such modifications, if you also do each of\ +the following:\ +\ + a) Give prominent notice with each copy of the Combined Work that\ + the Library is used in it and that the Library and its use are\ + covered by this License.\ +\ + b) Accompany the Combined Work with a copy of the GNU GPL and this license\ + document.\ +\ + c) For a Combined Work that displays copyright notices during\ + execution, include the copyright notice for the Library among\ + these notices, as well as a reference directing the user to the\ + copies of the GNU GPL and this license document.\ +\ + d) Do one of the following:\ +\ + 0) Convey the Minimal Corresponding Source under the terms of this\ + License, and the Corresponding Application Code in a form\ + suitable for, and under terms that permit, the user to\ + recombine or relink the Application with a modified version of\ + the Linked Version to produce a modified Combined Work, in the\ + manner specified by section 6 of the GNU GPL for conveying\ + Corresponding Source.\ +\ + 1) Use a suitable shared library mechanism for linking with the\ + Library. A suitable mechanism is one that (a) uses at run time\ + a copy of the Library already present on the user's computer\ + system, and (b) will operate properly with a modified version\ + of the Library that is interface-compatible with the Linked\ + Version.\ +\ + e) Provide Installation Information, but only if you would otherwise\ + be required to provide such information under section 6 of the\ + GNU GPL, and only to the extent that such information is\ + necessary to install and execute a modified version of the\ + Combined Work produced by recombining or relinking the\ + Application with a modified version of the Linked Version. (If\ + you use option 4d0, the Installation Information must accompany\ + the Minimal Corresponding Source and Corresponding Application\ + Code. If you use option 4d1, you must provide the Installation\ + Information in the manner specified by section 6 of the GNU GPL\ + for conveying Corresponding Source.)\ +\ + 5. Combined Libraries.\ +\ + You may place library facilities that are a work based on the\ +Library side by side in a single library together with other library\ +facilities that are not Applications and are not covered by this\ +License, and convey such a combined library under terms of your\ +choice, if you do both of the following:\ +\ + a) Accompany the combined library with a copy of the same work based\ + on the Library, uncombined with any other library facilities,\ + conveyed under the terms of this License.\ +\ + b) Give prominent notice with the combined library that part of it\ + is a work based on the Library, and explaining where to find the\ + accompanying uncombined form of the same work.\ +\ + 6. Revised Versions of the GNU Lesser General Public License.\ +\ + The Free Software Foundation may publish revised and/or new versions\ +of the GNU Lesser 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\ +Library as you received it specifies that a certain numbered version\ +of the GNU Lesser General Public License "or any later version"\ +applies to it, you have the option of following the terms and\ +conditions either of that published version or of any later version\ +published by the Free Software Foundation. If the Library as you\ +received it does not specify a version number of the GNU Lesser\ +General Public License, you may choose any version of the GNU Lesser\ +General Public License ever published by the Free Software Foundation.\ +\ + If the Library as you received it specifies that a proxy can decide\ +whether future versions of the GNU Lesser General Public License shall\ +apply, that proxy's public statement of acceptance of any version is\ +permanent authorization for you to choose that version for the\ +Library.\ +LGPL version 2.1\ +\ + GNU LESSER GENERAL PUBLIC LICENSE\ + Version 2.1, February 1999\ +\ + Copyright (C) 1991, 1999 Free Software Foundation, Inc.\ + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\ + Everyone is permitted to copy and distribute verbatim copies\ + of this license document, but changing it is not allowed.\ +\ +[This is the first released version of the Lesser GPL. It also counts\ + as the successor of the GNU Library Public License, version 2, hence\ + the version number 2.1.]\ +\ + Preamble\ +\ + The licenses for most software are designed to take away your\ +freedom to share and change it. By contrast, the GNU General Public\ +Licenses are intended to guarantee your freedom to share and change\ +free software--to make sure the software is free for all its users.\ +\ + This license, the Lesser General Public License, applies to some\ +specially designated software packages--typically libraries--of the\ +Free Software Foundation and other authors who decide to use it. You\ +can use it too, but we suggest you first think carefully about whether\ +this license or the ordinary General Public License is the better\ +strategy to use in any particular case, based on the explanations below.\ +\ + When we speak of free software, we are referring to freedom of use,\ +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 this service if you wish); that you receive source code or can get\ +it if you want it; that you can change the software and use pieces of\ +it in new free programs; and that you are informed that you can do\ +these things.\ +\ + To protect your rights, we need to make restrictions that forbid\ +distributors to deny you these rights or to ask you to surrender these\ +rights. These restrictions translate to certain responsibilities for\ +you if you distribute copies of the library or if you modify it.\ +\ + For example, if you distribute copies of the library, whether gratis\ +or for a fee, you must give the recipients all the rights that we gave\ +you. You must make sure that they, too, receive or can get the source\ +code. If you link other code with the library, you must provide\ +complete object files to the recipients, so that they can relink them\ +with the library after making changes to the library and recompiling\ +it. And you must show them these terms so they know their rights.\ +\ + We protect your rights with a two-step method: (1) we copyright the\ +library, and (2) we offer you this license, which gives you legal\ +permission to copy, distribute and/or modify the library.\ +\ + To protect each distributor, we want to make it very clear that\ +there is no warranty for the free library. Also, if the library is\ +modified by someone else and passed on, the recipients should know\ +that what they have is not the original version, so that the original\ +author's reputation will not be affected by problems that might be\ +introduced by others.\ +\ + Finally, software patents pose a constant threat to the existence of\ +any free program. We wish to make sure that a company cannot\ +effectively restrict the users of a free program by obtaining a\ +restrictive license from a patent holder. Therefore, we insist that\ +any patent license obtained for a version of the library must be\ +consistent with the full freedom of use specified in this license.\ +\ + Most GNU software, including some libraries, is covered by the\ +ordinary GNU General Public License. This license, the GNU Lesser\ +General Public License, applies to certain designated libraries, and\ +is quite different from the ordinary General Public License. We use\ +this license for certain libraries in order to permit linking those\ +libraries into non-free programs.\ +\ + When a program is linked with a library, whether statically or using\ +a shared library, the combination of the two is legally speaking a\ +combined work, a derivative of the original library. The ordinary\ +General Public License therefore permits such linking only if the\ +entire combination fits its criteria of freedom. The Lesser General\ +Public License permits more lax criteria for linking other code with\ +the library.\ +\ + We call this license the "Lesser" General Public License because it\ +does Less to protect the user's freedom than the ordinary General\ +Public License. It also provides other free software developers Less\ +of an advantage over competing non-free programs. These disadvantages\ +are the reason we use the ordinary General Public License for many\ +libraries. However, the Lesser license provides advantages in certain\ +special circumstances.\ +\ + For example, on rare occasions, there may be a special need to\ +encourage the widest possible use of a certain library, so that it becomes\ +a de-facto standard. To achieve this, non-free programs must be\ +allowed to use the library. A more frequent case is that a free\ +library does the same job as widely used non-free libraries. In this\ +case, there is little to gain by limiting the free library to free\ +software only, so we use the Lesser General Public License.\ +\ + In other cases, permission to use a particular library in non-free\ +programs enables a greater number of people to use a large body of\ +free software. For example, permission to use the GNU C Library in\ +non-free programs enables many more people to use the whole GNU\ +operating system, as well as its variant, the GNU/Linux operating\ +system.\ +\ + Although the Lesser General Public License is Less protective of the\ +users' freedom, it does ensure that the user of a program that is\ +linked with the Library has the freedom and the wherewithal to run\ +that program using a modified version of the Library.\ +\ + The precise terms and conditions for copying, distribution and\ +modification follow. Pay close attention to the difference between a\ +"work based on the library" and a "work that uses the library". The\ +former contains code derived from the library, whereas the latter must\ +be combined with the library in order to run.\ +\ + GNU LESSER GENERAL PUBLIC LICENSE\ + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\ +\ + 0. This License Agreement applies to any software library or other\ +program which contains a notice placed by the copyright holder or\ +other authorized party saying it may be distributed under the terms of\ +this Lesser General Public License (also called "this License").\ +Each licensee is addressed as "you".\ +\ + A "library" means a collection of software functions and/or data\ +prepared so as to be conveniently linked with application programs\ +(which use some of those functions and data) to form executables.\ +\ + The "Library", below, refers to any such software library or work\ +which has been distributed under these terms. A "work based on the\ +Library" means either the Library or any derivative work under\ +copyright law: that is to say, a work containing the Library or a\ +portion of it, either verbatim or with modifications and/or translated\ +straightforwardly into another language. (Hereinafter, translation is\ +included without limitation in the term "modification".)\ +\ + "Source code" for a work means the preferred form of the work for\ +making modifications to it. For a library, complete source code means\ +all the source code for all modules it contains, plus any associated\ +interface definition files, plus the scripts used to control compilation\ +and installation of the library.\ +\ + Activities other than copying, distribution and modification are not\ +covered by this License; they are outside its scope. The act of\ +running a program using the Library is not restricted, and output from\ +such a program is covered only if its contents constitute a work based\ +on the Library (independent of the use of the Library in a tool for\ +writing it). Whether that is true depends on what the Library does\ +and what the program that uses the Library does.\ +\ + 1. You may copy and distribute verbatim copies of the Library's\ +complete source code as you receive it, in any medium, provided that\ +you conspicuously and appropriately publish on each copy an\ +appropriate copyright notice and disclaimer of warranty; keep intact\ +all the notices that refer to this License and to the absence of any\ +warranty; and distribute a copy of this License along with the\ +Library.\ +\ + You may charge a fee for the physical act of transferring a copy,\ +and you may at your option offer warranty protection in exchange for a\ +fee.\ +\ + 2. You may modify your copy or copies of the Library or any portion\ +of it, thus forming a work based on the Library, and copy and\ +distribute such modifications or work under the terms of Section 1\ +above, provided that you also meet all of these conditions:\ +\ + a) The modified work must itself be a software library.\ +\ + b) You must cause the files modified to carry prominent notices\ + stating that you changed the files and the date of any change.\ +\ + c) You must cause the whole of the work to be licensed at no\ + charge to all third parties under the terms of this License.\ +\ + d) If a facility in the modified Library refers to a function or a\ + table of data to be supplied by an application program that uses\ + the facility, other than as an argument passed when the facility\ + is invoked, then you must make a good faith effort to ensure that,\ + in the event an application does not supply such function or\ + table, the facility still operates, and performs whatever part of\ + its purpose remains meaningful.\ +\ + (For example, a function in a library to compute square roots has\ + a purpose that is entirely well-defined independent of the\ + application. Therefore, Subsection 2d requires that any\ + application-supplied function or table used by this function must\ + be optional: if the application does not supply it, the square\ + root function must still compute square roots.)\ +\ +These requirements apply to the modified work as a whole. If\ +identifiable sections of that work are not derived from the Library,\ +and can be reasonably considered independent and separate works in\ +themselves, then this License, and its terms, do not apply to those\ +sections when you distribute them as separate works. But when you\ +distribute the same sections as part of a whole which is a work based\ +on the Library, the distribution of the whole must be on the terms of\ +this License, whose permissions for other licensees extend to the\ +entire whole, and thus to each and every part regardless of who wrote\ +it.\ +\ +Thus, it is not the intent of this section to claim rights or contest\ +your rights to work written entirely by you; rather, the intent is to\ +exercise the right to control the distribution of derivative or\ +collective works based on the Library.\ +\ +In addition, mere aggregation of another work not based on the Library\ +with the Library (or with a work based on the Library) on a volume of\ +a storage or distribution medium does not bring the other work under\ +the scope of this License.\ +\ + 3. You may opt to apply the terms of the ordinary GNU General Public\ +License instead of this License to a given copy of the Library. To do\ +this, you must alter all the notices that refer to this License, so\ +that they refer to the ordinary GNU General Public License, version 2,\ +instead of to this License. (If a newer version than version 2 of the\ +ordinary GNU General Public License has appeared, then you can specify\ +that version instead if you wish.) Do not make any other change in\ +these notices.\ +\ + Once this change is made in a given copy, it is irreversible for\ +that copy, so the ordinary GNU General Public License applies to all\ +subsequent copies and derivative works made from that copy.\ +\ + This option is useful when you wish to copy part of the code of\ +the Library into a program that is not a library.\ +\ + 4. You may copy and distribute the Library (or a portion or\ +derivative of it, under Section 2) in object code or executable form\ +under the terms of Sections 1 and 2 above provided that you accompany\ +it with the complete corresponding machine-readable source code, which\ +must be distributed under the terms of Sections 1 and 2 above on a\ +medium customarily used for software interchange.\ +\ + If distribution of object code is made by offering access to copy\ +from a designated place, then offering equivalent access to copy the\ +source code from the same place satisfies the requirement to\ +distribute the source code, even though third parties are not\ +compelled to copy the source along with the object code.\ +\ + 5. A program that contains no derivative of any portion of the\ +Library, but is designed to work with the Library by being compiled or\ +linked with it, is called a "work that uses the Library". Such a\ +work, in isolation, is not a derivative work of the Library, and\ +therefore falls outside the scope of this License.\ +\ + However, linking a "work that uses the Library" with the Library\ +creates an executable that is a derivative of the Library (because it\ +contains portions of the Library), rather than a "work that uses the\ +library". The executable is therefore covered by this License.\ +Section 6 states terms for distribution of such executables.\ +\ + When a "work that uses the Library" uses material from a header file\ +that is part of the Library, the object code for the work may be a\ +derivative work of the Library even though the source code is not.\ +Whether this is true is especially significant if the work can be\ +linked without the Library, or if the work is itself a library. The\ +threshold for this to be true is not precisely defined by law.\ +\ + If such an object file uses only numerical parameters, data\ +structure layouts and accessors, and small macros and small inline\ +functions (ten lines or less in length), then the use of the object\ +file is unrestricted, regardless of whether it is legally a derivative\ +work. (Executables containing this object code plus portions of the\ +Library will still fall under Section 6.)\ +\ + Otherwise, if the work is a derivative of the Library, you may\ +distribute the object code for the work under the terms of Section 6.\ +Any executables containing that work also fall under Section 6,\ +whether or not they are linked directly with the Library itself.\ +\ + 6. As an exception to the Sections above, you may also combine or\ +link a "work that uses the Library" with the Library to produce a\ +work containing portions of the Library, and distribute that work\ +under terms of your choice, provided that the terms permit\ +modification of the work for the customer's own use and reverse\ +engineering for debugging such modifications.\ +\ + You must give prominent notice with each copy of the work that the\ +Library is used in it and that the Library and its use are covered by\ +this License. You must supply a copy of this License. If the work\ +during execution displays copyright notices, you must include the\ +copyright notice for the Library among them, as well as a reference\ +directing the user to the copy of this License. Also, you must do one\ +of these things:\ +\ + a) Accompany the work with the complete corresponding\ + machine-readable source code for the Library including whatever\ + changes were used in the work (which must be distributed under\ + Sections 1 and 2 above); and, if the work is an executable linked\ + with the Library, with the complete machine-readable "work that\ + uses the Library", as object code and/or source code, so that the\ + user can modify the Library and then relink to produce a modified\ + executable containing the modified Library. (It is understood\ + that the user who changes the contents of definitions files in the\ + Library will not necessarily be able to recompile the application\ + to use the modified definitions.)\ +\ + b) Use a suitable shared library mechanism for linking with the\ + Library. A suitable mechanism is one that (1) uses at run time a\ + copy of the library already present on the user's computer system,\ + rather than copying library functions into the executable, and (2)\ + will operate properly with a modified version of the library, if\ + the user installs one, as long as the modified version is\ + interface-compatible with the version that the work was made with.\ +\ + c) Accompany the work with a written offer, valid for at\ + least three years, to give the same user the materials\ + specified in Subsection 6a, above, for a charge no more\ + than the cost of performing this distribution.\ +\ + d) If distribution of the work is made by offering access to copy\ + from a designated place, offer equivalent access to copy the above\ + specified materials from the same place.\ +\ + e) Verify that the user has already received a copy of these\ + materials or that you have already sent this user a copy.\ +\ + For an executable, the required form of the "work that uses the\ +Library" must include any data and utility programs needed for\ +reproducing the executable from it. However, as a special exception,\ +the materials to be distributed need not include anything that is\ +normally distributed (in either source or binary form) with the major\ +components (compiler, kernel, and so on) of the operating system on\ +which the executable runs, unless that component itself accompanies\ +the executable.\ +\ + It may happen that this requirement contradicts the license\ +restrictions of other proprietary libraries that do not normally\ +accompany the operating system. Such a contradiction means you cannot\ +use both them and the Library together in an executable that you\ +distribute.\ +\ + 7. You may place library facilities that are a work based on the\ +Library side-by-side in a single library together with other library\ +facilities not covered by this License, and distribute such a combined\ +library, provided that the separate distribution of the work based on\ +the Library and of the other library facilities is otherwise\ +permitted, and provided that you do these two things:\ +\ + a) Accompany the combined library with a copy of the same work\ + based on the Library, uncombined with any other library\ + facilities. This must be distributed under the terms of the\ + Sections above.\ +\ + b) Give prominent notice with the combined library of the fact\ + that part of it is a work based on the Library, and explaining\ + where to find the accompanying uncombined form of the same work.\ +\ + 8. You may not copy, modify, sublicense, link with, or distribute\ +0the Library except as expressly provided under this License. Any\ +attempt otherwise to copy, modify, sublicense, link with, or\ +distribute the Library is void, and will automatically terminate your\ +rights under this License. However, parties who have received copies,\ +or rights, from you under this License will not have their licenses\ +terminated so long as such parties remain in full compliance.\ +\ + 9. You are not required to accept this License, since you have not\ +signed it. However, nothing else grants you permission to modify or\ +distribute the Library or its derivative works. These actions are\ +prohibited by law if you do not accept this License. Therefore, by\ +modifying or distributing the Library (or any work based on the\ +Library), you indicate your acceptance of this License to do so, and\ +all its terms and conditions for copying, distributing or modifying\ +the Library or works based on it.\ +\ + 10. Each time you redistribute the Library (or any work based on the\ +Library), the recipient automatically receives a license from the\ +original licensor to copy, distribute, link with or modify the Library\ +subject to these terms and conditions. You may not impose any further\ +restrictions on the recipients' exercise of the rights granted herein.\ +You are not responsible for enforcing compliance by third parties with\ +this License.\ +\ + 11. If, as a consequence of a court judgment or allegation of patent\ +infringement or for any other reason (not limited to patent issues),\ +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\ +distribute so as to satisfy simultaneously your obligations under this\ +License and any other pertinent obligations, then as a consequence you\ +may not distribute the Library at all. For example, if a patent\ +license would not permit royalty-free redistribution of the Library by\ +all those who receive copies directly or indirectly through you, then\ +the only way you could satisfy both it and this License would be to\ +refrain entirely from distribution of the Library.\ +\ +If any portion of this section is held invalid or unenforceable under any\ +particular circumstance, the balance of the section is intended to apply,\ +and the section as a whole is intended to apply in other circumstances.\ +\ +It is not the purpose of this section to induce you to infringe any\ +patents or other property right claims or to contest validity of any\ +such claims; this section has the sole purpose of protecting the\ +integrity of the free software distribution system which is\ +implemented by public license practices. Many people have made\ +generous contributions to the wide range of software distributed\ +through that system in reliance on consistent application of that\ +system; it is up to the author/donor to decide if he or she is willing\ +to distribute software through any other system and a licensee cannot\ +impose that choice.\ +\ +This section is intended to make thoroughly clear what is believed to\ +be a consequence of the rest of this License.\ +\ + 12. If the distribution and/or use of the Library is restricted in\ +certain countries either by patents or by copyrighted interfaces, the\ +original copyright holder who places the Library under this License may add\ +an explicit geographical distribution limitation excluding those countries,\ +so that distribution is permitted only in or among countries not thus\ +excluded. In such case, this License incorporates the limitation as if\ +written in the body of this License.\ +\ + 13. The Free Software Foundation may publish revised and/or new\ +versions of the Lesser 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 Library\ +specifies a version number of this License which applies to it and\ +"any later version", you have the option of following the terms and\ +conditions either of that version or of any later version published by\ +the Free Software Foundation. If the Library does not specify a\ +license version number, you may choose any version ever published by\ +the Free Software Foundation.\ +\ + 14. If you wish to incorporate parts of the Library into other free\ +programs whose distribution conditions are incompatible with these,\ +write to the author to ask for permission. For software which is\ +copyrighted by the Free Software Foundation, write to the Free\ +Software Foundation; we sometimes make exceptions for this. Our\ +decision will be guided by the two goals of preserving the free status\ +of all derivatives of our free software and of promoting the sharing\ +and reuse of software generally.\ +\ + NO WARRANTY\ +\ + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\ +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\ +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\ +OTHER PARTIES PROVIDE THE LIBRARY "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\ +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\ +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\ +\ + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\ +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\ +AND/OR REDISTRIBUTE THE LIBRARY 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\ +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\ +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\ +DAMAGES.\ +\ + END OF TERMS AND CONDITIONS\ +\ +Some icons are designed by {\field{\*\fldinst{HYPERLINK "http://pixel-mixer.com/"}}{\fldrslt http://pixel-mixer.com/}}\ +\ + } \ No newline at end of file diff --git a/client/aboutdlg.cpp b/client/aboutdlg.cpp new file mode 100644 index 0000000..3ece9fd --- /dev/null +++ b/client/aboutdlg.cpp @@ -0,0 +1,43 @@ +#include "config.h" +#include "aboutdlg.h" +#include "ui_aboutdlg.h" +#include +#include +#include + +AboutDlg::AboutDlg(QWidget *parent) : + QDialog(parent), + ui(new Ui::AboutDlg) +{ + ui->setupUi(this); + + //QPushButton* btn = ui->mButtonBox->addButton(tr("License"), QDialogButtonBox::AcceptRole); + //this->connect(btn, SIGNAL(clicked()), this, SLOT(showLicense())); + + QString text(ABOUTTEXT); + text += ".\r\n"; + text += QString("Version %1.").arg(VER); + ui->mTextLabel->setText(text); + + QString appPath = QCoreApplication::applicationDirPath(); + appPath += "/../Resources/License.rtf"; + ui->mLicenseLabel->setText("License"); + ui->mLicenseLabel->setTextFormat(Qt::RichText); + ui->mLicenseLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); + ui->mLicenseLabel->setOpenExternalLinks(true); + setWindowTitle(APPNAME); +} + +AboutDlg::~AboutDlg() +{ + delete ui; +} + +void AboutDlg::showLicense() +{ +#ifdef TARGET_OSX + QString appPath = QCoreApplication::applicationDirPath(); + appPath += "/../Resources/License.rtf"; + QDesktopServices::openUrl(QUrl::fromLocalFile(appPath)); +#endif +} diff --git a/client/aboutdlg.h b/client/aboutdlg.h new file mode 100644 index 0000000..65a0b30 --- /dev/null +++ b/client/aboutdlg.h @@ -0,0 +1,25 @@ +#ifndef ABOUTDLG_H +#define ABOUTDLG_H + +#include + +namespace Ui { +class AboutDlg; +} + +class AboutDlg : public QDialog +{ + Q_OBJECT + +public: + explicit AboutDlg(QWidget *parent = 0); + ~AboutDlg(); + +private: + Ui::AboutDlg *ui; + +public slots: + void showLicense(); +}; + +#endif // ABOUTDLG_H diff --git a/client/aboutdlg.ui b/client/aboutdlg.ui new file mode 100644 index 0000000..e9c20aa --- /dev/null +++ b/client/aboutdlg.ui @@ -0,0 +1,95 @@ + + + AboutDlg + + + + 0 + 0 + 323 + 170 + + + + Dialog + + + + + + werwre +werwer + + + + Qt::AlignCenter + + + + + + + + 16777215 + 40 + + + + TextLabel + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + true + + + + + + + + + mButtonBox + accepted() + AboutDlg + accept() + + + 248 + 254 + + + 157 + 274 + + + + + mButtonBox + rejected() + AboutDlg + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/client/appevents.cpp b/client/appevents.cpp new file mode 100644 index 0000000..30f0825 --- /dev/null +++ b/client/appevents.cpp @@ -0,0 +1,23 @@ +#include "appevents.h" + +ClientInitEvent::ClientInitEvent() + :QEvent((Type)ClientInitId) +{ +} + +ClientCloseEvent::ClientCloseEvent() + :QEvent((Type)ClientCloseId) +{} + +AttachDatabaseEvent::AttachDatabaseEvent() + :QEvent((Type)AttachDatabaseId) +{} + +SelectTaskEvent::SelectTaskEvent(PTask task) + :QEvent((Type)SelectTaskId), mTask(task) +{} + +PTask SelectTaskEvent::task() +{ + return mTask; +} diff --git a/client/appevents.h b/client/appevents.h new file mode 100644 index 0000000..8f7d94e --- /dev/null +++ b/client/appevents.h @@ -0,0 +1,42 @@ +#ifndef APPEVENTS_H +#define APPEVENTS_H + +#include +#include "task.h" +enum +{ + ClientInitId = 62000, + ClientCloseId = 62001, + AttachDatabaseId, + SelectTaskId +}; + +class ClientInitEvent: public QEvent +{ +public: + ClientInitEvent(); +}; + +class ClientCloseEvent: public QEvent +{ +public: + ClientCloseEvent(); +}; + +class AttachDatabaseEvent: public QEvent +{ +public: + AttachDatabaseEvent(); +}; + +class SelectTaskEvent: public QEvent +{ +public: + SelectTaskEvent(PTask task); + PTask task(); + +protected: + PTask mTask; +}; + +#endif // APPEVENTS_H diff --git a/client/attachmentsdialog.cpp b/client/attachmentsdialog.cpp new file mode 100644 index 0000000..a39c822 --- /dev/null +++ b/client/attachmentsdialog.cpp @@ -0,0 +1,17 @@ +#include "attachmentsdialog.h" +#include "ui_attachmentsdialog.h" + +AttachmentsDialog::AttachmentsDialog(PTask task, QWidget *parent) : + QDialog(parent, Qt::Sheet), + ui(new Ui::AttachmentsDialog) +{ + ui->setupUi(this); + ui->widget->setTask(task); + ui->widget->setParentWidget(parent); + this->setWindowTitle(tr("Attachments")); +} + +AttachmentsDialog::~AttachmentsDialog() +{ + delete ui; +} diff --git a/client/attachmentsdialog.h b/client/attachmentsdialog.h new file mode 100644 index 0000000..948c409 --- /dev/null +++ b/client/attachmentsdialog.h @@ -0,0 +1,23 @@ +#ifndef ATTACHMENTSDIALOG_H +#define ATTACHMENTSDIALOG_H + +#include +#include "task.h" + +namespace Ui { +class AttachmentsDialog; +} + +class AttachmentsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit AttachmentsDialog(PTask task, QWidget *parent = 0); + ~AttachmentsDialog(); + +private: + Ui::AttachmentsDialog *ui; +}; + +#endif // ATTACHMENTSDIALOG_H diff --git a/client/attachmentsdialog.ui b/client/attachmentsdialog.ui new file mode 100644 index 0000000..6bebf4c --- /dev/null +++ b/client/attachmentsdialog.ui @@ -0,0 +1,100 @@ + + + AttachmentsDialog + + + + 0 + 0 + 600 + 300 + + + + Dialog + + + true + + + + + + + + + + 16777215 + 30 + + + + There is list of attachments in document. Use context menu or drag-and-drop to manage it. + + + Qt::AlignCenter + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + true + + + + + + + + AttachmentsList + QWidget +
attachmentslist.h
+ 1 +
+
+ + + + buttonBox + accepted() + AttachmentsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AttachmentsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/client/attachmentslist.cpp b/client/attachmentslist.cpp new file mode 100644 index 0000000..57e62e2 --- /dev/null +++ b/client/attachmentslist.cpp @@ -0,0 +1,259 @@ +#include "attachmentslist.h" +#include "ui_attachmentslist.h" +#include "storage.h" +#include "taskaction.h" + +#include +#include + +AttachmentsListModel::AttachmentsListModel(PTask task, ChangesHistory& history, const AttachmentArray &items, QObject *parent) + :QAbstractListModel(parent), mTask(task), mHistory(history), mData(items) +{ +} + +int AttachmentsListModel::rowCount(const QModelIndex &parent) const +{ + return mData.size(); +} + +QVariant AttachmentsListModel::data(const QModelIndex& index, int role) const +{ + // Check that the index is valid and within the correct range first: + if (!index.isValid()) + return QVariant(); + if (index.row() >= mData.size()) + return QVariant(); + + if (role == Qt::DisplayRole || role == Qt::EditRole) + { + // Only returns something for the roles you support (DisplayRole is a minimum) + return QVariant(mData.at(index.row())->filename()); + } + else + if (role == Qt::DecorationRole) + { + QFileInfo fi(mData.at(index.row())->filename()); + QIcon icon = mIconProvider.icon(fi); + return QVariant(icon); + } + else + return QVariant(); +} + + +Qt::ItemFlags AttachmentsListModel::flags(const QModelIndex &index) const +{ + Qt::ItemFlags result = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;// | Qt::ItemIsDropEnabled; + //if (index.isValid()) + // result |= Qt::ItemIsDragEnabled; + + return result; +} + +bool AttachmentsListModel::setData(const QModelIndex &index, const QVariant &value, int role /* = Qt::EditRole */) +{ + PAttachment att = itemAt(index.row()); + switch (role) + { + case Qt::DisplayRole: + case Qt::EditRole: + MAKE_ACTION(new RenameAttachmentAction(mTask, att, value.toString())); + break; + } + return true; +} + +void AttachmentsListModel::addItem(PAttachment att, int index) +{ + if (index == -1) + { + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + mData.push_back(att); + endInsertRows(); + } + else + { + beginInsertRows(QModelIndex(), index, index); + mData.insert(mData.begin() + index, att); + endInsertRows(); + } +} + +void AttachmentsListModel::removeItem(int row) +{ + beginRemoveRows(QModelIndex(), row, row); + mData.erase(mData.begin() + row); + endRemoveRows(); +} + +PAttachment AttachmentsListModel::itemAt(int row) const +{ + return mData[row]; +} + +int AttachmentsListModel::findRow(PAttachment att) const +{ + return mData.indexOf(att); +} + + + +AttachmentsList::AttachmentsList(QWidget *parent) : + QWidget(parent), + ui(new Ui::AttachmentsList) +{ + ui->setupUi(this); + +} + +AttachmentsList::~AttachmentsList() +{ + delete ui; +} + +void AttachmentsList::setTask(PTask task) +{ + mTask = task; + AttachmentArray aa; + Storage::instance().loadAttachments(mTask, aa); + + // Create model + mModel = new AttachmentsListModel(mTask, mHistory, aa); + + // Set model to history + mHistory.setAttachmentsModel(mModel); + + // Set model to list view + ui->mListView->setModel(mModel); +} + +void AttachmentsList::setParentWidget(QWidget *w) +{ + mParentWidget = w; +} + +void AttachmentsList::updateActionsState() +{ + bool hasSelectedItem = ui->mListView->currentIndex().isValid(); + ui->mRenameAction->setEnabled(hasSelectedItem); + ui->mDeleteAction->setEnabled(hasSelectedItem); + ui->mExportAction->setEnabled(hasSelectedItem); +} + +void AttachmentsList::contextualMenu(const QPoint& point) +{ + updateActionsState(); + + QMenu* menu = new QMenu(); + menu->addAction(ui->mRenameAction); + menu->addAction(ui->mDeleteAction); + menu->addAction(ui->mExportAction); + menu->addAction(ui->mImportAction); + + //menu->addAction(tr("Add 10 mins to timeline"), this, SLOT(add10Mins())); + menu->exec(this->window()->mapToGlobal(point)); +} + +void AttachmentsList::importFile() +{ + // Prepare file open dialog + QFileDialog dlg(mParentWidget, Qt::Sheet); + dlg.setWindowTitle(tr("Select file(s) for import")); + dlg.setAcceptDrops(false); + dlg.setAcceptMode(QFileDialog::AcceptOpen); + dlg.setFileMode(QFileDialog::ExistingFiles); + if (!dlg.exec()) + return; + + // Iterate selected files + QStringList files = dlg.selectedFiles(); + for (QString filename: files) + { + QFile f(filename); + f.open(QFile::ReadOnly); + if (f.isOpen()) + { + // Get data from file + QByteArray content = f.readAll(); + + // Compress them + QByteArray compressed = qCompress(content); + + // Put it to Attachment instance + PAttachment att(new Attachment()); + att->setTaskId(mTask->id()); + att->setIndex(mModel->rowCount()); + QFileInfo fi(filename); + att->setFilename(fi.fileName()); + + // Save everything + att->save(); + att->saveContent(compressed); + + mModel->addItem(att); + } + f.close(); + } + + // Refresh hasAttachments property on owner task + mTask->checkAttachments(); +} + +void AttachmentsList::exportFile() +{ + QModelIndexList mil = ui->mListView->selectionModel()->selectedIndexes(); + foreach (const QModelIndex& index, mil) + { + if (!index.isValid()) + continue; + + QFileDialog dlg(mParentWidget, Qt::Sheet); + dlg.setWindowTitle(tr("Select file(s) for export")); + dlg.setAcceptDrops(false); + dlg.setAcceptMode(QFileDialog::AcceptSave); + PAttachment att = mModel->itemAt(index.row()); + dlg.selectFile(att->filename()); + if (!dlg.exec()) + continue; + + QFile outputFile(dlg.selectedFiles().front()); + outputFile.open(QFile::WriteOnly); + outputFile.write(qUncompress(att->loadContent())); + outputFile.close(); + } +} + +void AttachmentsList::deleteFile() +{ + QModelIndexList mil = ui->mListView->selectionModel()->selectedIndexes(); + foreach (const QModelIndex& index, mil) + { + if (!index.isValid()) + continue; + PAttachment att = mModel->itemAt(index.row()); + + // Remove from DB + Storage::instance().deleteAttachment(att); + + // Remove from model + mModel->removeItem(index.row()); + + // Iterate other items and decrease their DB table's orderid field + for (int row = index.row() + 1; row < mModel->rowCount(); row++) + { + Attachment& att = *mModel->itemAt(row); + att.setIndex(att.index() - 1); + att.save(); + } + } + + // Refresh hasAttachment property value on task + mTask->checkAttachments(); +} + +void AttachmentsList::renameFile() +{ + QModelIndex index = ui->mListView->currentIndex(); + if (index.isValid()) + ui->mListView->edit(index); +} diff --git a/client/attachmentslist.h b/client/attachmentslist.h new file mode 100644 index 0000000..63b5713 --- /dev/null +++ b/client/attachmentslist.h @@ -0,0 +1,64 @@ +#ifndef ATTACHMENTSLIST_H +#define ATTACHMENTSLIST_H + +#include +#include +#include + +#include "task.h" +#include "taskaction.h" + +namespace Ui { +class AttachmentsList; +} + +class AttachmentsListModel: public QAbstractListModel +{ + Q_OBJECT + +public: + explicit AttachmentsListModel(PTask task, ChangesHistory& history, const AttachmentArray& items, QObject* parent = 0); + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + bool setData(const QModelIndex &index, const QVariant &value, int role /* = Qt::EditRole */); + + void addItem(PAttachment att, int index = -1); + void removeItem(int row); + PAttachment itemAt(int row) const; + int findRow(PAttachment att) const; + +protected: + PTask mTask; + ChangesHistory& mHistory; + AttachmentArray mData; + QFileIconProvider mIconProvider; +}; + +class AttachmentsList : public QWidget +{ + Q_OBJECT + +public: + explicit AttachmentsList(QWidget *parent = 0); + ~AttachmentsList(); + void setTask(PTask task); + void setParentWidget(QWidget* w); + +private: + Ui::AttachmentsList *ui; + PTask mTask; + QWidget* mParentWidget; + AttachmentsListModel* mModel; + ChangesHistory mHistory; + + void updateActionsState(); +public slots: + void contextualMenu(const QPoint& point); + void importFile(); + void exportFile(); + void deleteFile(); + void renameFile(); +}; + +#endif // ATTACHMENTSLIST_H diff --git a/client/attachmentslist.ui b/client/attachmentslist.ui new file mode 100644 index 0000000..1504ae3 --- /dev/null +++ b/client/attachmentslist.ui @@ -0,0 +1,160 @@ + + + AttachmentsList + + + + 0 + 0 + 425 + 300 + + + + Form + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + Qt::CustomContextMenu + + + QListView::IconMode + + + + + + + Rename + + + Rename + + + + + Delete + + + + + Export... + + + Export + + + + + Import new... + + + Import + + + + + + + mListView + customContextMenuRequested(QPoint) + AttachmentsList + contextualMenu(QPoint) + + + 212 + 149 + + + 212 + 149 + + + + + mImportAction + triggered() + AttachmentsList + importFile() + + + -1 + -1 + + + 212 + 149 + + + + + mExportAction + triggered() + AttachmentsList + exportFile() + + + -1 + -1 + + + 212 + 149 + + + + + mDeleteAction + triggered() + AttachmentsList + deleteFile() + + + -1 + -1 + + + 212 + 149 + + + + + mRenameAction + triggered() + AttachmentsList + renameFile() + + + -1 + -1 + + + 212 + 149 + + + + + + contextualMenu(QPoint) + importFile() + exportFile() + deleteFile() + renameFile() + + diff --git a/client/chooka.pro b/client/chooka.pro new file mode 100644 index 0000000..3b6405e --- /dev/null +++ b/client/chooka.pro @@ -0,0 +1,142 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-01-21T12:27:27 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport +CONFIG += c++11 +TARGET = Litt +TEMPLATE = app +VERSION = 0.8.17 +VERSTR = '\\"$${VERSION}\\"' +DEFINES += VER=\"$${VERSTR}\" + +win32 { +DEFINES += TARGET_WIN +} + +macx { +QMAKE_MAC_SDK = macosx10.12 +DEFINES += TARGET_OSX +# DEFINES += USE_LOGGER +LIBS += ../lib/osx/libssl.a ../lib/osx/libcrypto.a +LIBS += -framework CoreFoundation +LIBS += -framework Cocoa +QMAKE_CXXFLAGS += -std=c++11 +QMAKE_CXXFLAGS += -std=c++0x +QMAKE_LFLAGS += -std=c++11 + +License.files = License.rtf +License.path = Contents/Resources +QMAKE_BUNDLE_DATA += License +} + +ICON = icons/appicon-osx.icns + +DEFINES += USE_ENCRYPTED_DB +DEFINES += SQLITE_HAS_CODEC SQLITE_TEMP_STORE=2 SQLITE_THREADSAFE +INCLUDEPATH += sqlitecpp/include +INCLUDEPATH += ../lib/include + + +SOURCES += main.cpp\ + mainwindow.cpp \ + storage.cpp \ + task.cpp \ + tasktreemodel.cpp \ + helper.cpp \ + encryption.cpp \ + newpassworddlg.cpp \ + passworddlg.cpp \ + appevents.cpp \ + sqlitecpp/src/Column.cpp \ + sqlitecpp/src/Database.cpp \ + sqlitecpp/src/Statement.cpp \ + sqlitecpp/src/Transaction.cpp \ + sqlite3.c \ + preferencesdlg.cpp \ + settings.cpp \ + timetreedlg.cpp \ + timetreemodel.cpp \ + timereportwizard.cpp \ + platforms/hidtracker.cpp \ + platforms/hidtrackerimpl.cpp \ + logger.cpp \ + timeintervaldlg.cpp \ + aboutdlg.cpp \ + attachmentslist.cpp \ + attachmentsdialog.cpp \ + taskaction.cpp \ + finddialog.cpp \ + findsupport.cpp \ + stopworkdialog.cpp \ + startworkdialog.cpp \ + twofish.cpp + +HEADERS += mainwindow.h \ + storage.h \ + task.h \ + tasktreemodel.h \ + config.h \ + helper.h \ + encryption.h \ + appevents.h \ + newpassworddlg.h \ + passworddlg.h \ + appevents.h \ + sqlitecpp/include/SQLiteCpp/Assertion.h \ + sqlitecpp/include/SQLiteCpp/Column.h \ + sqlitecpp/include/SQLiteCpp/Database.h \ + sqlitecpp/include/SQLiteCpp/Exception.h \ + sqlitecpp/include/SQLiteCpp/SQLiteCpp.h \ + sqlitecpp/include/SQLiteCpp/Statement.h \ + sqlitecpp/include/SQLiteCpp/Transaction.h \ + preferencesdlg.h \ + settings.h \ + timetreedlg.h \ + timetreemodel.h \ + timereportwizard.h \ + sqlite3.h \ + sqlite3ext.h \ + platforms/hidtracker.h \ + platforms/hidtrackerimpl.h \ + platforms/osx/hidtrackerimpl_osx.h \ + logger.h \ + timeintervaldlg.h \ + aboutdlg.h \ + attachmentslist.h \ + attachmentsdialog.h \ + platforms/osx/sleeptracker_osx.h \ + taskaction.h \ + finddialog.h \ + findsupport.h \ + stopworkdialog.h \ + startworkdialog.h \ + twofish.h + +FORMS += mainwindow.ui \ + newpassworddlg.ui \ + passworddlg.ui \ + preferencesdlg.ui \ + timetreedlg.ui \ + timeintervaldlg.ui \ + aboutdlg.ui \ + attachmentslist.ui \ + attachmentsdialog.ui \ + finddialog.ui \ + stopworkdialog.ui \ + startworkdialog.ui + +RESOURCES = mainwindow.qrc + +OBJECTIVE_SOURCES += \ + platforms/osx/hidtrackerimpl_osx.mm \ + platforms/osx/sleeptracker_osx.mm + +!include("fervor/Fervor.pri") { + error("Unable to include Fervor autoupdater.") +} diff --git a/client/config.h b/client/config.h new file mode 100644 index 0000000..6949af4 --- /dev/null +++ b/client/config.h @@ -0,0 +1,51 @@ +#ifndef __APP_CONFIG_H +#define __APP_CONFIG_H + +// Application name +#define APPNAME "Litt" + +// Company name +#define COMPANY "voipobjects.com" + +// Default database name +#define DATABASENAME "database.db" + +// Log file name +#define LOGNAME "litt-log.txt" + +// About text +#define ABOUTTEXT "Tiny outliner with time tracking capabilities" + +// Text for message box with "not implemented" notification +#define NOTIMPLEMENTEDTEXT "Not implemented in this version" + +// Settings file name +#define SETTINGS_FILENAME "litt.ini" + +// No password string +#define NOPASSWORDSTRING "" + +// Mime type of task items +#define NODE_MIME_TYPE "application/litt-node" + +// Exit code to signal about problems with database +#define EXITCODE_NO_DATABASE (1) + +// Timeline save to DB interval in seconds +#define TIMELINE_FLUSH_INTERVAL (300) + +// Text flushing interval +#define TEXT_FLUSH_INTERVAL (10) + +#ifdef TARGET_OSX +#define TRAY_START_ICON_NAME ":/icons/icons/starttracking-osx.png" +#define TRAY_STOP_ICON_NAME ":/icons/icons/stoptracking-osx.png" + +#define TRAY_DEFAULT_ICON_NAME ":/icons/icons/tray-default.png" +#define TRAY_RUNNING_ICON_NAME ":/icons/icons/tray-running.png" + +#define ACTION_START_ICON_NAME ":/icons/icons/clock-32x32.png" +#define ACTION_STOP_ICON_NAME ":/icons/icons/process-stop.png" +#endif + +#endif diff --git a/client/encryption.cpp b/client/encryption.cpp new file mode 100644 index 0000000..02121de --- /dev/null +++ b/client/encryption.cpp @@ -0,0 +1,191 @@ +#include "encryption.h" +#include + +#ifdef TARGET_WIN +# include +#endif + +BlowfishCipher::BlowfishCipher() +{ + +} + +BlowfishCipher::~BlowfishCipher() +{ + +} + +void BlowfishCipher::setKey(const QByteArray &ba) +{ + mKey = ba; + BF_set_key(&mContext, ba.count(), (unsigned char*)ba.data()); +} + +const QByteArray& BlowfishCipher::key() const +{ + return mKey; +} + +void BlowfishCipher::encrypt(const QByteArray &plain, QByteArray &encrypted) +{ + QByteArray plainProxy(plain); + if (plainProxy.length() % 8) + plainProxy.resize((8 - plainProxy.length() % 8) + plainProxy.length()); + encrypted.resize(plainProxy.length()); + + BF_cbc_encrypt((unsigned char*)plainProxy.data(), (unsigned char*)encrypted.data(), plainProxy.length(), &mContext, (unsigned char*)mIV.data(), BF_ENCRYPT); +} + +void BlowfishCipher::decrypt(const QByteArray &encrypted, QByteArray &plain) +{ + assert(encrypted.length() % 8 == 0); + plain.resize(encrypted.length()); + BF_cbc_encrypt((unsigned char*)encrypted.data(), (unsigned char*)plain.data(), encrypted.length(), &mContext, (unsigned char*)mIV.data(), BF_DECRYPT); +} + +// ----------- Twofish encryption --------- +TwofishCipher::TwofishCipher() + :mContext(nullptr) +{ + mContext = new Twofish(); +} + +TwofishCipher::~TwofishCipher() +{ + delete mContext; mContext = nullptr; +} + +void TwofishCipher::setKey(const QByteArray &ba) +{ + mKey = ba; + mContext->PrepareKey((Twofish_Byte*)ba.data(), ba.count(), &mKeyStruct); +} + +const QByteArray& TwofishCipher::key() const +{ + return mKey; +} + +void TwofishCipher::setIV(const QByteArray &ba) +{ + assert(ba.size() == 16); + mIV = ba; +} + +const QByteArray& TwofishCipher::IV() const +{ + return mIV; +} + +void TwofishCipher::encrypt(const QByteArray &plain, int plainOffset, QByteArray &encrypted, int encryptedOffset) +{ + assert((encrypted.length() - encryptedOffset) % 16 == 0); + + // Prepare XOR template + uint8_t xorTemplate[16]; + memcpy(xorTemplate, mIV.data(), 16); + + // Iterate blocks + int blockCount = (plain.size() - plainOffset) / 16; + for (int i=0; iEncrypt(&mKeyStruct, xored, blockOutput); + + // Replace XOR template + memcpy(xorTemplate, blockOutput, 16); + } + + // Encrypt tail if it exists + int tail = (plain.size() - plainOffset) % blocksize(); + if (tail) + { + uint8_t* blockInput = (uint8_t*)plain.data() + blockCount * 16 + plainOffset; + uint8_t* blockOutput = (uint8_t*)encrypted.data() + blockCount * 16 + encryptedOffset; + + // Xor block at first + uint8_t xored[16]; + for (int xorIndex = 0; xorIndex < 16; xorIndex++) + { + if (xorIndex < plain.size()) + xored[xorIndex] = blockInput[xorIndex] ^ xorTemplate[xorIndex]; + else + xored[xorIndex] = xorTemplate[xorIndex]; + } + // Encrypt block + mContext->Encrypt(&mKeyStruct, xored, blockOutput); + + // Replace XOR template + memcpy(xorTemplate, blockOutput, 16); + } +} + +void TwofishCipher::decrypt(const QByteArray &encrypted, int encryptedOffset, QByteArray &plain, int plainOffset) +{ + assert(encrypted.size() - encryptedOffset == plain.size() - plainOffset); + assert((encrypted.size() - encryptedOffset) % 16 == 0); + + // Prepare XOR template + uint8_t xorTemplate[16]; + memcpy(xorTemplate, mIV.data(), 16); + + // Iterate blocks + int blockCount = encrypted.size() / 16; + for (int i=0; iDecrypt(&mKeyStruct, blockInput, blockOutput); + + // Xor block + for (int xorIndex = 0; xorIndex < 16; xorIndex++) + blockOutput[i] = blockOutput[xorIndex] ^ xorTemplate[xorIndex]; + + // Replace XOR template + memcpy(xorTemplate, blockInput, 16); + } +} + + + +// ----------- SHA256 wrapper ------------- + +SHA256::SHA256() +{ + SHA256_Init(&mContext); + mDigest.resize(SHA256_DIGEST_LENGTH); +} + +SHA256::~SHA256() +{ + +} + +void SHA256::update(const void *data, int length) +{ + SHA256_Update(&mContext, data, length); +} + +void SHA256::final() +{ + SHA256_Final((unsigned char*)mDigest.data(), &mContext); +} + +// ----------- IV ---------------- + +void IV::Generate(QByteArray &buffer) +{ + uint8_t* data = (uint8_t*)buffer.data(); + for (int i=0; i +#include +#include +#include "twofish.h" + +class BlowfishCipher +{ +protected: + QByteArray mKey; + QByteArray mIV; + BF_KEY mContext; + +public: + BlowfishCipher(); + ~BlowfishCipher(); + void setKey(const QByteArray& ba); + const QByteArray& key() const; + void setIV(const QByteArray& ba); + QByteArray& IV() const; + + void encrypt(const QByteArray& plain, QByteArray& encrypted); + void decrypt(const QByteArray& encrypted, QByteArray& plain); +}; + +class TwofishCipher +{ +protected: + QByteArray mKey; + QByteArray mIV; + TwofishKey mKeyStruct; + Twofish* mContext; + +public: + TwofishCipher(); + ~TwofishCipher(); + + int blocksize() const { return 16; } + void setKey(const QByteArray& ba); + const QByteArray& key() const; + + // IV vector must be 16 bytes + void setIV(const QByteArray& ba); + const QByteArray& IV() const; + + // Plain and encrypted must be padded to 16 bytes boundary before call + void encrypt(const QByteArray& plain, int plainOffset, QByteArray& encrypted, int encryptedOffset); + void decrypt(const QByteArray& encrypted, int encryptedOffset, QByteArray& plain, int plainOffset); +}; + + +class SHA256 +{ +protected: + SHA256_CTX mContext; + QByteArray mDigest; +public: + SHA256(); + ~SHA256(); + + QByteArray& digest(); + void update(const void* data, int length); + void final(); +}; + +class IV +{ +public: + static void Generate(QByteArray& buffer); +}; + +#endif // ENCRYPTION_H diff --git a/client/fervor/CMakeLists.txt b/client/fervor/CMakeLists.txt new file mode 100644 index 0000000..8cba95c --- /dev/null +++ b/client/fervor/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 2.8.3) +project(Fervor) +option(FERVOR_BUILD_SAMPLE "Should the sample be built?" OFF) +option(FERVOR_BUILD_TESTS "Should the tests be built" OFF) +find_package(Qt4 REQUIRED) +set(QT_USE_QTNETWORK true) +set(QT_USE_QTWEBKIT true) +include(${QT_USE_FILE}) +add_definitions(${QT_DEFINITIONS}) +if(DEFINED FERVOR_APP_VERSION) + add_definitions(-DFV_APP_VERSION="${FERVOR_APP_VERSION}") +else() + add_definitions(-DFV_APP_VERSION="1.0") + message(WARNING "No version information for Fervor given (please set FERVOR_APP_VERSION)! Assuming 1.0.") +endif() +if(DEFINED FERVOR_APP_NAME) + add_definitions(-DFV_APP_NAME="${FERVOR_APP_NAME}") +else() + add_definitions(-DFV_APP_NAME="App Name") + message(WARNING "No application name for Fervor given (please set FERVOR_APP_NAME)! Assuming 'App Name'.") +endif() + +set(SOURCES + fvavailableupdate.cpp + fvignoredversions.cpp + fvplatform.cpp + fvupdateconfirmdialog.cpp + fvupdater.cpp + fvupdatewindow.cpp + fvversioncomparator.cpp +) + +set(MOC_HEADERS + fvavailableupdate.h + fvignoredversions.h + fvplatform.h + fvupdateconfirmdialog.h + fvupdater.h + fvupdatewindow.h +) + +set(UIS + fvupdateconfirmdialog.ui + fvupdatewindow.ui +) + +qt4_wrap_ui(UI_HEADERS ${UIS}) +qt4_wrap_cpp(MOC_SOURCES ${MOC_HEADERS}) + +include_directories( + ${CMAKE_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) +add_library(Fervor ${SOURCES} ${MOC_HEADERS} ${MOC_SOURCES} ${UIS}) + +if(FERVOR_BUILD_SAMPLE) + add_subdirectory(sample) +endif() +if(FERVOR_BUILD_TESTS) + ENABLE_TESTING() + add_subdirectory(tests) +endif() \ No newline at end of file diff --git a/client/fervor/Fervor.pri b/client/fervor/Fervor.pri new file mode 100644 index 0000000..e570d40 --- /dev/null +++ b/client/fervor/Fervor.pri @@ -0,0 +1,52 @@ +QT += core gui widgets network + +isEmpty(FV_APP_NAME) { + warning("Fervor: falling back to application name '$$TARGET'") + DEFINES += FV_APP_NAME=\\\"$$TARGET\\\" +} else { + message("Fervor: building for application name '$$FV_APP_NAME'") + DEFINES += FV_APP_NAME=\\\"$$FV_APP_NAME\\\" +} + +isEmpty(FV_APP_VERSION) { + warning("Fervor: falling back to application version '$$VERSION'") + DEFINES += FV_APP_VERSION=\\\"$$VERSION\\\" +} else { + message("Fervor: building for application version '$$FV_APP_VERSION'") + DEFINES += FV_APP_VERSION=\\\"$$FV_APP_VERSION\\\" +} + +# Unit tests +#DEFINES += FV_DEBUG=1 +#DEPENDPATH += "$$PWD/tests/" +#INCLUDEPATH += "$$PWD/tests/" +#CONFIG += qtestlib +#SOURCES += tests/fvversioncomparatortest.cpp +#HEADERS += tests/fvversioncomparatortest.h + +DEPENDPATH += "$$PWD" +INCLUDEPATH += "$$PWD" + +SOURCES += \ + $$PWD/fvupdatewindow.cpp \ + $$PWD/fvupdater.cpp \ + $$PWD/fvversioncomparator.cpp \ + $$PWD/fvplatform.cpp \ + $$PWD/fvignoredversions.cpp \ + $$PWD/fvavailableupdate.cpp \ + $$PWD/fvupdateconfirmdialog.cpp + +HEADERS += \ + $$PWD/fvupdatewindow.h \ + $$PWD/fvupdater.h \ + $$PWD/fvversioncomparator.h \ + $$PWD/fvplatform.h \ + $$PWD/fvignoredversions.h \ + $$PWD/fvavailableupdate.h \ + $$PWD/fvupdateconfirmdialog.h + +FORMS += $$PWD/fvupdatewindow.ui \ + $$PWD/fvupdateconfirmdialog.ui + +TRANSLATIONS += $$PWD/fervor_lt.ts +CODECFORTR = UTF-8 diff --git a/client/fervor/LICENSE b/client/fervor/LICENSE new file mode 100644 index 0000000..d9c310d --- /dev/null +++ b/client/fervor/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2012 Linas Valiukas and others. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/client/fervor/README.mdown b/client/fervor/README.mdown new file mode 100644 index 0000000..dc33579 --- /dev/null +++ b/client/fervor/README.mdown @@ -0,0 +1,213 @@ +Check out the [`autoupdate` branch](fervor/tree/autoupdate) by Torben Dannhauer too! + +---- + +Fervor is a simple, multiplatform ([Qt](http://qt.nokia.com/)-based) application update tool, inspired by [Sparkle](http://sparkle.andymatuschak.org/). + + +# Description + +Fervor is a software library that you include into your own [Qt](http://qt.nokia.com/)-based application in order to enable the application to automatically check for updates and suggest to install them. + +When installed and enabled, Fervor downloads a "flavoured" RSS feed (dubbed "appcast") and checks whether an update to the application is available. The RSS feed ("appcast") lists various versions of the application ("1.0", "1.1", "2.0", ...) that are available for download. + +When a newer version of the application is found in the "appcast" (e.g. the user is using 1.0, and 1.1 is available), a dialog is presented to the user (see below for example) that allows the user to choose whether he/she wants to install the update, be reminded about the update later, or skip a particular proposed version altogether. A dialog also shows some release notes about the proposed update that help the user to choose whether or not to install an update. + +At the moment, Fervor is not as cool as [Sparkle](http://sparkle.andymatuschak.org/) -- it is not able to install the actual update automatically (the user is given an option to download and install the update manually). Pull requests with unattended install modules for `.dmg`, `.pkg` (Mac OS X), `.msi` (Windows), `.rpm`, `.deb` (Linux) are welcome! + + +# Features + +* Multiplaform - works (should work) on Windows, Mac OS X, Linux, ... +* Checks for updates both automatically and manually. +* Displays release notes. +* Proposed updates might be skipped or installed later by the user. +* Backwards compatible with Sparkle (can use the very same "appcast" RSS). +* BSD license. + + +# Screenshots + +![](http://pypt.github.com/fervor/screenshot-1.png "Update is available") + +![](http://pypt.github.com/fervor/screenshot-2.png "Download the update") + + +# Installation and Usage + +(This is a description of the sample application located in `sample/`.) + +I'm writing an application called *Sample*. It's version is only `1.0`, and I would like to enable the users of my application to be notified when I decide to release new versions of *Sample* (`1.1`, `1.2`, maybe even `2.0` if I'm lucky) and help them to download and install each and every update of the application. Thus, I decide I'll use Fervor for that. + +This is what I do: + + +## 1. Download Fervor + +Git clone Fervor: + + git clone https://github.com/pypt/fervor.git fervor + +...or add it as a submodule if you're using Git in your project: + + git submodule add https://github.com/pypt/fervor.git fervor + git submodule init + git submodule update + +You might also download [a tarball](https://github.com/pypt/fervor/tarball/master). + + +## 2. Include Fervor into your project + +You can use Fervor either in your Qt Creator project or in your CMake project. + +If you want to include Fervor into your Qt Creator project, read section #1 below. + +If you use CMake and would like to build Fervor with it instead of Qt Creator, read section #2 below. + + +### 1. Include Fervor into your Qt Creator Project (`.pro` file) + +Include Fervor's project include file `Fervor.pri` after setting your application's `TARGET` and `VERSION`: + + QT += core gui + + TARGET = Sample + VERSION = 1.0 + TEMPLATE = app + + # ... + + # Fervor autoupdater + !include("fervor/Fervor.pri") { + error("Unable to include Fervor autoupdater.") + } + +Fervor will append itself to your application's `HEADERS`, `SOURCES`, `FORMS` and `TRANSLATIONS`, and thus will become an integral part of your application's binary. + +**or** + +### 2. Include Fervor into your CMake Project (`CMakeLists.txt` file) + +In your `CMakeLists.txt` set the application name and version info, include the fervor-directory and link with it: + + set(FERVOR_APP_NAME "Sample") + set(FERVOR_APP_VERSION "1.0") + + add_subdirectory(fervor-directory) + + include_directories( + ... + fervor-directory + ) + ... + target_link_libraries(Sample + ... + Fervor + ) + +*Note:* `fervor-directory` must be a subdirectory in your source-directory. + +## 3. Set your application's `applicationName`, `applicationVersion`, `organizationName` and `organizationDomain` if you haven't done so already + +Fervor uses `QApplication::applicationName()`, `QApplication::applicationVersion()`, `QApplication::organizationName()` and `QApplication::organizationDomain()` for its own needs. + +If you don't set `QApplication::applicationName()` and `QApplication::applicationVersion()`, Fervor will do that for you. However, `QApplication::organizationName()` and `QApplication::organizationDomain()` have to be set by hand. + +Example of setting those four values: + + int main(int argc, char *argv[]) + { + QApplication a(argc, argv); + + QApplication::setApplicationName("Sample"); + QApplication::setApplicationVersion("1.0"); + QApplication::setOrganizationName("pypt"); + QApplication::setOrganizationDomain("pypt.lt"); + + // ... + } + + +## 4. Set the Fervor's appcast URL right after you start your application + +Set the "appcast" URL in Fervor's singleton `FVUpdater::sharedUpdater()` before you do anything else, but **after** you set `applicationName`, `applicationVersion`, `organizationName` and `organizationDomain` in `QApplication`. It is probably a good idea to do that in `int main(int argc, char *argv[])` too, right after setting application name, version, organization name and domain: + + #include "fvupdater.h" + + // ... + + int main(int argc, char *argv[]) + { + QApplication a(argc, argv); + + QApplication::setApplicationName("Sample"); + QApplication::setApplicationVersion("1.0"); + QApplication::setOrganizationName("pypt"); + QApplication::setOrganizationDomain("pypt.lt"); + + // Set this to your own appcast URL, of course + FvUpdater::sharedUpdater()->SetFeedURL("https://raw.github.com/pypt/fervor/master/sample/Appcast.xml"); + + // ... + } + + +## 5. Enable checking for updates right after starting the application (if you want to) + +Call Fervor's `CheckForUpdatesSilent()` whenever you feel like is a good moment for the Fervor to check for updates. "Silent" part here means that Fervor will not display error dialogs or the "No updates found." notification. + +I've decided that I'll check for updates in `int main(int argc, char *argv[])` too: + + #include "fvupdater.h" + + // ... + + int main(int argc, char *argv[]) + { + QApplication a(argc, argv); + + // <...> setApplicationName(), setApplicationVersion(), SetFeedURL(), etc. + + // Check for updates silently -- this will not block the initialization of + // your application, just start a HTTP request and return immediately. + FvUpdater::sharedUpdater()->CheckForUpdatesSilent(); + + // ... + } + + +## 6. Enable checking for updates manually by the user (if you want to) + +You might want to implement a menu item called "Check for Updates..." that would allow the user to check for updated versions of your application manually. This menu item (or a button, or some other widget) would have to be attached to the `CheckForUpdatesNotSilent()` function of the Fervor's singleton. *Not silent* means that Fervor will notify the user about connection problems (if any) and even when no updates were found. + + #include "fvupdater.h" + + // <...> + + // ui->updateButton is QButton + connect(ui->updateButton, SIGNAL(clicked()), + FvUpdater::sharedUpdater(), SLOT(CheckForUpdatesNotSilent())); + + +## 7. Publish an "appcast" somewhere suited for your needs + +Again, "appcast" is an RSS feed with an additional `fervor` XML namespace. A type of "appcast" used by "Fervor" lists various application versions as ``s, and a single `` might point to several platform builds of your application (Windows build, Linux build, Mac OS X build, ...) + +An "appcast" also links to a webpage with each version's "release notes" that are shown to the user when a particular version of the application update is proposed. + +When the user clicks "Install Update", he / she is then shown a link (``) of an application update download for his particular platform. + +See [https://raw.github.com/pypt/fervor/master/sample/Appcast.xml](https://raw.github.com/pypt/fervor/master/sample/Appcast.xml) for an "appcast" example, and [http://pypt.github.com/fervor/RelNotes.html](http://pypt.github.com/fervor/RelNotes.html) for an "release notes" example. + +It is up to you to implement "appcasts" and "release notes". If you don't release too many versions of your application, it is even plausible to edit them by hand every time you release an update. + + +# Donations + +Donors: Marek Pazdan. Thanks! + + +# Contacts + +I'm Linas, my email is diff --git a/client/fervor/fervor_lt.qm b/client/fervor/fervor_lt.qm new file mode 100644 index 0000000..0631ccc Binary files /dev/null and b/client/fervor/fervor_lt.qm differ diff --git a/client/fervor/fervor_lt.ts b/client/fervor/fervor_lt.ts new file mode 100644 index 0000000..91dbbef --- /dev/null +++ b/client/fervor/fervor_lt.ts @@ -0,0 +1,127 @@ + + + +UTF-8 + + FvUpdateConfirmDialog + + + Software Update + Update + Programos naujinimas + + + + The update file is located at: + Naujinio adresas: + + + + <a href="%1">%1</a> + <a href="%1">%1</a> + + + + Download this update, close "%1", install it, and then reopen "%1". + Atsisiųskite naujinį, išjunkite %1, įdiekite naujinį ir vėl paleiskite %1. + + + + When you click "OK", this link will be opened in your browser. + Jei paspauskite „Gerai“, naujinio nuoroda atsidarys Jūsų naršyklėje. + + + + FvUpdateWindow + + + Software Update + Naujinimas + + + + A new version of %1 is available! + A new version of %s is available! + Išleista nauja „%1“ versija! + + + + %1 %2 is now available - you have %3. Would you like to download it now? + %s %s is now available - you have %s. Would you like to download it now? + Išleista nauja %1 versija %2. Jūs naudojate %3. Ar norėtumėte atnaujinti? + + + + Release Notes: + Atnaujinta: + + + + about:blank + about:blank + + + + Skip This Version + Praleisti šį naujinį + + + + Remind Me Later + Priminti vėliau + + + + Install Update + Įdiegti naujinį + + + + FvUpdater + + + Unable to open this link in a browser. Please do it manually. + Nepavyko atidaryti nuorodos naršyklėje. Pabandykite nuorodą nukopijuoti ir atidaryti pats. + + + + Feed download failed: %1. + Nepavyko atsisiųsti informacijos apie naujinį: %1. + + + + Feed parsing failed: %1 %2. + Nepavyko perskaityti informacijos apie naujinį: %1 %2. + + + + Feed error: "release notes" link is empty + Nepavyko rasti nuorodos į pastabas apie naujinį + + + + Feed error: invalid "release notes" link + Nekorektiška nuoroda į pastabas apie naujinį + + + + Feed error: invalid "enclosure" with the download link + Nepavyko rasti nuorodos į failą su naujiniu + + + + No updates were found. + Naujinių nėra. + + + + Error + Klaida + + + + Information + Informacija + + + diff --git a/client/fervor/fvavailableupdate.cpp b/client/fervor/fvavailableupdate.cpp new file mode 100644 index 0000000..f0f6cb9 --- /dev/null +++ b/client/fervor/fvavailableupdate.cpp @@ -0,0 +1,97 @@ +#include "fvavailableupdate.h" + +FvAvailableUpdate::FvAvailableUpdate(QObject *parent) : + QObject(parent) +{ + // noop +} + +QString FvAvailableUpdate::GetTitle() +{ + return m_title; +} + +void FvAvailableUpdate::SetTitle(QString title) +{ + m_title = title; +} + +QUrl FvAvailableUpdate::GetReleaseNotesLink() +{ + return m_releaseNotesLink; +} + +void FvAvailableUpdate::SetReleaseNotesLink(QUrl releaseNotesLink) +{ + m_releaseNotesLink = releaseNotesLink; +} + +void FvAvailableUpdate::SetReleaseNotesLink(QString releaseNotesLink) +{ + SetReleaseNotesLink(QUrl(releaseNotesLink)); +} + +QString FvAvailableUpdate::GetPubDate() +{ + return m_pubDate; +} + +void FvAvailableUpdate::SetPubDate(QString pubDate) +{ + m_pubDate = pubDate; +} + +QUrl FvAvailableUpdate::GetEnclosureUrl() +{ + return m_enclosureUrl; +} + +void FvAvailableUpdate::SetEnclosureUrl(QUrl enclosureUrl) +{ + m_enclosureUrl = enclosureUrl; +} + +void FvAvailableUpdate::SetEnclosureUrl(QString enclosureUrl) +{ + SetEnclosureUrl(QUrl(enclosureUrl)); +} + +QString FvAvailableUpdate::GetEnclosureVersion() +{ + return m_enclosureVersion; +} + +void FvAvailableUpdate::SetEnclosureVersion(QString enclosureVersion) +{ + m_enclosureVersion = enclosureVersion; +} + +QString FvAvailableUpdate::GetEnclosurePlatform() +{ + return m_enclosurePlatform; +} + +void FvAvailableUpdate::SetEnclosurePlatform(QString enclosurePlatform) +{ + m_enclosurePlatform = enclosurePlatform; +} + +unsigned long FvAvailableUpdate::GetEnclosureLength() +{ + return m_enclosureLength; +} + +void FvAvailableUpdate::SetEnclosureLength(unsigned long enclosureLength) +{ + m_enclosureLength = enclosureLength; +} + +QString FvAvailableUpdate::GetEnclosureType() +{ + return m_enclosureType; +} + +void FvAvailableUpdate::SetEnclosureType(QString enclosureType) +{ + m_enclosureType = enclosureType; +} diff --git a/client/fervor/fvavailableupdate.h b/client/fervor/fvavailableupdate.h new file mode 100644 index 0000000..bbce04a --- /dev/null +++ b/client/fervor/fvavailableupdate.h @@ -0,0 +1,51 @@ +#ifndef FVAVAILABLEUPDATE_H +#define FVAVAILABLEUPDATE_H + +#include +#include + +class FvAvailableUpdate : public QObject +{ + Q_OBJECT +public: + explicit FvAvailableUpdate(QObject *parent = 0); + + QString GetTitle(); + void SetTitle(QString title); + + QUrl GetReleaseNotesLink(); + void SetReleaseNotesLink(QUrl releaseNotesLink); + void SetReleaseNotesLink(QString releaseNotesLink); + + QString GetPubDate(); + void SetPubDate(QString pubDate); + + QUrl GetEnclosureUrl(); + void SetEnclosureUrl(QUrl enclosureUrl); + void SetEnclosureUrl(QString enclosureUrl); + + QString GetEnclosureVersion(); + void SetEnclosureVersion(QString enclosureVersion); + + QString GetEnclosurePlatform(); + void SetEnclosurePlatform(QString enclosurePlatform); + + unsigned long GetEnclosureLength(); + void SetEnclosureLength(unsigned long enclosureLength); + + QString GetEnclosureType(); + void SetEnclosureType(QString enclosureType); + +private: + QString m_title; + QUrl m_releaseNotesLink; + QString m_pubDate; + QUrl m_enclosureUrl; + QString m_enclosureVersion; + QString m_enclosurePlatform; + unsigned long m_enclosureLength; + QString m_enclosureType; + +}; + +#endif // FVAVAILABLEUPDATE_H diff --git a/client/fervor/fvignoredversions.cpp b/client/fervor/fvignoredversions.cpp new file mode 100644 index 0000000..ad3a09e --- /dev/null +++ b/client/fervor/fvignoredversions.cpp @@ -0,0 +1,86 @@ +#include "fvignoredversions.h" +#include "fvversioncomparator.h" +#include +#include +#include + +// QSettings key for the latest skipped version +#define FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY "FVLatestSkippedVersion" + + +FVIgnoredVersions::FVIgnoredVersions(QObject *parent) : + QObject(parent) +{ + // noop +} + +bool FVIgnoredVersions::VersionIsIgnored(QString version) +{ + // We assume that variable 'version' contains either: + // 1) The current version of the application (ignore) + // 2) The version that was skipped before and thus stored in QSettings (ignore) + // 3) A newer version (don't ignore) + // 'version' is not likely to contain an older version in any case. + + if (version == FV_APP_VERSION) { + return true; + } + +#ifdef Q_WS_MAC + QSettings settings(QSettings::IniFormat, + QSettings::UserScope, + QApplication::organizationDomain(), + QApplication::applicationName()); +#else + QSettings settings(QSettings::IniFormat, + QSettings::UserScope, + QApplication::organizationName(), + QApplication::applicationName()); +#endif + + if (settings.contains(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY)) { + QString lastSkippedVersion = settings.value(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY).toString(); + if (version == lastSkippedVersion) { + // Implicitly skipped version - skip + return true; + } + } + + std::string currentAppVersion = std::string(FV_APP_VERSION); + std::string suggestedVersion = std::string(version.toStdString()); + if (FvVersionComparator::CompareVersions(currentAppVersion, suggestedVersion) == FvVersionComparator::kAscending) { + // Newer version - do not skip + return false; + } + + // Fallback - not skip + return false; +} + +void FVIgnoredVersions::IgnoreVersion(QString version) +{ + if (version == FV_APP_VERSION) { + // Don't ignore the current version + return; + } + + if (version.isEmpty()) { + return; + } + +#ifdef Q_WS_MAC + QSettings settings(QSettings::IniFormat, + QSettings::UserScope, + QApplication::organizationDomain(), + QApplication::applicationName()); +#else + QSettings settings(QSettings::IniFormat, + QSettings::UserScope, + QApplication::organizationName(), + QApplication::applicationName()); +#endif + + settings.setValue(FV_IGNORED_VERSIONS_LATEST_SKIPPED_VERSION_KEY, version); + + return; +} diff --git a/client/fervor/fvignoredversions.h b/client/fervor/fvignoredversions.h new file mode 100644 index 0000000..4e85f1b --- /dev/null +++ b/client/fervor/fvignoredversions.h @@ -0,0 +1,19 @@ +#ifndef FVIGNOREDVERSIONS_H +#define FVIGNOREDVERSIONS_H + +#include + +class FVIgnoredVersions : public QObject +{ + Q_OBJECT + +public: + static bool VersionIsIgnored(QString version); + static void IgnoreVersion(QString version); + +private: + explicit FVIgnoredVersions(QObject *parent = 0); + +}; + +#endif // FVIGNOREDVERSIONS_H diff --git a/client/fervor/fvplatform.cpp b/client/fervor/fvplatform.cpp new file mode 100644 index 0000000..1a90ab1 --- /dev/null +++ b/client/fervor/fvplatform.cpp @@ -0,0 +1,210 @@ +#include "fvplatform.h" +#include +#include + +FvPlatform::FvPlatform(QObject *parent) : + QObject(parent) +{ + // noop +} + +bool FvPlatform::CurrentlyRunningOnPlatform(QString platform) +{ + platform = platform.toUpper().trimmed(); + if (platform.isEmpty()) { + return false; + } + + // Defined on AIX. +#ifdef Q_OS_AIX + if (platform == "Q_OS_AIX") { + return true; + } +#endif + + // Q_OS_BSD4 ("Defined on Any BSD 4.4 system") intentionally skipped. + + // Defined on BSD/OS. +#ifdef Q_OS_BSDI + if (platform == "Q_OS_BSDI") { + return true; + } +#endif + + // Defined on Cygwin. +#ifdef Q_OS_CYGWIN + if (platform == "Q_OS_CYGWIN") { + return true; + } +#endif + + // Q_OS_DARWIN ("Defined on Darwin OS (synonym for Q_OS_MAC)") intentionally skipped. + + // Defined on DG/UX. +#ifdef Q_OS_DGUX + if (platform == "Q_OS_DGUX") { + return true; + } +#endif + + // Defined on DYNIX/ptx. +#ifdef Q_OS_DYNIX + if (platform == "Q_OS_DYNIX") { + return true; + } +#endif + + // Defined on FreeBSD. +#ifdef Q_OS_FREEBSD + if (platform == "Q_OS_FREEBSD") { + return true; + } +#endif + + // Defined on HP-UX. +#ifdef Q_OS_HPUX + if (platform == "Q_OS_HPUX") { + return true; + } +#endif + + // Defined on GNU Hurd. +#ifdef Q_OS_HURD + if (platform == "Q_OS_HURD") { + return true; + } +#endif + + // Defined on SGI Irix. +#ifdef Q_OS_IRIX + if (platform == "Q_OS_IRIX") { + return true; + } +#endif + + // Defined on Linux. +#ifdef Q_OS_LINUX + if (platform == "Q_OS_LINUX") { + return true; + } +#endif + + // Defined on LynxOS. +#ifdef Q_OS_LYNX + if (platform == "Q_OS_LYNX") { + return true; + } +#endif + + // Defined on MAC OS (synonym for Darwin). +#ifdef Q_OS_MAC + if (platform == "Q_OS_MAC") { + return true; + } +#endif + + // Q_OS_MSDOS ("Defined on MS-DOS and Windows") intentionally skipped. + + // Defined on NetBSD. +#ifdef Q_OS_NETBSD + if (platform == "Q_OS_NETBSD") { + return true; + } +#endif + + // Defined on OS/2. +#ifdef Q_OS_OS2 + if (platform == "Q_OS_OS2") { + return true; + } +#endif + + // Defined on OpenBSD. +#ifdef Q_OS_OPENBSD + if (platform == "Q_OS_OPENBSD") { + return true; + } +#endif + + // Defined on XFree86 on OS/2 (not PM). +#ifdef Q_OS_OS2EMX + if (platform == "Q_OS_OS2EMX") { + return true; + } +#endif + + // Defined on HP Tru64 UNIX. +#ifdef Q_OS_OSF + if (platform == "Q_OS_OSF") { + return true; + } +#endif + + // Defined on QNX Neutrino. +#ifdef Q_OS_QNX + if (platform == "Q_OS_QNX") { + return true; + } +#endif + + // Defined on Reliant UNIX. +#ifdef Q_OS_RELIANT + if (platform == "Q_OS_RELIANT") { + return true; + } +#endif + + // Defined on SCO OpenServer 5. +#ifdef Q_OS_SCO + if (platform == "Q_OS_SCO") { + return true; + } +#endif + + // Defined on Sun Solaris. +#ifdef Q_OS_SOLARIS + if (platform == "Q_OS_SOLARIS") { + return true; + } +#endif + + // Defined on Symbian. +#ifdef Q_OS_SYMBIAN + if (platform == "Q_OS_SYMBIAN") { + return true; + } +#endif + + // Defined on DEC Ultrix. +#ifdef Q_OS_ULTRIX + if (platform == "Q_OS_ULTRIX") { + return true; + } +#endif + + // Q_OS_UNIX ("Defined on Any UNIX BSD/SYSV system") intentionally skipped. + + // Defined on UnixWare 7, Open UNIX 8. +#ifdef Q_OS_UNIXWARE + if (platform == "Q_OS_UNIXWARE") { + return true; + } +#endif + + // Defined on Windows CE (note: goes before Q_OS_WIN32) +#ifdef Q_OS_WINCE + if (platform == "Q_OS_WINCE") { + return true; + } +#endif + + // Defined on all supported versions of Windows. +#ifdef Q_OS_WIN32 + if (platform == "Q_OS_WIN32") { + return true; + } +#endif + + // Fallback + return false; +} diff --git a/client/fervor/fvplatform.h b/client/fervor/fvplatform.h new file mode 100644 index 0000000..a527518 --- /dev/null +++ b/client/fervor/fvplatform.h @@ -0,0 +1,18 @@ +#ifndef FVPLATFORM_H +#define FVPLATFORM_H + +#include + +class FvPlatform : public QObject +{ + Q_OBJECT + +public: + static bool CurrentlyRunningOnPlatform(QString platform); + +private: + explicit FvPlatform(QObject *parent = 0); + +}; + +#endif // FVPLATFORM_H diff --git a/client/fervor/fvupdateconfig.h.sample b/client/fervor/fvupdateconfig.h.sample new file mode 100644 index 0000000..77d39e7 --- /dev/null +++ b/client/fervor/fvupdateconfig.h.sample @@ -0,0 +1,13 @@ +#ifndef FVUPDATECONFIG_H +#define FVUPDATECONFIG_H + +// +// Info.plist: +// +// SUEnableSystemProfiling = YES +// SUExpectsDSASignature = YES +// SUFeedURL = http://anglonas.fotonija.lt/MacOSX/updates.php +// SUPublicDSAKeyFile = aupdate_dsa_pub.pem +// + +#endif // FVUPDATECONFIG_H diff --git a/client/fervor/fvupdateconfirmdialog.cpp b/client/fervor/fvupdateconfirmdialog.cpp new file mode 100644 index 0000000..33afeb0 --- /dev/null +++ b/client/fervor/fvupdateconfirmdialog.cpp @@ -0,0 +1,51 @@ +#include "fvupdateconfirmdialog.h" +#include "fvavailableupdate.h" +#include "fvupdater.h" +#include "ui_fvupdateconfirmdialog.h" +#include + + +FvUpdateConfirmDialog::FvUpdateConfirmDialog(QWidget *parent) : + QDialog(parent), + m_ui(new Ui::FvUpdateConfirmDialog) +{ + m_ui->setupUi(this); + + // Delete on close + setAttribute(Qt::WA_DeleteOnClose, true); + + // Set the "close app, then reopen" string + QString closeReopenString = m_ui->downloadThisUpdateLabel->text().arg(QString::fromUtf8(FV_APP_NAME)); + m_ui->downloadThisUpdateLabel->setText(closeReopenString); + + // Connect buttons + connect(m_ui->confirmButtonBox, SIGNAL(accepted()), + FvUpdater::sharedUpdater(), SLOT(UpdateInstallationConfirmed())); + connect(m_ui->confirmButtonBox, SIGNAL(rejected()), + FvUpdater::sharedUpdater(), SLOT(UpdateInstallationNotConfirmed())); +} + +FvUpdateConfirmDialog::~FvUpdateConfirmDialog() +{ + delete m_ui; +} + +bool FvUpdateConfirmDialog::UpdateWindowWithCurrentProposedUpdate() +{ + FvAvailableUpdate* proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate(); + if (! proposedUpdate) { + return false; + } + + QString downloadLinkString = m_ui->updateFileLinkLabel->text() + .arg(proposedUpdate->GetEnclosureUrl().toString()); + m_ui->updateFileLinkLabel->setText(downloadLinkString); + + return true; +} + +void FvUpdateConfirmDialog::closeEvent(QCloseEvent* event) +{ + FvUpdater::sharedUpdater()->updateConfirmationDialogWasClosed(); + event->accept(); +} diff --git a/client/fervor/fvupdateconfirmdialog.h b/client/fervor/fvupdateconfirmdialog.h new file mode 100644 index 0000000..19db4ad --- /dev/null +++ b/client/fervor/fvupdateconfirmdialog.h @@ -0,0 +1,27 @@ +#ifndef FVUPDATECONFIRMDIALOG_H +#define FVUPDATECONFIRMDIALOG_H + +#include + +namespace Ui { +class FvUpdateConfirmDialog; +} + +class FvUpdateConfirmDialog : public QDialog +{ + Q_OBJECT + +public: + explicit FvUpdateConfirmDialog(QWidget *parent = 0); + ~FvUpdateConfirmDialog(); + + // Update the current update proposal from FvUpdater + bool UpdateWindowWithCurrentProposedUpdate(); + + void closeEvent(QCloseEvent* event); + +private: + Ui::FvUpdateConfirmDialog* m_ui; +}; + +#endif // FVUPDATECONFIRMDIALOG_H diff --git a/client/fervor/fvupdateconfirmdialog.ui b/client/fervor/fvupdateconfirmdialog.ui new file mode 100644 index 0000000..a7aa039 --- /dev/null +++ b/client/fervor/fvupdateconfirmdialog.ui @@ -0,0 +1,65 @@ + + + FvUpdateConfirmDialog + + + + 0 + 0 + 480 + 160 + + + + Software Update + + + + + + The update file is located at: + + + + + + + <a href="%1">%1</a> + + + true + + + Qt::TextBrowserInteraction + + + + + + + Download this update, close "%1", install it, and then reopen "%1". + + + + + + + When you click "OK", this link will be opened in your browser. + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + diff --git a/client/fervor/fvupdater.cpp b/client/fervor/fvupdater.cpp new file mode 100644 index 0000000..e9b1a3c --- /dev/null +++ b/client/fervor/fvupdater.cpp @@ -0,0 +1,602 @@ +#include "fvupdater.h" +#include "fvupdatewindow.h" +#include "fvupdateconfirmdialog.h" +#include "fvplatform.h" +#include "fvignoredversions.h" +#include "fvavailableupdate.h" +#include +#include +#include +#include +#include + +#ifndef FV_APP_NAME +# error "FV_APP_NAME is undefined (must have been defined by Fervor.pri)" +#endif +#ifndef FV_APP_VERSION +# error "FV_APP_VERSION is undefined (must have been defined by Fervor.pri)" +#endif + + +#ifdef FV_DEBUG + // Unit tests +# include "fvversioncomparatortest.h" +#endif + + +FvUpdater* FvUpdater::m_Instance = 0; + + +FvUpdater* FvUpdater::sharedUpdater() +{ + static QMutex mutex; + if (! m_Instance) { + mutex.lock(); + + if (! m_Instance) { + m_Instance = new FvUpdater; + } + + mutex.unlock(); + } + + return m_Instance; +} + +void FvUpdater::drop() +{ + static QMutex mutex; + mutex.lock(); + delete m_Instance; + m_Instance = 0; + mutex.unlock(); +} + +FvUpdater::FvUpdater() : QObject(0) +{ + m_reply = 0; + m_updaterWindow = 0; + m_updateConfirmationDialog = 0; + m_proposedUpdate = 0; + + // Translation mechanism + installTranslator(); + +#ifdef FV_DEBUG + // Unit tests + FvVersionComparatorTest* test = new FvVersionComparatorTest(); + test->runAll(); + delete test; +#endif + +} + +FvUpdater::~FvUpdater() +{ + if (m_proposedUpdate) { + delete m_proposedUpdate; + m_proposedUpdate = 0; + } + + hideUpdateConfirmationDialog(); + hideUpdaterWindow(); +} + +void FvUpdater::installTranslator() +{ + QTranslator translator; + QString locale = QLocale::system().name(); + translator.load(QString("fervor_") + locale); + //QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); + qApp->installTranslator(&translator); +} + +void FvUpdater::showUpdaterWindowUpdatedWithCurrentUpdateProposal() +{ + // Destroy window if already exists + hideUpdaterWindow(); + + // Create a new window + m_updaterWindow = new FvUpdateWindow(); + m_updaterWindow->UpdateWindowWithCurrentProposedUpdate(); + m_updaterWindow->show(); +} + +void FvUpdater::hideUpdaterWindow() +{ + if (m_updaterWindow) { + if (! m_updaterWindow->close()) { + qWarning() << "Update window didn't close, leaking memory from now on"; + } + + // not deleting because of Qt::WA_DeleteOnClose + + m_updaterWindow = 0; + } +} + +void FvUpdater::updaterWindowWasClosed() +{ + // (Re-)nullify a pointer to a destroyed QWidget or you're going to have a bad time. + m_updaterWindow = 0; +} + + +void FvUpdater::showUpdateConfirmationDialogUpdatedWithCurrentUpdateProposal() +{ + // Destroy dialog if already exists + hideUpdateConfirmationDialog(); + + // Create a new window + m_updateConfirmationDialog = new FvUpdateConfirmDialog(); + m_updateConfirmationDialog->UpdateWindowWithCurrentProposedUpdate(); + m_updateConfirmationDialog->show(); +} + +void FvUpdater::hideUpdateConfirmationDialog() +{ + if (m_updateConfirmationDialog) { + if (! m_updateConfirmationDialog->close()) { + qWarning() << "Update confirmation dialog didn't close, leaking memory from now on"; + } + + // not deleting because of Qt::WA_DeleteOnClose + + m_updateConfirmationDialog = 0; + } +} + +void FvUpdater::updateConfirmationDialogWasClosed() +{ + // (Re-)nullify a pointer to a destroyed QWidget or you're going to have a bad time. + m_updateConfirmationDialog = 0; +} + + +void FvUpdater::SetFeedURL(QUrl feedURL) +{ + m_feedURL = feedURL; +} + +void FvUpdater::SetFeedURL(QString feedURL) +{ + SetFeedURL(QUrl(feedURL)); +} + +QString FvUpdater::GetFeedURL() +{ + return m_feedURL.toString(); +} + +FvAvailableUpdate* FvUpdater::GetProposedUpdate() +{ + return m_proposedUpdate; +} + + +void FvUpdater::InstallUpdate() +{ + qDebug() << "Install update"; + + showUpdateConfirmationDialogUpdatedWithCurrentUpdateProposal(); +} + +void FvUpdater::SkipUpdate() +{ + qDebug() << "Skip update"; + + FvAvailableUpdate* proposedUpdate = GetProposedUpdate(); + if (! proposedUpdate) { + qWarning() << "Proposed update is NULL (shouldn't be at this point)"; + return; + } + + // Start ignoring this particular version + FVIgnoredVersions::IgnoreVersion(proposedUpdate->GetEnclosureVersion()); + + hideUpdaterWindow(); + hideUpdateConfirmationDialog(); // if any; shouldn't be shown at this point, but who knows +} + +void FvUpdater::RemindMeLater() +{ + qDebug() << "Remind me later"; + + hideUpdaterWindow(); + hideUpdateConfirmationDialog(); // if any; shouldn't be shown at this point, but who knows +} + +void FvUpdater::UpdateInstallationConfirmed() +{ + qDebug() << "Confirm update installation"; + + FvAvailableUpdate* proposedUpdate = GetProposedUpdate(); + if (! proposedUpdate) { + qWarning() << "Proposed update is NULL (shouldn't be at this point)"; + return; + } + + // Open a link + if (! QDesktopServices::openUrl(proposedUpdate->GetEnclosureUrl())) { + showErrorDialog(tr("Unable to open this link in a browser. Please do it manually."), true); + return; + } + + hideUpdaterWindow(); + hideUpdateConfirmationDialog(); +} + +void FvUpdater::UpdateInstallationNotConfirmed() +{ + qDebug() << "Do not confirm update installation"; + + hideUpdateConfirmationDialog(); // if any; shouldn't be shown at this point, but who knows + // leave the "update proposal window" inact +} + + +bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet) +{ + if (m_feedURL.isEmpty()) { + qCritical() << "Please set feed URL via setFeedURL() before calling CheckForUpdates()."; + return false; + } + + m_silentAsMuchAsItCouldGet = silentAsMuchAsItCouldGet; + + // Check if application's organization name and domain are set, fail otherwise + // (nowhere to store QSettings to) + /* + if (QApplication::organizationName().isEmpty()) { + qCritical() << "QApplication::organizationName is not set. Please do that."; + return false; + } + if (QApplication::organizationDomain().isEmpty()) { + qCritical() << "QApplication::organizationDomain is not set. Please do that."; + return false; + } + */ + // Set application name / version is not set yet + if (QApplication::applicationName().isEmpty()) { + QString appName = QString::fromUtf8(FV_APP_NAME); + qWarning() << "QApplication::applicationName is not set, setting it to '" << appName << "'"; + QApplication::setApplicationName(appName); + } + if (QApplication::applicationVersion().isEmpty()) { + QString appVersion = QString::fromUtf8(FV_APP_VERSION); + qWarning() << "QApplication::applicationVersion is not set, setting it to '" << appVersion << "'"; + QApplication::setApplicationVersion(appVersion); + } + + cancelDownloadFeed(); + m_httpRequestAborted = false; + startDownloadFeed(m_feedURL); + + return true; +} + +bool FvUpdater::CheckForUpdatesSilent() +{ + return CheckForUpdates(true); +} + +bool FvUpdater::CheckForUpdatesNotSilent() +{ + return CheckForUpdates(false); +} + + +void FvUpdater::startDownloadFeed(QUrl url) +{ + m_xml.clear(); + + QNetworkRequest request; + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/xml"); + request.setHeader(QNetworkRequest::UserAgentHeader, QApplication::applicationName()); + request.setUrl(url); + + m_reply = m_qnam.get(request); + + connect(m_reply, SIGNAL(readyRead()), this, SLOT(httpFeedReadyRead())); + connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(httpFeedUpdateDataReadProgress(qint64, qint64))); + connect(m_reply, SIGNAL(finished()), this, SLOT(httpFeedDownloadFinished())); +} + +void FvUpdater::cancelDownloadFeed() +{ + if (m_reply) { + m_httpRequestAborted = true; + m_reply->abort(); + } +} + +void FvUpdater::httpFeedReadyRead() +{ + // this slot gets called every time the QNetworkReply has new data. + // We read all of its new data and write it into the file. + // That way we use less RAM than when reading it at the finished() + // signal of the QNetworkReply + m_xml.addData(m_reply->readAll()); +} + +void FvUpdater::httpFeedUpdateDataReadProgress(qint64 bytesRead, + qint64 totalBytes) +{ + Q_UNUSED(bytesRead); + Q_UNUSED(totalBytes); + + if (m_httpRequestAborted) { + return; + } +} + +void FvUpdater::httpFeedDownloadFinished() +{ + if (m_httpRequestAborted) { + m_reply->deleteLater(); + return; + } + + QVariant redirectionTarget = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (m_reply->error()) { + + // Error. + showErrorDialog(tr("Feed download failed: %1.").arg(m_reply->errorString()), false); + + } else if (! redirectionTarget.isNull()) { + QUrl newUrl = m_feedURL.resolved(redirectionTarget.toUrl()); + + m_feedURL = newUrl; + m_reply->deleteLater(); + + startDownloadFeed(m_feedURL); + return; + + } else { + + // Done. + xmlParseFeed(); + + } + + m_reply->deleteLater(); + m_reply = 0; +} + +bool FvUpdater::xmlParseFeed() +{ + QString currentTag, currentQualifiedTag; + + QString xmlTitle, xmlLink, xmlReleaseNotesLink, xmlPubDate, xmlEnclosureUrl, + xmlEnclosureVersion, xmlEnclosurePlatform, xmlEnclosureType; + unsigned long xmlEnclosureLength = 0; + + // Parse + while (! m_xml.atEnd()) { + + m_xml.readNext(); + + if (m_xml.isStartElement()) { + + currentTag = m_xml.name().toString(); + currentQualifiedTag = m_xml.qualifiedName().toString(); + + if (m_xml.name() == "item") { + + xmlTitle.clear(); + xmlLink.clear(); + xmlReleaseNotesLink.clear(); + xmlPubDate.clear(); + xmlEnclosureUrl.clear(); + xmlEnclosureVersion.clear(); + xmlEnclosurePlatform.clear(); + xmlEnclosureLength = 0; + xmlEnclosureType.clear(); + + } else if (m_xml.name() == "enclosure") { + + QXmlStreamAttributes attribs = m_xml.attributes(); + + if (attribs.hasAttribute("fervor:platform")) { + + if (FvPlatform::CurrentlyRunningOnPlatform(attribs.value("fervor:platform").toString().trimmed())) { + + xmlEnclosurePlatform = attribs.value("fervor:platform").toString().trimmed(); + + if (attribs.hasAttribute("url")) { + xmlEnclosureUrl = attribs.value("url").toString().trimmed(); + } else { + xmlEnclosureUrl = ""; + } + + // First check for Sparkle's version, then overwrite with Fervor's version (if any) + if (attribs.hasAttribute("sparkle:version")) { + QString candidateVersion = attribs.value("sparkle:version").toString().trimmed(); + if (! candidateVersion.isEmpty()) { + xmlEnclosureVersion = candidateVersion; + } + } + if (attribs.hasAttribute("fervor:version")) { + QString candidateVersion = attribs.value("fervor:version").toString().trimmed(); + if (! candidateVersion.isEmpty()) { + xmlEnclosureVersion = candidateVersion; + } + } + + if (attribs.hasAttribute("length")) { + xmlEnclosureLength = attribs.value("length").toString().toLong(); + } else { + xmlEnclosureLength = 0; + } + if (attribs.hasAttribute("type")) { + xmlEnclosureType = attribs.value("type").toString().trimmed(); + } else { + xmlEnclosureType = ""; + } + + } + + } + + } + + } else if (m_xml.isEndElement()) { + + if (m_xml.name() == "item") { + + // That's it - we have analyzed a single and we'll stop + // here (because the topmost is the most recent one, and thus + // the newest version. + + return searchDownloadedFeedForUpdates(xmlTitle, + xmlLink, + xmlReleaseNotesLink, + xmlPubDate, + xmlEnclosureUrl, + xmlEnclosureVersion, + xmlEnclosurePlatform, + xmlEnclosureLength, + xmlEnclosureType); + + } + + } else if (m_xml.isCharacters() && ! m_xml.isWhitespace()) { + + if (currentTag == "title") { + xmlTitle += m_xml.text().toString().trimmed(); + + } else if (currentTag == "link") { + xmlLink += m_xml.text().toString().trimmed(); + + } else if (currentQualifiedTag == "sparkle:releaseNotesLink") { + xmlReleaseNotesLink += m_xml.text().toString().trimmed(); + + } else if (currentTag == "pubDate") { + xmlPubDate += m_xml.text().toString().trimmed(); + + } + + } + + if (m_xml.error() && m_xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { + + showErrorDialog(tr("Feed parsing failed: %1 %2.").arg(QString::number(m_xml.lineNumber()), m_xml.errorString()), false); + return false; + + } + } + + // No updates were found if we're at this point + // (not a single element found) + showInformationDialog(tr("No updates were found."), false); + + return false; +} + + +bool FvUpdater::searchDownloadedFeedForUpdates(QString xmlTitle, + QString xmlLink, + QString xmlReleaseNotesLink, + QString xmlPubDate, + QString xmlEnclosureUrl, + QString xmlEnclosureVersion, + QString xmlEnclosurePlatform, + unsigned long xmlEnclosureLength, + QString xmlEnclosureType) +{ + qDebug() << "Title:" << xmlTitle; + qDebug() << "Link:" << xmlLink; + qDebug() << "Release notes link:" << xmlReleaseNotesLink; + qDebug() << "Pub. date:" << xmlPubDate; + qDebug() << "Enclosure URL:" << xmlEnclosureUrl; + qDebug() << "Enclosure version:" << xmlEnclosureVersion; + qDebug() << "Enclosure platform:" << xmlEnclosurePlatform; + qDebug() << "Enclosure length:" << xmlEnclosureLength; + qDebug() << "Enclosure type:" << xmlEnclosureType; + + // Validate + if (xmlReleaseNotesLink.isEmpty()) { + if (xmlLink.isEmpty()) { + showErrorDialog(tr("Feed error: \"release notes\" link is empty"), false); + return false; + } else { + xmlReleaseNotesLink = xmlLink; + } + } else { + xmlLink = xmlReleaseNotesLink; + } + if (! (xmlLink.startsWith("http://") || xmlLink.startsWith("https://"))) { + showErrorDialog(tr("Feed error: invalid \"release notes\" link"), false); + return false; + } + if (xmlEnclosureUrl.isEmpty() || xmlEnclosureVersion.isEmpty() || xmlEnclosurePlatform.isEmpty()) { + showErrorDialog(tr("Feed error: invalid \"enclosure\" with the download link"), false); + return false; + } + + // Relevant version? + if (FVIgnoredVersions::VersionIsIgnored(xmlEnclosureVersion)) { + qDebug() << "Version '" << xmlEnclosureVersion << "' is ignored, too old or something like that."; + + showInformationDialog(tr("No updates were found."), false); + + return true; // Things have succeeded when you think of it. + } + + + // + // Success! At this point, we have found an update that can be proposed + // to the user. + // + + if (m_proposedUpdate) { + delete m_proposedUpdate; m_proposedUpdate = 0; + } + m_proposedUpdate = new FvAvailableUpdate(); + m_proposedUpdate->SetTitle(xmlTitle); + m_proposedUpdate->SetReleaseNotesLink(xmlReleaseNotesLink); + m_proposedUpdate->SetPubDate(xmlPubDate); + m_proposedUpdate->SetEnclosureUrl(xmlEnclosureUrl); + m_proposedUpdate->SetEnclosureVersion(xmlEnclosureVersion); + m_proposedUpdate->SetEnclosurePlatform(xmlEnclosurePlatform); + m_proposedUpdate->SetEnclosureLength(xmlEnclosureLength); + m_proposedUpdate->SetEnclosureType(xmlEnclosureType); + + // Show "look, there's an update" window + showUpdaterWindowUpdatedWithCurrentUpdateProposal(); + + return true; +} + + +void FvUpdater::showErrorDialog(QString message, bool showEvenInSilentMode) +{ + if (m_silentAsMuchAsItCouldGet) { + if (! showEvenInSilentMode) { + // Don't show errors in the silent mode + return; + } + } + + QMessageBox dlFailedMsgBox; + dlFailedMsgBox.setIcon(QMessageBox::Critical); + dlFailedMsgBox.setText(tr("Error")); + dlFailedMsgBox.setInformativeText(message); + dlFailedMsgBox.exec(); +} + +void FvUpdater::showInformationDialog(QString message, bool showEvenInSilentMode) +{ + if (m_silentAsMuchAsItCouldGet) { + if (! showEvenInSilentMode) { + // Don't show information dialogs in the silent mode + return; + } + } + + QMessageBox dlInformationMsgBox; + dlInformationMsgBox.setIcon(QMessageBox::Information); + dlInformationMsgBox.setText(tr("Information")); + dlInformationMsgBox.setInformativeText(message); + dlInformationMsgBox.exec(); +} diff --git a/client/fervor/fvupdater.h b/client/fervor/fvupdater.h new file mode 100644 index 0000000..04b69fa --- /dev/null +++ b/client/fervor/fvupdater.h @@ -0,0 +1,150 @@ +#ifndef FVUPDATER_H +#define FVUPDATER_H + +#include +#include +#include +#include +#include +class FvUpdateWindow; +class FvUpdateConfirmDialog; +class FvAvailableUpdate; + + +class FvUpdater : public QObject +{ + Q_OBJECT + +public: + + // Singleton + static FvUpdater* sharedUpdater(); + static void drop(); + + // Set / get feed URL + void SetFeedURL(QUrl feedURL); + void SetFeedURL(QString feedURL); + QString GetFeedURL(); + +public slots: + + // Check for updates + bool CheckForUpdates(bool silentAsMuchAsItCouldGet = true); + + // Aliases + bool CheckForUpdatesSilent(); + bool CheckForUpdatesNotSilent(); + + + // + // --------------------------------------------------- + // --------------------------------------------------- + // --------------------------------------------------- + // --------------------------------------------------- + // + +protected: + + friend class FvUpdateWindow; // Uses GetProposedUpdate() and others + friend class FvUpdateConfirmDialog; // Uses GetProposedUpdate() and others + FvAvailableUpdate* GetProposedUpdate(); + + +protected slots: + + // Update window button slots + void InstallUpdate(); + void SkipUpdate(); + void RemindMeLater(); + + // Update confirmation dialog button slots + void UpdateInstallationConfirmed(); + void UpdateInstallationNotConfirmed(); + +private: + + // + // Singleton business + // + // (we leave just the declarations, so the compiler will warn us if we try + // to use those two functions by accident) + FvUpdater(); // Hide main constructor + ~FvUpdater(); // Hide main destructor + FvUpdater(const FvUpdater&); // Hide copy constructor + FvUpdater& operator=(const FvUpdater&); // Hide assign op + + static FvUpdater* m_Instance; // Singleton instance + + + // + // Windows / dialogs + // + FvUpdateWindow* m_updaterWindow; // Updater window (NULL if not shown) + void showUpdaterWindowUpdatedWithCurrentUpdateProposal(); // Show updater window + void hideUpdaterWindow(); // Hide + destroy m_updaterWindow + void updaterWindowWasClosed(); // Sent by the updater window when it gets closed + + FvUpdateConfirmDialog* m_updateConfirmationDialog; // Update confirmation dialog (NULL if not shown) + void showUpdateConfirmationDialogUpdatedWithCurrentUpdateProposal(); // Show update confirmation dialog + void hideUpdateConfirmationDialog(); // Hide + destroy m_updateConfirmationDialog + void updateConfirmationDialogWasClosed(); // Sent by the update confirmation dialog when it gets closed + + // Available update (NULL if not fetched) + FvAvailableUpdate* m_proposedUpdate; + + // If true, don't show the error dialogs and the "no updates." dialog + // (silentAsMuchAsItCouldGet from CheckForUpdates() goes here) + // Useful for automatic update checking upon application startup. + bool m_silentAsMuchAsItCouldGet; + + // Dialogs (notifications) + void showErrorDialog(QString message, bool showEvenInSilentMode = false); // Show an error message + void showInformationDialog(QString message, bool showEvenInSilentMode = false); // Show an informational message + + + // + // HTTP feed fetcher infrastructure + // + QUrl m_feedURL; // Feed URL that will be fetched + QNetworkAccessManager m_qnam; + QNetworkReply* m_reply; + int m_httpGetId; + bool m_httpRequestAborted; + + void startDownloadFeed(QUrl url); // Start downloading feed + void cancelDownloadFeed(); // Stop downloading the current feed + +private slots: + + void httpFeedReadyRead(); + void httpFeedUpdateDataReadProgress(qint64 bytesRead, + qint64 totalBytes); + void httpFeedDownloadFinished(); + + +private: + + // + // XML parser + // + QXmlStreamReader m_xml; // XML data collector and parser + bool xmlParseFeed(); // Parse feed in m_xml + bool searchDownloadedFeedForUpdates(QString xmlTitle, + QString xmlLink, + QString xmlReleaseNotesLink, + QString xmlPubDate, + QString xmlEnclosureUrl, + QString xmlEnclosureVersion, + QString xmlEnclosurePlatform, + unsigned long xmlEnclosureLength, + QString xmlEnclosureType); + + + // + // Helpers + // + void installTranslator(); // Initialize translation mechanism + +}; + +#endif // FVUPDATER_H diff --git a/client/fervor/fvupdatewindow.cpp b/client/fervor/fvupdatewindow.cpp new file mode 100644 index 0000000..5e2f6c1 --- /dev/null +++ b/client/fervor/fvupdatewindow.cpp @@ -0,0 +1,73 @@ +#include "fvupdatewindow.h" +#include "ui_fvupdatewindow.h" +#include "fvupdater.h" +#include "fvavailableupdate.h" +#include +#include +#include +#include +#include + +FvUpdateWindow::FvUpdateWindow(QWidget *parent) : + QWidget(parent), + m_ui(new Ui::FvUpdateWindow), m_NetworkReply(nullptr) +{ + m_ui->setupUi(this); + + // Delete on close + setAttribute(Qt::WA_DeleteOnClose, true); + + // Set the "new version is available" string + QString newVersString = m_ui->newVersionIsAvailableLabel->text().arg(QString::fromUtf8(FV_APP_NAME)); + m_ui->newVersionIsAvailableLabel->setText(newVersString); + + // Connect buttons + connect(m_ui->installUpdateButton, SIGNAL(clicked()), + FvUpdater::sharedUpdater(), SLOT(InstallUpdate())); + connect(m_ui->skipThisVersionButton, SIGNAL(clicked()), + FvUpdater::sharedUpdater(), SLOT(SkipUpdate())); + connect(m_ui->remindMeLaterButton, SIGNAL(clicked()), + FvUpdater::sharedUpdater(), SLOT(RemindMeLater())); + + connect(&m_Network, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinished(QNetworkReply*))); +} + +FvUpdateWindow::~FvUpdateWindow() +{ + delete m_ui; +} + +bool FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate() +{ + FvAvailableUpdate* proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate(); + if (! proposedUpdate) { + return false; + } + + QString downloadString = m_ui->wouldYouLikeToDownloadLabel->text() + .arg(QString::fromUtf8(FV_APP_NAME), proposedUpdate->GetEnclosureVersion(), QString::fromUtf8(FV_APP_VERSION)); + m_ui->wouldYouLikeToDownloadLabel->setText(downloadString); + + QUrl notesUrl = proposedUpdate->GetReleaseNotesLink(); + m_NetworkReply = m_Network.get(QNetworkRequest(notesUrl)); + + return true; +} + +void FvUpdateWindow::closeEvent(QCloseEvent* event) +{ + FvUpdater::sharedUpdater()->updaterWindowWasClosed(); + if (m_NetworkReply) + m_NetworkReply->abort(); + + event->accept(); +} + +void FvUpdateWindow::downloadFinished(QNetworkReply *reply) +{ + if (reply->error() == QNetworkReply::NoError) + m_ui->releaseNotes->setText(QString(reply->readAll())); + + reply->deleteLater(); + m_NetworkReply = nullptr; +} diff --git a/client/fervor/fvupdatewindow.h b/client/fervor/fvupdatewindow.h new file mode 100644 index 0000000..f4e8612 --- /dev/null +++ b/client/fervor/fvupdatewindow.h @@ -0,0 +1,35 @@ +#ifndef FVUPDATEWINDOW_H +#define FVUPDATEWINDOW_H + +#include +#include + +class QGraphicsScene; + +namespace Ui { +class FvUpdateWindow; +} + +class FvUpdateWindow : public QWidget +{ + Q_OBJECT + +public: + explicit FvUpdateWindow(QWidget *parent = 0); + ~FvUpdateWindow(); + + // Update the current update proposal from FvUpdater + bool UpdateWindowWithCurrentProposedUpdate(); + + void closeEvent(QCloseEvent* event); + +private: + Ui::FvUpdateWindow* m_ui; + QNetworkAccessManager m_Network; + QNetworkReply* m_NetworkReply; + +public slots: + void downloadFinished(QNetworkReply* reply); +}; + +#endif // FVUPDATEWINDOW_H diff --git a/client/fervor/fvupdatewindow.ui b/client/fervor/fvupdatewindow.ui new file mode 100644 index 0000000..787a633 --- /dev/null +++ b/client/fervor/fvupdatewindow.ui @@ -0,0 +1,107 @@ + + + FvUpdateWindow + + + + 0 + 0 + 640 + 480 + + + + Software Update + + + + + + + + + 75 + true + + + + A new version of %1 is available! + + + + + + + %1 %2 is now available - you have %3. Would you like to download it now? + + + + + + + + 75 + true + + + + Release Notes: + + + + + + + + + + + + + + Skip This Version + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Remind Me Later + + + + + + + Install Update + + + true + + + true + + + + + + + + + + + + diff --git a/client/fervor/fvversioncomparator.cpp b/client/fervor/fvversioncomparator.cpp new file mode 100644 index 0000000..a44c600 --- /dev/null +++ b/client/fervor/fvversioncomparator.cpp @@ -0,0 +1,165 @@ +#include "fvversioncomparator.h" +#include +#include +#include +#include // for atoi() + +// +// Clone of Sparkle's SUStandardVersionComparator.m, so here's original author's +// copyright too: +// +// Copyright 2007 Andy Matuschak. All rights reserved. +// +// Everything's the same except for TypeOfCharacter() +// (because who knows how Foundation does isdigit() and such.) +// + + +FvVersionComparator::FvVersionComparator() +{ + // noop +} + +FvVersionComparator::CharacterType FvVersionComparator::TypeOfCharacter(std::string character) +{ + if (character == ".") { + return kSeparatorType; + } else if (isdigit(character[0])) { + return kNumberType; + } else if (isspace(character[0])) { + return kSeparatorType; + } else if (ispunct(character[0])) { + return kSeparatorType; + } else { + return kStringType; + } + +} + +std::vector FvVersionComparator::SplitVersionString(std::string version) +{ + std::string character; + std::string s; + unsigned long i = 0, n = 0; + CharacterType oldType, newType; + std::vector parts; + + if (version.length() == 0) { + // Nothing to do here + return parts; + } + + s = version.substr(0, 1); + oldType = TypeOfCharacter(s); + n = version.length() - 1; + for (i = 1; i <= n; ++i) { + character = version.substr(i, 1)[0]; + newType = TypeOfCharacter(character); + if (oldType != newType || oldType == kSeparatorType) { + // We've reached a new segment + std::string aPart = s; + parts.push_back(aPart); + s = character; + } else { + // Add character to string and continue + s.append(character); + } + oldType = newType; + } + + // Add the last part onto the array + parts.push_back(s); + return parts; +} + + +FvVersionComparator::ComparatorResult FvVersionComparator::CompareVersions(std::string versionA, + std::string versionB) +{ + std::vector partsA = SplitVersionString(versionA); + std::vector partsB = SplitVersionString(versionB); + + std::string partA = std::string(""), partB = std::string(""); + unsigned long i = 0, n = 0; + int intA, intB; + CharacterType typeA, typeB; + + n = std::min(partsA.size(), partsB.size()); + for (i = 0; i < n; ++i) { + partA = partsA.at(i); + partB = partsB.at(i); + + typeA = TypeOfCharacter(partA); + typeB = TypeOfCharacter(partB); + + // Compare types + if (typeA == typeB) { + // Same type; we can compare + if (typeA == kNumberType) { + intA = atoi(partA.c_str()); + intB = atoi(partB.c_str()); + + if (intA > intB) { + return kDescending; + } else if (intA < intB) { + return kAscending; + } + } else if (typeA == kStringType) { + short result = partA.compare(partB); + switch (result) { + case -1: return kAscending; break; + case 1: return kDescending; break; + case 0: /* do nothing */ break; + }; + } + } else { + // Not the same type? Now we have to do some validity checking + if (typeA != kStringType && typeB == kStringType) { + // typeA wins + return kDescending; + } else if (typeA == kStringType && typeB != kStringType) { + // typeB wins + return kAscending; + } else { + // One is a number and the other is a period. The period is invalid + if (typeA == kNumberType) { + return kDescending; + } else { + return kAscending; + } + } + } + } + // The versions are equal up to the point where they both still have parts + // Lets check to see if one is larger than the other + if (partsA.size() != partsB.size()) { + // Yep. Lets get the next part of the larger + // n holds the index of the part we want. + std::string missingPart = std::string(""); + CharacterType missingType; + ComparatorResult shorterResult, largerResult; + + if (partsA.size() > partsB.size()) { + missingPart = partsA.at(n); + shorterResult = kAscending; + largerResult = kDescending; + } else { + missingPart = partsB.at(n); + shorterResult = kDescending; + largerResult = kAscending; + } + + missingType = TypeOfCharacter(missingPart); + // Check the type + if (missingType == kStringType) { + // It's a string. Shorter version wins + return shorterResult; + } else { + // It's a number/period. Larger version wins + return largerResult; + } + } + + // The 2 strings are identical + return kSame; +} diff --git a/client/fervor/fvversioncomparator.h b/client/fervor/fvversioncomparator.h new file mode 100644 index 0000000..f083fdf --- /dev/null +++ b/client/fervor/fvversioncomparator.h @@ -0,0 +1,36 @@ +#ifndef FVVERSIONCOMPARATOR_H +#define FVVERSIONCOMPARATOR_H + +#include +#include + + +class FvVersionComparator +{ +public: + + typedef enum { + kSame = 0, + kDescending = 1, + kAscending = -1 + } ComparatorResult; + + static ComparatorResult CompareVersions(std::string versionA, + std::string versionB); + +private: + + FvVersionComparator(); + + typedef enum { + kNumberType, + kStringType, + kSeparatorType + } CharacterType; + + static CharacterType TypeOfCharacter(std::string character); + static std::vector SplitVersionString(std::string version); + +}; + +#endif // FVVERSIONCOMPARATOR_H diff --git a/client/fervor/tests/CMakeLists.txt b/client/fervor/tests/CMakeLists.txt new file mode 100644 index 0000000..8d5c6a1 --- /dev/null +++ b/client/fervor/tests/CMakeLists.txt @@ -0,0 +1,13 @@ +qt4_wrap_cpp(TEST_MOC_SOURCES fvversioncomparatortest.h) + +add_executable(FervorTests + fvversioncomparatortest.cpp ${TEST_MOC_SOURCES} +) + +target_link_libraries( FervorTests + ${QT_LIBRARIES} + ${QT_QTTEST_LIBRARY} + Fervor +) + +add_test(FervorTests ${CMAKE_CURRENT_BINARY_DIR}/FervorTests) \ No newline at end of file diff --git a/client/fervor/tests/fvversioncomparatortest.cpp b/client/fervor/tests/fvversioncomparatortest.cpp new file mode 100644 index 0000000..349dfd0 --- /dev/null +++ b/client/fervor/tests/fvversioncomparatortest.cpp @@ -0,0 +1,47 @@ +#include "fvversioncomparatortest.h" +#include "fvversioncomparator.h" + +void FvVersionComparatorTest::testNumbers() +{ + QVERIFY(FvVersionComparator::CompareVersions("1.0", "1.1") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0", "1.0") == FvVersionComparator::kSame); + QVERIFY(FvVersionComparator::CompareVersions("2.0", "1.1") == FvVersionComparator::kDescending); + QVERIFY(FvVersionComparator::CompareVersions("0.1", "0.0.1") == FvVersionComparator::kDescending); + QVERIFY(FvVersionComparator::CompareVersions("0.1", "0.1.2") == FvVersionComparator::kAscending); + + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "1.0.0") == FvVersionComparator::kSame); + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "1.0.1") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "1.1.0") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "2.0.0") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "0.0.1") == FvVersionComparator::kDescending); + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "0.1.0") == FvVersionComparator::kDescending); + QVERIFY(FvVersionComparator::CompareVersions("1.0.0", "0.9.9") == FvVersionComparator::kDescending); + QVERIFY(FvVersionComparator::CompareVersions("0.0.1", "0.0.2") == FvVersionComparator::kAscending); +} + +void FvVersionComparatorTest::testPrereleases() +{ + QVERIFY(FvVersionComparator::CompareVersions("1.0a1", "1.0b1") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b1", "1.0") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("0.9", "1.0a1") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b", "1.0b2") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b10", "1.0b11") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b9", "1.0b10") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0rc", "1.0") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b", "1.0") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0pre1", "1.0") == FvVersionComparator::kAscending); + + QVERIFY(FvVersionComparator::CompareVersions("1.0", "1.0pre1") == FvVersionComparator::kDescending); +} + +void FvVersionComparatorTest::testVersionsWithBuildNumbers() +{ + QVERIFY(FvVersionComparator::CompareVersions("1.0 (1234)", "1.0 (1235)") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b1 (1234)", "1.0 (1234)") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b5 (1234)", "1.0b5 (1235)") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0b5 (1234)", "1.0.1b5 (1234)") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("1.0.1b5 (1234)", "1.0.1b6 (1234)") == FvVersionComparator::kAscending); + QVERIFY(FvVersionComparator::CompareVersions("3.3 (5847)", "3.3.1b1 (5902)") == FvVersionComparator::kAscending); +} + +QTEST_MAIN(FvVersionComparatorTest) \ No newline at end of file diff --git a/client/fervor/tests/fvversioncomparatortest.h b/client/fervor/tests/fvversioncomparatortest.h new file mode 100644 index 0000000..1544ab1 --- /dev/null +++ b/client/fervor/tests/fvversioncomparatortest.h @@ -0,0 +1,18 @@ +#ifndef FVVERSIONCOMPARATORTEST_H +#define FVVERSIONCOMPARATORTEST_H + +#include + + +class FvVersionComparatorTest : public QObject +{ + Q_OBJECT + +private slots: + void testNumbers(); + void testPrereleases(); + void testVersionsWithBuildNumbers(); + +}; + +#endif // FVVERSIONCOMPARATORTEST_H diff --git a/client/finddialog.cpp b/client/finddialog.cpp new file mode 100644 index 0000000..547e29c --- /dev/null +++ b/client/finddialog.cpp @@ -0,0 +1,88 @@ +#include "finddialog.h" +#include "ui_finddialog.h" + +FindInTasksDialog::FindInTasksDialog(QWidget *parent) : + QDialog(parent, Qt::Sheet), + ui(new Ui::FindDialog) +{ + int typeId = qRegisterMetaType("FindResultItem"); + ui->setupUi(this); + mModel = new FindResultsModel(this); + ui->mResultList->setModel(mModel); + mSearchHelper.moveToThread(&mSearchHelper); + + connect(ui->mSearchButton, SIGNAL(clicked()), this, SLOT(startSearch())); + connect(ui->mQueryText, SIGNAL(returnPressed()), this, SLOT(startSearch())); + connect(&mSearchHelper, SIGNAL(newResultAvailable(FindResultItem)), this, SLOT(onNewResult(FindResultItem))); + connect(&mSearchHelper, SIGNAL(searchComplete()), this, SLOT(searchComplete())); + connect(ui->mResultList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(resultSelected(QModelIndex))); + connect(ui->mResultList, SIGNAL(activated(QModelIndex)), this, SLOT(resultSelected(QModelIndex))); +} + +FindInTasksDialog::~FindInTasksDialog() +{ + delete ui; +} + +FindResultItem& FindInTasksDialog::getResult() +{ + return mResult; +} + +void FindInTasksDialog::startSearch() +{ + if (ui->mSearchButton->text() == tr("Stop")) + { + // Stop possible previous search + mSearchHelper.stop(); + + // Enable query edit again + ui->mQueryText->setEnabled(true); + } + else + { + if (ui->mQueryText->text().isEmpty()) + return; + + // Stop possible previous search + mSearchHelper.stop(); + + // Clear from old results + mModel->clear(); + + ui->mSearchButton->setText(tr("Stop")); + ui->mQueryText->setEnabled(false); + // Start new search + mSearchHelper.start(ui->mQueryText->text()); + } +} + +void FindInTasksDialog::resultSelected(const QModelIndex& index) +{ + if (!index.isValid()) + return; + + mResult = mModel->getItem(index.row()); + accept(); + close(); +} + +void FindInTasksDialog::onNewResult(const FindResultItem &item) +{ + // Add new item to list + mModel->addItem(item); + + // Move focus to list + ui->mResultList->setFocus(); + if (mModel->rowCount() == 1) + { + ui->mResultList->selectRow(0); + } +} + +void FindInTasksDialog::searchComplete() +{ + // Sort found results by occurence count + ui->mSearchButton->setText(tr("Search")); + ui->mQueryText->setEnabled(true); +} diff --git a/client/finddialog.h b/client/finddialog.h new file mode 100644 index 0000000..3745f36 --- /dev/null +++ b/client/finddialog.h @@ -0,0 +1,33 @@ +#ifndef FINDDIALOG_H +#define FINDDIALOG_H + +#include +#include "findsupport.h" + +namespace Ui { +class FindDialog; +} + +class FindInTasksDialog : public QDialog +{ + Q_OBJECT + +public: + explicit FindInTasksDialog(QWidget *parent = 0); + ~FindInTasksDialog(); + + FindResultItem& getResult(); + +public slots: + void startSearch(); + void resultSelected(const QModelIndex& index); + void searchComplete(); + void onNewResult(const FindResultItem& item); +private: + Ui::FindDialog *ui; + FindResultsModel* mModel; + TaskSearch mSearchHelper; + FindResultItem mResult; +}; + +#endif // FINDDIALOG_H diff --git a/client/finddialog.ui b/client/finddialog.ui new file mode 100644 index 0000000..d8ee776 --- /dev/null +++ b/client/finddialog.ui @@ -0,0 +1,64 @@ + + + FindDialog + + + + 0 + 0 + 611 + 392 + + + + Dialog + + + + + + + + Text to search: + + + + + + + + + + Search + + + false + + + false + + + + + + + + + QAbstractItemView::SelectRows + + + false + + + 293 + + + false + + + + + + + + diff --git a/client/findsupport.cpp b/client/findsupport.cpp new file mode 100644 index 0000000..ddfa79d --- /dev/null +++ b/client/findsupport.cpp @@ -0,0 +1,187 @@ +#include "findsupport.h" +#include "task.h" +#include "storage.h" + +FindResultsModel::FindResultsModel(QObject* parent) + :QAbstractTableModel(parent) +{ +} + +int FindResultsModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) + return 0; + return 2; +} + +int FindResultsModel::rowCount(const QModelIndex &parent) const +{ + return mItemList.count(); +} + +QVariant FindResultsModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + FindResultItem item = mItemList[index.row()]; + switch (role) + { + case Qt::DisplayRole: + return index.column() == 0 ? item.mTask->title() : "..." + item.mPattern + "..."; + } + return QVariant(); +} + +Qt::ItemFlags FindResultsModel::flags(const QModelIndex &index) const +{ + Qt::ItemFlags result = Qt::ItemIsEnabled | Qt::ItemIsSelectable; + return result; +} + +QVariant FindResultsModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) + { + switch (section) + { + case 0: return tr("Task title"); + case 1: return tr("Occurence"); + } + } + return QVariant(); +} + +void FindResultsModel::addItem(const FindResultItem& item) +{ + beginInsertRows(QModelIndex(), rowCount(), rowCount()); + mItemList.append(item); + endInsertRows(); +} + +void FindResultsModel::clear() +{ + beginRemoveRows(QModelIndex(), 0, rowCount()-1); + mItemList.clear(); + endRemoveRows(); +} + +const FindResultItem& FindResultsModel::getItem(int row) const +{ + return mItemList.at(row); +} +// ------ TaskSearch ------- +TaskSearch::TaskSearch() + :mShutdown(false) +{ + +} + +TaskSearch::~TaskSearch() +{ + //stop(); +} + +void TaskSearch::start(const QString &request) +{ + mShutdown = false; + mRequest = request; + QThread::start(); +} + +void TaskSearch::stop() +{ + mShutdown = true; + QThread::wait(); + mRequest.clear(); +} + +bool TaskSearch::isRunning() +{ + return false; +} + +static int findInString(const QStringList& pattern, const QString& doc, int& firstIndex, QString& occurenceSubstring, QString& foundWord) +{ + int result = 0; + firstIndex = -1; + for (const QString& s: pattern) + { + int wordIndex = doc.indexOf(s); + if (wordIndex >= 0) + { + if (firstIndex == -1) + { + firstIndex = wordIndex; + + // Copy pattern + int startIndex = firstIndex - 15; + if (startIndex < 0) + startIndex = 0; + int endIndex = firstIndex + 15; + if (endIndex >= doc.length()) + endIndex = doc.length() - 1; + occurenceSubstring = doc.mid(startIndex, endIndex - startIndex + 1); + occurenceSubstring.replace("\n", " ").replace("\r", ""); + foundWord = s; + } + result++; + } + } + return result; +} + +void TaskSearch::run() +{ + // Reserve array with initial length to make copy + TaskArray tasks(Storage::instance().topOfTaskTree().count()); + + // Copy top level tasks + std::copy(Storage::instance().topOfTaskTree().begin(), Storage::instance().topOfTaskTree().end(), tasks.begin()); + + QStringList sl; + if (mRequest.startsWith("\"") && mRequest.endsWith("\"")) + sl.append(mRequest); + else + sl = mRequest.split(" ", QString::SkipEmptyParts); + + if (!sl.empty()) + { + while (tasks.count() > 0 && !mShutdown) + { + PTask current = tasks.front(); + tasks.erase(tasks.begin()); + + // Add children to tasks list + for (PTask child: current->children()) + tasks.push_back(child); + + // Search in title + FindResultItem titleSearchItem; + titleSearchItem.mIndex = -1; + titleSearchItem.mOccurences = findInString(sl, current->title(), titleSearchItem.mIndex, titleSearchItem.mPattern, titleSearchItem.mFoundWord); + + // Get content from task + bool loadedThisTime = false; + if (!current->isContentLoaded()) + current->loadContent(); + QString content = current->html(); + + // Search in content + FindResultItem contentSearchItem; + contentSearchItem.mIndex = -1; + contentSearchItem.mOccurences = findInString(sl, content, contentSearchItem.mIndex, contentSearchItem.mPattern, contentSearchItem.mFoundWord); + contentSearchItem.mTask = current; + + if (contentSearchItem.mOccurences + titleSearchItem.mOccurences >= sl.count()) + { + emit newResultAvailable(contentSearchItem); + } + // Unload content if it is not needed now + if (loadedThisTime) + current->unloadContent(); + + } + } + emit searchComplete(); +} diff --git a/client/findsupport.h b/client/findsupport.h new file mode 100644 index 0000000..6099983 --- /dev/null +++ b/client/findsupport.h @@ -0,0 +1,74 @@ +#ifndef FINDSUPPORT_H +#define FINDSUPPORT_H + +#include +#include +#include +#include "task.h" + +struct FindResultItem +{ + // Visible search result in list + QString mPattern; + + // Found word + QString mFoundWord; + + // Index of first found word in document + int mIndex; + + // Number of discovered words from requested list. It is in range [0..length_of_query_list] + int mOccurences; + + // Task + PTask mTask; +}; + +Q_DECLARE_METATYPE(FindResultItem) + +class FindResultsModel: public QAbstractTableModel +{ + Q_OBJECT + friend class TaskSearch; +public: + explicit FindResultsModel(QObject* parent = 0); + int columnCount(const QModelIndex &parent) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; + + void clear(); + const FindResultItem& getItem(int row) const; +public slots: + void addItem(const FindResultItem& item); + +protected: + QVector mItemList; + +}; + +class TaskSearch: public QThread +{ + Q_OBJECT + +public: + TaskSearch(); + ~TaskSearch(); + + void start(const QString& request); + void stop(); + bool isRunning(); + void run(); + +signals: + void newResultAvailable(const FindResultItem& item); + void searchComplete(); + +protected: + QString mRequest; + bool mShutdown; +}; + +#endif // FINDSUPPORT_H + diff --git a/client/helper.cpp b/client/helper.cpp new file mode 100644 index 0000000..89c2859 --- /dev/null +++ b/client/helper.cpp @@ -0,0 +1,135 @@ +#include "config.h" +#include "helper.h" +#include "platforms/hidtracker.h" + +#include +#include +#include +#include + +#ifdef TARGET_OSX + +char* __strlcpy_chk (char* dest, const char* src, int len, int destcapacity) +{ + return NULL; +} + +char* __strlcat_chk (char* dest, const char* src, int len, int destcapacity) +{ + return NULL; +} + +#endif + +QString TimeHelper::secondsToDisplay(int seconds, bool showSeconds) +{ + int hours = seconds / 3600; + int minutes = (seconds % 3600) / 60; + int secs = seconds % 60; + if (showSeconds) + return QString("%1:%2:%3").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(secs, 2, 10, QLatin1Char('0')); + else + return QString("%1:%2").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')); +} + +QString PathHelper::pathToSettings() +{ +#if QT_VERSION >= 0x050000 + QString folder = QStandardPaths::writableLocation(QStandardPaths::DataLocation); +#else + QString folder = QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#endif + QString path = folder + "/" + SETTINGS_FILENAME; + return path; +} + +QString PathHelper::pathToDatabase() +{ +#if QT_VERSION >= 0x050000 + QString folder = QStandardPaths::writableLocation(QStandardPaths::DataLocation); +#else + QString folder = QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#endif + QString path = folder + "/" + DATABASENAME; + return path; +} + +QString PathHelper::pathToDesktop() +{ +#if QT_VERSION >= 0x050000 + QString folder = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); +#else + QString folder = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation); +#endif + return folder; +} + +QString PathHelper::pathToDatabaseTemplate() +{ +#ifdef TARGET_WIN + return QCoreApplication::applicationDirPath() + "/" + DATABASENAME; +#endif + +#ifdef TARGET_OSX + return QCoreApplication::applicationDirPath() + "/../Resources/" + DATABASENAME; +#endif +} + +QString PathHelper::pathToLog() +{ +#if QT_VERSION >= 0x050000 + QString folder = QStandardPaths::writableLocation(QStandardPaths::DataLocation); +#else + QString folder = QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#endif + return folder + "/" + LOGNAME; +} + +bool ActivityTrackerHelper::ensureSmartTrackingIsPossible() +{ + bool result = false; + HIDActivityTracker tracker; + + result = tracker.isPossible(); +#ifdef TARGET_OSX + if (!result && QSysInfo::MacintoshVersion <= QSysInfo::MV_10_8) + { + QMessageBox msgbox(QMessageBox::Question, QT_TR_NOOP("Permission required"), + QT_TR_NOOP("To use smart time tracking Litt needs access to OS X accessibility features.\ + Please grant access in Security & Privacy preferences, location in System Preferences."), + QMessageBox::NoButton, nullptr); + msgbox.addButton(QT_TR_NOOP("Open System Preferences"), QMessageBox::AcceptRole); + msgbox.addButton(QT_TR_NOOP("Deny"), QMessageBox::RejectRole); + int execResult = msgbox.exec(); + if (execResult == 0) + { + system("open /System/Library/PreferencePanes/UniversalAccessPref.prefPane"); + result = true; + } + } + else + if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) + result = true; +#endif +#ifdef TARGET_WIN + result = false; +#endif + return result; +} + +EscapeKeyEventFilter::EscapeKeyEventFilter(QObject *parent) + :QObject(parent) +{} + +bool EscapeKeyEventFilter::eventFilter(QObject *obj, QEvent * event) +{ + if (event->type() == QEvent::KeyPress && ((QKeyEvent*)event)->key() == Qt::Key_Escape ) + { + emit escapePressed(obj); + } + if (event->type() == QEvent::FocusOut) + { + emit escapePressed(obj); + } + return false; +} diff --git a/client/helper.h b/client/helper.h new file mode 100644 index 0000000..63a84c2 --- /dev/null +++ b/client/helper.h @@ -0,0 +1,42 @@ +#ifndef HELPER_H +#define HELPER_H + +#include +#include + +class TimeHelper +{ +public: + static QString secondsToDisplay(int seconds, bool showSeconds); +}; + +class PathHelper +{ +public: + static QString pathToDatabase(); + static QString pathToDesktop(); + static QString pathToSettings(); + static QString pathToDatabaseTemplate(); + static QString pathToLog(); +}; + +class ActivityTrackerHelper +{ +public: + static bool ensureSmartTrackingIsPossible(); +}; + +class EscapeKeyEventFilter: public QObject +{ + Q_OBJECT + +public: + explicit EscapeKeyEventFilter(QObject* parent = 0); + bool eventFilter(QObject *obj, QEvent * event); + +signals: + void escapePressed(QObject* obj); + +}; + +#endif diff --git a/client/icons/App_icon_files.zip b/client/icons/App_icon_files.zip new file mode 100644 index 0000000..dad8ad5 Binary files /dev/null and b/client/icons/App_icon_files.zip differ diff --git a/client/icons/StopIcon.dbdoc b/client/icons/StopIcon.dbdoc new file mode 100644 index 0000000..534c91e --- /dev/null +++ b/client/icons/StopIcon.dbdoc @@ -0,0 +1,81 @@ + + + + + Canvas Background Color + + YnBsaXN0MDDUAQIDBAUIFxhUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABowkKEVUkbnVsbNMLDA0ODxBcTlNDb2xvclNwYWNlViRjbGFzc1dOU1do + aXRlEAOAAk0wLjY2NjY2NjY4NjUA0hITFBVYJGNsYXNzZXNaJGNsYXNzbmFtZaIVFldO + U0NvbG9yWE5TT2JqZWN0EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIIERYfKDI1OjxARk1a + YWlrbXuAiZSXn6itAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAL8= + + Canvas Color + + YnBsaXN0MDDUAQIDBAUIFxhUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABowkKEVUkbnVsbNMLDA0ODxBcTlNDb2xvclNwYWNlViRjbGFzc1dOU1do + aXRlEAOAAkIxANISExQVWCRjbGFzc2VzWiRjbGFzc25hbWWiFRZXTlNDb2xvclhOU09i + amVjdBIAAYagXxAPTlNLZXllZEFyY2hpdmVyCBEWHygyNTo8QEZNWmFpa21wdX6JjJSd + ogAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC0 + + Canvas Height + 128 + Canvas Width + 128 + Grid Color + + YnBsaXN0MDDUAQIDBAUIFxhUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABowkKEVUkbnVsbNMLDA0ODxBcTlNDb2xvclNwYWNlViRjbGFzc1dOU1do + aXRlEAOAAkQwLjUA0hITFBVYJGNsYXNzZXNaJGNsYXNzbmFtZaIVFldOU0NvbG9yWE5T + T2JqZWN0EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIIERYfKDI1OjxARk1aYWlrbXJ3gIuO + lp+kAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= + + Grid Spacing + 72 + Grid Tick Count + 5 + Layers and shapes + + YnBsaXN0MDDUAQIDBAUIp6hUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABrxAaCQoQIiMnNzpBZGptcHSAg4iXVhqam5ydoqNVJG51bGzSCwwNDlYk + Y2xhc3NaTlMub2JqZWN0c4AHoQ+AAtkREhMUFQsWFxgZGhsaHR4fICFVQWxwaGFXVmlz + aWJsZV8QEEJhY2tncm91bmQgSW1hZ2VYRWRpdGFibGVaTGF5ZXIgTmFtZVpCbGVuZCBN + b2RlVlNoYXBlc18QGUJhY2tncm91bmQgSW1hZ2UgUG9zaXRpb24iP4AAAAmAAAmAA4AZ + EACABIAYWkJhY2tncm91bmTSCwwNJYAHoSaABdgoKSorLAstLi8wGjIzNDU2VlN0cm9r + ZVtQb2ludCBjb3VudFpDbG9zZSBQYXRoVlBvaW50c1hSb3RhdGlvblZTaGFkb3dVRmls + bHOACBAECYAQIgAAAACAF4ANgAbSCwwNOYAHoNI7PD0+WCRjbGFzc2VzWiRjbGFzc25h + bWWjPj9AXk5TTXV0YWJsZUFycmF5V05TQXJyYXlYTlNPYmplY3TfEBRCQ0RFRkdISUpL + C0xNTk9QUVJTVBpWHx9XVllaVxpdH15fHxsaHxsaXxAQRmlsbCBTdGFydCBBcnJvd18Q + EFNob3cgU3RhcnQgQXJyb3daRGFzaCBTdHlsZV8QD0VuZCBBcnJvdyBTdHlsZV8QFEVu + ZCBBcnJvdyBGaWxsIENvbG9yXlNob3cgRW5kIEFycm93XxAPTGluZSBKb2luIFN0eWxl + WkxpbmUgV2lkdGhfEBZTdGFydCBBcnJvdyBGaWxsIENvbG9yXxASU3Ryb2tlIFN0YXJ0 + IEFycm93XkxpbmUgQ2FwIFN0eWxlXFN0cm9rZSBDb2xvcltUZXh0IE9mZnNldF8QEVN0 + YXJ0IEFycm93IFN0eWxlXVBhdHRlcm4gSW1hZ2VeRmlsbCBFbmQgQXJyb3dbU3Ryb2tl + IE1vZGVbU3Ryb2tlIFRleHRfEBBTdHJva2UgRW5kIEFycm93CQiACwgQASJBIAAAgAsJ + gAyACSJAAAAAgAAJgAAJ02ULZmdoaVxOU0NvbG9yU3BhY2VXTlNXaGl0ZRADgApCMADS + OzxrbKJsQFdOU0NvbG9y02ULZmdob4AKQjEA0js8cXOickBYREJTdHJva2VYREJTdHJv + a2XWdXYLd3h5ent8Vn5/XE5TU2hhZG93VmVydF1OU1NoYWRvd0NvbG9yV0VuYWJsZWRd + TlNTaGFkb3dIb3Jpel8QEk5TU2hhZG93Qmx1clJhZGl1cyPAJAAAAAAAAIAOgA8II0Ak + AAAAAAAAI0AAAAAAAAAA02ULZmdogoAKTxAPMCAwLjMwMDAwMDAxMTkA0js8hIejhYZA + WERCU2hhZG93WE5TU2hhZG93WERCU2hhZG930gsMDYqAB6yLjI2OjIyRjIyUjYyAEYAS + gBOAFIASgBKAFYASgBKAFoATgBJfEBZ7MjQuMzE5MjA2LCAyMC43MzY1NjF9CAlfEBV7 + MjQuMjEwOTM4LCAxMDUuMjE2OH1fEBZ7MTA3LjQwNzQ5LCAxMDQuODg5Njl9XxAVezEw + Ny41MzUxNiwgMjAuMjgxMjV90js8nqGjn6BAWkRCUG9seWxpbmVXREJTaGFwZVpEQlBv + bHlsaW5lVnswLCAwfdI7PKSmoqVAV0RCTGF5ZXJXREJMYXllchIAAYagXxAPTlNLZXll + ZEFyY2hpdmVyAAgAEQAWAB8AKAAyADUAOgA8AFkAXwBkAGsAdgB4AHoAfACPAJUAnQCw + ALkAxADPANYA8gD3APgA+gD7AP0A/wEBAQMBBQEQARUBFwEZARsBLAEzAT8BSgFRAVoB + YQFnAWkBawFsAW4BcwF1AXcBeQF+AYABgQGGAY8BmgGeAa0BtQG+AekB/AIPAhoCLAJD + AlICZAJvAogCnQKsArkCxQLZAucC9gMCAw4DIQMiAyMDJQMmAygDLQMvAzADMgM0AzkD + OwM8Az4DPwNGA1MDWwNdA18DYgNnA2oDcgN5A3sDfgODA4YDjwOYA6UDsgPAA8gD1gPr + A/QD9gP4A/kEAgQLBBIEFAQmBCsELwQ4BEEESgRPBFEEXgRgBGIEZARmBGgEagRsBG4E + cARyBHQEdgSPBJAEkQSpBMIE2gTfBOME7gT2BQEFCAUNBRAFGAUgBSUAAAAAAAACAQAA + AAAAAACpAAAAAAAAAAAAAAAAAAAFNw== + + Show Grid + + Show Rulers + + Snap to grid + + + diff --git a/client/icons/Untitled.png b/client/icons/Untitled.png new file mode 100644 index 0000000..9107901 Binary files /dev/null and b/client/icons/Untitled.png differ diff --git a/client/icons/accessories-calculator.png b/client/icons/accessories-calculator.png new file mode 100644 index 0000000..7de1c44 Binary files /dev/null and b/client/icons/accessories-calculator.png differ diff --git a/client/icons/appicon-osx.icns b/client/icons/appicon-osx.icns new file mode 100644 index 0000000..cd954fa Binary files /dev/null and b/client/icons/appicon-osx.icns differ diff --git a/client/icons/appicon-osx.iconset/icon_128x128.png b/client/icons/appicon-osx.iconset/icon_128x128.png new file mode 100644 index 0000000..ff9bfa4 Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_128x128.png differ diff --git a/client/icons/appicon-osx.iconset/icon_128x128@2x.png b/client/icons/appicon-osx.iconset/icon_128x128@2x.png new file mode 100644 index 0000000..0f30fbd Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_128x128@2x.png differ diff --git a/client/icons/appicon-osx.iconset/icon_16x16.png b/client/icons/appicon-osx.iconset/icon_16x16.png new file mode 100644 index 0000000..815f6eb Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_16x16.png differ diff --git a/client/icons/appicon-osx.iconset/icon_16x16@2x.png b/client/icons/appicon-osx.iconset/icon_16x16@2x.png new file mode 100644 index 0000000..797f9f2 Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_16x16@2x.png differ diff --git a/client/icons/appicon-osx.iconset/icon_256x256.png b/client/icons/appicon-osx.iconset/icon_256x256.png new file mode 100644 index 0000000..0f30fbd Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_256x256.png differ diff --git a/client/icons/appicon-osx.iconset/icon_256x256@2x.png b/client/icons/appicon-osx.iconset/icon_256x256@2x.png new file mode 100644 index 0000000..b1be172 Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_256x256@2x.png differ diff --git a/client/icons/appicon-osx.iconset/icon_32x32.png b/client/icons/appicon-osx.iconset/icon_32x32.png new file mode 100644 index 0000000..1ef6bea Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_32x32.png differ diff --git a/client/icons/appicon-osx.iconset/icon_32x32@2x.png b/client/icons/appicon-osx.iconset/icon_32x32@2x.png new file mode 100644 index 0000000..349d5ea Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_32x32@2x.png differ diff --git a/client/icons/appicon-osx.iconset/icon_512x512.png b/client/icons/appicon-osx.iconset/icon_512x512.png new file mode 100644 index 0000000..b1be172 Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_512x512.png differ diff --git a/client/icons/appicon-osx.iconset/icon_512x512@2x.png b/client/icons/appicon-osx.iconset/icon_512x512@2x.png new file mode 100644 index 0000000..0f30fbd Binary files /dev/null and b/client/icons/appicon-osx.iconset/icon_512x512@2x.png differ diff --git a/client/icons/appicon-osx.pdf b/client/icons/appicon-osx.pdf new file mode 100644 index 0000000..cd7c801 Binary files /dev/null and b/client/icons/appicon-osx.pdf differ diff --git a/client/icons/appicon-osx.png b/client/icons/appicon-osx.png new file mode 100644 index 0000000..0f30fbd Binary files /dev/null and b/client/icons/appicon-osx.png differ diff --git a/client/icons/appicon.dbdoc b/client/icons/appicon.dbdoc new file mode 100644 index 0000000..4851666 --- /dev/null +++ b/client/icons/appicon.dbdoc @@ -0,0 +1,172 @@ + + + + + Canvas Background Color + + YnBsaXN0MDDUAQIDBAUIFxhUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABowkKEVUkbnVsbNMLDA0ODxBcTlNDb2xvclNwYWNlViRjbGFzc1dOU1do + aXRlEAOAAk0wLjY2NjY2NjY4NjUA0hITFBVYJGNsYXNzZXNaJGNsYXNzbmFtZaIVFldO + U0NvbG9yWE5TT2JqZWN0EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIIERYfKDI1OjxARk1a + YWlrbXuAiZSXn6itAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAL8= + + Canvas Color + + YnBsaXN0MDDUAQIDBAUIFxhUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABowkKEVUkbnVsbNMLDA0ODxBcTlNDb2xvclNwYWNlViRjbGFzc1dOU1do + aXRlEAOAAkIxANISExQVWCRjbGFzc2VzWiRjbGFzc25hbWWiFRZXTlNDb2xvclhOU09i + amVjdBIAAYagXxAPTlNLZXllZEFyY2hpdmVyCBEWHygyNTo8QEZNWmFpa21wdX6JjJSd + ogAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC0 + + Canvas Height + 256 + Canvas Width + 256 + Grid Color + + YnBsaXN0MDDUAQIDBAUIFxhUJHRvcFgkb2JqZWN0c1gkdmVyc2lvblkkYXJjaGl2ZXLR + BgdUcm9vdIABowkKEVUkbnVsbNMLDA0ODxBcTlNDb2xvclNwYWNlViRjbGFzc1dOU1do + aXRlEAOAAkQwLjUA0hITFBVYJGNsYXNzZXNaJGNsYXNzbmFtZaIVFldOU0NvbG9yWE5T + T2JqZWN0EgABhqBfEA9OU0tleWVkQXJjaGl2ZXIIERYfKDI1OjxARk1aYWlrbXJ3gIuO + lp+kAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY= + + Grid Spacing + 72 + Grid Tick Count + 5 + Layers and shapes + + YnBsaXN0MDDUAAEAAgADAAQABQAIAlgCWVQkdG9wWCRvYmplY3RzWCR2ZXJzaW9uWSRh + cmNoaXZlctEABgAHVHJvb3SAAa8QbAAJAAoAEAAiACMALgBCAEYAXwBgAGUAawBxAHYA + fwCAAIEAhgCJAI0AjgCSAJoAngCfAKIApgCnAKgAqQCtALAA0wDWANsA3wDrAO4A8wD0 + APUA9gD3APgA/QEIAQsBGgEdASQBJwEwAMUAGgEzATQBOQFBAUQBUwFaAV0BZgFnAWgB + cAFzAYIBiQGMAZUBlgGXAZ8BogGxAbgBuwHEAcUBxgHQAdMB4gHpAewB7QHuAe8B8AH1 + Af0CAAIPAhYCGQIiAiMCJAIsAi8CPgJFAkgCUQJSAlMCVFUkbnVsbNIACwAMAA0ADlYk + Y2xhc3NaTlMub2JqZWN0c4AeoQAPgALZABEAEgATABQAFQALABYAFwAYABkAGgAbABoA + HQAeAB8AIAAhVUFscGhhV1Zpc2libGVfEBBCYWNrZ3JvdW5kIEltYWdlWEVkaXRhYmxl + WkxheWVyIE5hbWVaQmxlbmQgTW9kZVZTaGFwZXNfEBlCYWNrZ3JvdW5kIEltYWdlIFBv + c2l0aW9uIj+AAAAJgAAJgAOAaxAAgASAalpCYWNrZ3JvdW5k0gALAAwADQAlgB6oACYA + JwAoACkAKgArACwALYAFgCyAOIBAgEiAUIBagGLaAC8AMAAxADIACwAzADQANQA2ADcA + OAA5ADoAOwA8AD0APgA/AEAAQVZTdHJva2VYUm90YXRpb25cRm91cnRoIFBvaW50W0Zp + cnN0IFBvaW50XFNlY29uZCBQb2ludFtUaGlyZCBQb2ludFZTaGFkb3daS25vYiBQb2lu + dFVGaWxsc4AfIgAAAACAKYAmgCuAJ4AogCOAKoAG0gALAAwADQBEgB6hAEWAB90ARwBI + AEkASgBLAEwATQBOAE8AUAALAFEAUgBTAFQAVQBWAFcAWABZAFoAWwAfAFwAGwBeXlN0 + YXJ0aW5nIFBvaW50XUVuZGluZyBSYWRpdXNaRHJhdyBQb2ludFlGaWxsIE1vZGVfEA9J + bWFnZSBGaWxsIE1vZGVYR3JhZGllbnRZRmlsbCBOYW1lXxAPU3RhcnRpbmcgUmFkaXVz + WkZpbGwgQ29sb3JdR3JhZGllbnQgVHlwZVpGaWxsIEltYWdlXEVuZGluZyBQb2ludIAb + Ir9/z+iAGhABEGSAC4AIIgAAAACACYAdgACAHFRGaWxs0wBhAGIACwBWAGMAZFxOU0Nv + bG9yU3BhY2VVTlNSR0JGMSAxIDEAgArSAGYAZwBoAGlYJGNsYXNzZXNaJGNsYXNzbmFt + ZaIAaQBqV05TQ29sb3JYTlNPYmplY3TTAGwACwBtAG4AbwBwXxAUTlNHcmFkaWVudENv + bG9yU3BhY2VfEBROU0dyYWRpZW50Q29sb3JBcnJheYARgBmADNIACwAMAHIAc4AYogB0 + AHWADYAV0wAMAAsAdwB4AHsAfFdOUy5rZXlzogB5AHqAEIATgBSiAH0AfoAOgA9fEA9O + U0dyYWRpZW50Q29sb3JfEBJOU0dyYWRpZW50UG9zaXRpb27UAIIACwBhAGIAbgBkAFYA + hV8QEk5TQ3VzdG9tQ29sb3JTcGFjZYARgApGMCAwIDAA0gCHAAsAVgCIVE5TSUSAEtIA + ZgBnAIoAjKIAiwBqXE5TQ29sb3JTcGFjZVxOU0NvbG9yU3BhY2UiAAAAANIAZgBnAI8A + kKMAkACRAGpfEBNOU011dGFibGVEaWN0aW9uYXJ5XE5TRGljdGlvbmFyedMADAALAHcA + kwB7AJeiAJQAlYAWgBeAFKIAfQB+gA6AD9QAggALAGEAYgBuAGQAVgCdgBGACkYxIDEg + MQAiP4AAANIAZgBnAKAAoaIAoQBqV05TQXJyYXnSAGYAZwCjAKWiAKQAalpOU0dyYWRp + ZW50Wk5TR3JhZGllbnRfEB17LTAuOTk5MjY4MDUsIC0yLjU5NTI3MDllLTI0fVx7LWlu + ZiwgLWluZn1cey1pbmYsIC1pbmZ90gBmAGcAqgCsogCrAGpWREJGaWxsVkRCRmlsbNIA + ZgBnAK4Ar6MArwChAGpeTlNNdXRhYmxlQXJyYXnfEBQAsQCyALMAtAC1ALYAtwC4ALkA + ugALALsAvAC9AL4AvwDAAMEAwgDDABoAxQAfAB8AxgDFAFYAyADGABoAywDMAM0AzgAf + ABsAGgAfABsAGl8QEEZpbGwgU3RhcnQgQXJyb3dfEBBTaG93IFN0YXJ0IEFycm93WkRh + c2ggU3R5bGVfEA9FbmQgQXJyb3cgU3R5bGVfEBRFbmQgQXJyb3cgRmlsbCBDb2xvcl5T + aG93IEVuZCBBcnJvd18QD0xpbmUgSm9pbiBTdHlsZVpMaW5lIFdpZHRoXxAWU3RhcnQg + QXJyb3cgRmlsbCBDb2xvcl8QElN0cm9rZSBTdGFydCBBcnJvd15MaW5lIENhcCBTdHls + ZVxTdHJva2UgQ29sb3JbVGV4dCBPZmZzZXRfEBFTdGFydCBBcnJvdyBTdHlsZV1QYXR0 + ZXJuIEltYWdlXkZpbGwgRW5kIEFycm93W1N0cm9rZSBNb2RlW1N0cm9rZSBUZXh0XxAQ + U3Ryb2tlIEVuZCBBcnJvdwkIgCEIIkCAAACAIQmAIhACgCAiQAAAAIAACYAACdMAYQBi + AAsAVgDUAGRPECcwLjgyMTM5NzY2MjIgMC44MDAwOTU2Nzc0IDAuODY0NDcwMTI0MgCA + CtMAYQALANcA2ABkANpXTlNXaGl0ZRADgApCMQDSAGYAZwDcAN6iAN0AalhEQlN0cm9r + ZVhEQlN0cm9rZdYA4ADhAAsA4gDjAOQA5QDmAOcAxQDpAOpcTlNTaGFkb3dWZXJ0XU5T + U2hhZG93Q29sb3JXRW5hYmxlZF1OU1NoYWRvd0hvcml6XxASTlNTaGFkb3dCbHVyUmFk + aXVzI8AkAAAAAAAAgCSAJQgjQCQAAAAAAAAjQAAAAAAAAADTAGEACwDXANgAZADtgApP + EA8wIDAuMzAwMDAwMDExOQDSAGYAZwDvAPKjAPAA8QBqWERCU2hhZG93WE5TU2hhZG93 + WERCU2hhZG93XxAWezU3LjYwMDAwNiwgMzkuOTk5OTkyfV8QFnsyMDIuNzk5OTcsIDM5 + Ljk5OTk5Mn1fEBZ7MjAyLjc5OTk3LCAyMjcuMTk5OTd9XxAWezU3LjYwMDAwNiwgMjI3 + LjE5OTk3fV8QFnsyMDIuNzk5OTcsIDM5Ljk5OTk5Mn3SAGYAZwD5APyjAPoA+wBqW0RC + UmVjdGFuZ2xlV0RCU2hhcGVbREJSZWN0YW5nbGXYAC8A/gD/AQAAMAALADUANwEBAMwA + xQEDAQQBBQEGAQdbUG9pbnQgY291bnRaQ2xvc2UgUGF0aFZQb2ludHOALgiAMiIAAAAA + gDeAMIAt0gALAAwADQEKgB6g3xAUALEAsgCzALQAtQC2ALcAuAC5ALoACwC7ALwAvQC+ + AL8AwADBAMIAwwAaAMUAHwAfAMYAxQAfARAAxgAaAMsAHwEUARUAHwAbABoAHwAbABoJ + CIAhCCJAAAAAgCEJgCKALyJAAAAAgAAJgAAJ0wBhAAsA1wDYAGQBHIAKQjAA1gDgAOEA + CwDiAOMA5AEeAR8A5wDFASIBIyPAJAAAAAAAAIAxgCUII0AkAAAAAAAAI0AAAAAAAAAA + 0wBhAAsA1wDYAGQBJoAKTxAPMCAwLjMwMDAwMDAxMTkA0gALAAwADQEpgB6mASoBKwEs + AS0BKwErgDOANIA1gDaANIA0WHs3MiwgNzJ9CAlfEA97MTg3LjE5OTk4LCA3Mn3SAGYA + ZwE1ATijATYBNwBqWkRCUG9seWxpbmVXREJTaGFwZVpEQlBvbHlsaW5l2AAvAP4A/wEA + ADAACwA1ADcBOgDMAMUBPAE9AQUBPwFAgDoIgD0iAAAAAIA3gDuAOdIACwAMAA0BQ4Ae + oN8QFACxALIAswC0ALUAtgC3ALgAuQC6AAsAuwC8AL0AvgC/AMAAwQDCAMMAGgDFAB8A + HwDGAMUAHwFJAMYAGgDLAB8BFAFOAB8AGwAaAB8AGwAaCQiAIQgiQAAAAIAhCYAigC8i + QAAAAIAACYAACdYA4ADhAAsA4gDjAOQBVAFVAOcAxQFYAVkjwCQAAAAAAACAPIAlCCNA + JAAAAAAAACNAAAAAAAAAANMAYQALANcA2ABkAVyACk8QDzAgMC4zMDAwMDAwMTE5ANIA + CwAMAA0BX4AepgFgASsBLAFjASsBK4A+gDSANYA/gDSANF8QD3s3MiwgMTAwLjc5OTk5 + fV8QFnsxODcuMTk5OTgsIDEwMC43OTk5OX3YAC8A/gD/AQAAMAALADUANwFpAMwAxQFr + AWwBBQFuAW+AQgiARSIAAAAAgDeAQ4BB0gALAAwADQFygB6g3xAUALEAsgCzALQAtQC2 + ALcAuAC5ALoACwC7ALwAvQC+AL8AwADBAMIAwwAaAMUAHwAfAMYAxQAfAXgAxgAaAMsA + HwEUAX0AHwAbABoAHwAbABoJCIAhCCJAAAAAgCEJgCKALyJAAAAAgAAJgAAJ1gDgAOEA + CwDiAOMA5AGDAYQA5wDFAYcBiCPAJAAAAAAAAIBEgCUII0AkAAAAAAAAI0AAAAAAAAAA + 0wBhAAsA1wDYAGQBi4AKTxAPMCAwLjMwMDAwMDAxMTkA0gALAAwADQGOgB6mAY8BKwEs + AZIBKwErgEaANIA1gEeANIA0XxAPezcyLCAxMjkuNjAwMDF9XxAWezE4Ny4xOTk5OCwg + MTI5LjYwMDAxfdgALwD+AP8BAAAwAAsANQA3AZgAzADFAZoBmwEFAZ0BnoBKCIBNIgAA + AACAN4BLgEnSAAsADAANAaGAHqDfEBQAsQCyALMAtAC1ALYAtwC4ALkAugALALsAvAC9 + AL4AvwDAAMEAwgDDABoAxQAfAB8AxgDFAB8BpwDGABoAywAfARQBrAAfABsAGgAfABsA + GgkIgCEIIkAAAACAIQmAIoAvIkAAAACAAAmAAAnWAOAA4QALAOIA4wDkAbIBswDnAMUB + tgG3I8AkAAAAAAAAgEyAJQgjQCQAAAAAAAAjQAAAAAAAAADTAGEACwDXANgAZAG6gApP + EA8wIDAuMzAwMDAwMDExOQDSAAsADAANAb2AHqYBvgErASwBwQErASuAToA0gDWAT4A0 + gDRfEA97NzIsIDE1OC4zOTk5OX1fEBZ7MTg3LjE5OTk4LCAxNTguMzk5OTl92QAvADAA + MQAyAAsAMwA0ADUANwHHAcgByQHKAcsBzAHNAc4Bz4BSIgAAAACAWIBVgFmAVoBXgFOA + UdIACwAMAA0B0oAeoN8QFACxALIAswC0ALUAtgC3ALgAuQC6AAsAuwC8AL0AvgC/AMAA + wQDCAMMAGgDFAB8AHwDGAMUAHwHYAMYAGgDLAB8BFAHdAB8AGwAaAB8AGwAaCQiAIQgi + QAAAAIAhCYAigC8iQAAAAIAACYAACdYA4ADhAAsA4gDjAOQB4wHkAOcAxQHnAegjwCQA + AAAAAACAVIAlCCNAJAAAAAAAACNAAAAAAAAAANMAYQALANcA2ABkAeuACk8QDzAgMC4z + MDAwMDAwMTE5AF8QEHsxNDQsIDE3Mi43OTk5OX1fEBJ7MTg3LjIsIDE3Mi43OTk5OX1c + ezE4Ny4yLCAyMTZ9WnsxNDQsIDIxNn3SAGYAZwHxAfSjAfIB8wBqVkRCT3ZhbFdEQlNo + YXBlVkRCT3ZhbNgALwD+AP8BAAAwAAsANQA3AfYAzADFAfgB+QEFAfsB/IBcCIBfIgAA + AACAN4BdgFvSAAsADAANAf+AHqDfEBQAsQCyALMAtAC1ALYAtwC4ALkAugALALsAvAC9 + AL4AvwDAAMEAwgDDABoAxQAfAB8AxgDFAB8CBQDGABoAywAfARQCCgAfABsAGgAfABsA + GgkIgCEIIkAAAACAIQmAIoAvIkAAAACAAAmAAAnWAOAA4QALAOIA4wDkAhACEQDnAMUC + FAIVI8AkAAAAAAAAgF6AJQgjQCQAAAAAAAAjQAAAAAAAAADTAGEACwDXANgAZAIYgApP + EA8wIDAuMzAwMDAwMDExOQDSAAsADAANAhuAHqYCHAErASwCHwErASuAYIA0gDWAYYA0 + gDRfEBV7MTY1LjE1NDMsIDE5My4wMDM5MX1fEBV7MTY1LjE1NDMsIDE3NS44MjQyMn3Y + AC8A/gD/AQAAMAALADUANwIlAMwAxQInAigBBQIqAiuAZAiAZyIAAAAAgDeAZYBj0gAL + AAwADQIugB6g3xAUALEAsgCzALQAtQC2ALcAuAC5ALoACwC7ALwAvQC+AL8AwADBAMIA + wwAaAMUAHwAfAMYAxQAfAjQAxgAaAMsAHwEUAjkAHwAbABoAHwAbABoJCIAhCCJAAAAA + gCEJgCKALyJAAAAAgAAJgAAJ1gDgAOEACwDiAOMA5AI/AkAA5wDFAkMCRCPAJAAAAAAA + AIBmgCUII0AkAAAAAAAAI0AAAAAAAAAA0wBhAAsA1wDYAGQCR4AKTxAPMCAwLjMwMDAw + MDAxMTkA0gALAAwADQJKgB6mAksBKwEsAk4BKwErgGiANIA1gGmANIA0XxAWezE2NS40 + MzU1NSwgMTk0LjQ1MTE3fV8QFXsxNDYuODkyNTgsIDE5NC43MzczfVZ7MCwgMH3SAGYA + ZwJVAleiAlYAaldEQkxheWVyV0RCTGF5ZXISAAGGoF8QD05TS2V5ZWRBcmNoaXZlcgAI + ABkAHgAnADAAOgA/AEQARgEhAScBMAE3AUIBRAFHAUkBbgF0AXwBjwGYAaMBrgG1AdEB + 1gHXAdkB2gHcAd4B4AHiAeQB7wH4AfoCCwINAg8CEQITAhUCFwIZAhsCRAJLAlQCYQJt + AnoChgKNApgCngKgAqUCpwKpAqsCrQKvArECswK1Ar4CwALDAsUC+gMJAxcDIgMsAz4D + RwNRA2MDbgN8A4cDlAOWA5sDnQOfA6EDowOlA6oDrAOuA7ADsgO3A8QD0QPXA94D4APp + A/ID/QQCBAoEEwQgBDcETgRQBFIEVARdBF8EZARmBGgEdQR9BIIEhASGBIgEjQSPBJEE + owS4BMkE3gTgBOIE6QTyBPcE+QUCBQcFFAUhBSYFLwU2BUwFWQVmBWsFbQVvBXEFdgV4 + BXoFiwWNBY8FlgWbBaQFqQWxBboFvwXKBdUF9QYCBg8GGAYdBiQGKwY0BjsGSgadBrAG + wwbOBuAG9wcGBxgHIwc8B1EHYAdtB3kHjQebB6oHtgfCB9UH1gfXB9kH2gffB+EH4gfk + B+YH6AftB+8H8AfyB/MIAAgqCCwIOQhBCEMIRQhICFEIVghfCGgIgQiOCJwIpAiyCMcI + 0AjSCNQI1QjeCOcI9Aj2CQgJEQkYCSEJKgkzCUwJZQl+CZcJsAm5CcAJzAnUCeAKAQoN + ChgKHwohCiIKJAopCisKLQovCjgKOgo7Co4KjwqQCpIKkwqYCpoKmwqdCp8KpAqmCqcK + qQqqCrcKuQq8CtUK3grgCuIK4wrsCvULAgsECxYLHwshCy4LMAsyCzQLNgs4CzoLQwtE + C0ULVwtgC2cLcgt6C4ULpguoC6kLqwuwC7ILtAu2C78LwQvCDBUMFgwXDBkMGgwfDCEM + IgwkDCYMKwwtDC4MMAwxDEoMUwxVDFcMWAxhDGoMdwx5DIsMlAyWDKMMpQynDKkMqwyt + DK8MwQzaDPsM/Qz+DQANBQ0HDQkNCw0UDRYNFw1qDWsNbA1uDW8NdA12DXcNeQ17DYAN + gg2DDYUNhg2fDagNqg2sDa0Ntg2/DcwNzg3gDekN6w34DfoN/A3+DgAOAg4EDhYOLw5Q + DlIOUw5VDloOXA5eDmAOaQ5rDmwOvw7ADsEOww7EDskOyw7MDs4O0A7VDtcO2A7aDtsO + 9A79Dv8PAQ8CDwsPFA8hDyMPNQ8+D0APTQ9PD1EPUw9VD1cPWQ9rD4QPqQ+rD7APsg+0 + D7YPuA+6D7wPvg/HD8kPyhAdEB4QHxAhECIQJxApECoQLBAuEDMQNRA2EDgQORBSEFsQ + XRBfEGAQaRByEH8QgRCTEKYQuxDIENMQ3BDjEOoQ8hD5ERoRHBEdER8RJBEmESgRKhEz + ETURNhGJEYoRixGNEY4RkxGVEZYRmBGaEZ8RoRGiEaQRpRG+EccRyRHLEcwR1RHeEesR + 7RH/EggSChIXEhkSGxIdEh8SIRIjEjsSUxJ0EnYSdxJ5En4SgBKCEoQSjRKPEpAS4xLk + EuUS5xLoEu0S7xLwEvIS9BL5EvsS/BL+Ev8TGBMhEyMTJRMmEy8TOBNFE0cTWRNiE2QT + cRNzE3UTdxN5E3sTfROWE64TtRO+E8MTyxPTE9gAAAAAAAACAgAAAAAAAAJaAAAAAAAA + AAAAAAAAAAAT6g== + + Show Grid + + Show Rulers + + Snap to grid + + + diff --git a/client/icons/applications-development.png b/client/icons/applications-development.png new file mode 100644 index 0000000..bc88a5c Binary files /dev/null and b/client/icons/applications-development.png differ diff --git a/client/icons/appointment-new.png b/client/icons/appointment-new.png new file mode 100644 index 0000000..85daef3 Binary files /dev/null and b/client/icons/appointment-new.png differ diff --git a/client/icons/buildicon-osx.sh b/client/icons/buildicon-osx.sh new file mode 100755 index 0000000..2ff22fe --- /dev/null +++ b/client/icons/buildicon-osx.sh @@ -0,0 +1,15 @@ +APPICON=appicon-osx.png +ICONSET=appicon-osx.iconset +mkdir $ICONSET +sips -z 16 16 $APPICON --out $ICONSET/icon_16x16.png +sips -z 32 32 $APPICON --out $ICONSET/icon_16x16@2x.png +sips -z 32 32 $APPICON --out $ICONSET/icon_32x32.png +sips -z 64 64 $APPICON --out $ICONSET/icon_32x32@2x.png +sips -z 128 128 $APPICON --out $ICONSET/icon_128x128.png +sips -z 256 256 $APPICON --out $ICONSET/icon_128x128@2x.png +sips -z 256 256 $APPICON --out $ICONSET/icon_256x256.png +sips -z 512 512 $APPICON --out $ICONSET/icon_256x256@2x.png +sips -z 512 512 $APPICON --out $ICONSET/icon_512x512.png +cp $APPICON $ICONSET/icon_512x512@2x.png +iconutil -c icns appicon-osx.iconset +# rm -R $ICONSET diff --git a/client/icons/clock-128x128.png b/client/icons/clock-128x128.png new file mode 100644 index 0000000..2152ec3 Binary files /dev/null and b/client/icons/clock-128x128.png differ diff --git a/client/icons/clock-32x32.png b/client/icons/clock-32x32.png new file mode 100644 index 0000000..2f29599 Binary files /dev/null and b/client/icons/clock-32x32.png differ diff --git a/client/icons/clock-64x64.png b/client/icons/clock-64x64.png new file mode 100644 index 0000000..2152ec3 Binary files /dev/null and b/client/icons/clock-64x64.png differ diff --git a/client/icons/dialog-error.png b/client/icons/dialog-error.png new file mode 100644 index 0000000..cdd95ba Binary files /dev/null and b/client/icons/dialog-error.png differ diff --git a/client/icons/document-new.png b/client/icons/document-new.png new file mode 100644 index 0000000..e6d64bb Binary files /dev/null and b/client/icons/document-new.png differ diff --git a/client/icons/document-print.png b/client/icons/document-print.png new file mode 100644 index 0000000..3ef3930 Binary files /dev/null and b/client/icons/document-print.png differ diff --git a/client/icons/document-save.png b/client/icons/document-save.png new file mode 100644 index 0000000..db5c52b Binary files /dev/null and b/client/icons/document-save.png differ diff --git a/client/icons/edit-clear.png b/client/icons/edit-clear.png new file mode 100644 index 0000000..5542948 Binary files /dev/null and b/client/icons/edit-clear.png differ diff --git a/client/icons/edit-copy.png b/client/icons/edit-copy.png new file mode 100644 index 0000000..3348ee0 Binary files /dev/null and b/client/icons/edit-copy.png differ diff --git a/client/icons/edit-cut.png b/client/icons/edit-cut.png new file mode 100644 index 0000000..217663b Binary files /dev/null and b/client/icons/edit-cut.png differ diff --git a/client/icons/edit-delete.png b/client/icons/edit-delete.png new file mode 100644 index 0000000..9becb3e Binary files /dev/null and b/client/icons/edit-delete.png differ diff --git a/client/icons/edit-find-replace.png b/client/icons/edit-find-replace.png new file mode 100644 index 0000000..0f1b117 Binary files /dev/null and b/client/icons/edit-find-replace.png differ diff --git a/client/icons/edit-find.png b/client/icons/edit-find.png new file mode 100644 index 0000000..5594785 Binary files /dev/null and b/client/icons/edit-find.png differ diff --git a/client/icons/edit-paste.png b/client/icons/edit-paste.png new file mode 100644 index 0000000..dd429ce Binary files /dev/null and b/client/icons/edit-paste.png differ diff --git a/client/icons/edit-redo.png b/client/icons/edit-redo.png new file mode 100644 index 0000000..3eb7b05 Binary files /dev/null and b/client/icons/edit-redo.png differ diff --git a/client/icons/edit-select-all.png b/client/icons/edit-select-all.png new file mode 100644 index 0000000..107fc60 Binary files /dev/null and b/client/icons/edit-select-all.png differ diff --git a/client/icons/edit-undo.png b/client/icons/edit-undo.png new file mode 100644 index 0000000..61b2ce9 Binary files /dev/null and b/client/icons/edit-undo.png differ diff --git a/client/icons/emblem-system.png b/client/icons/emblem-system.png new file mode 100644 index 0000000..abac7e9 Binary files /dev/null and b/client/icons/emblem-system.png differ diff --git a/client/icons/empty.png b/client/icons/empty.png new file mode 100644 index 0000000..a16d656 Binary files /dev/null and b/client/icons/empty.png differ diff --git a/client/icons/folder-new.png b/client/icons/folder-new.png new file mode 100644 index 0000000..fcd15c0 Binary files /dev/null and b/client/icons/folder-new.png differ diff --git a/client/icons/folder-open.png b/client/icons/folder-open.png new file mode 100644 index 0000000..901816c Binary files /dev/null and b/client/icons/folder-open.png differ diff --git a/client/icons/folder-saved-search.png b/client/icons/folder-saved-search.png new file mode 100644 index 0000000..88d4541 Binary files /dev/null and b/client/icons/folder-saved-search.png differ diff --git a/client/icons/folder.png b/client/icons/folder.png new file mode 100644 index 0000000..472484f Binary files /dev/null and b/client/icons/folder.png differ diff --git a/client/icons/format-indent-less.png b/client/icons/format-indent-less.png new file mode 100644 index 0000000..7ced16f Binary files /dev/null and b/client/icons/format-indent-less.png differ diff --git a/client/icons/format-indent-more.png b/client/icons/format-indent-more.png new file mode 100644 index 0000000..6a18867 Binary files /dev/null and b/client/icons/format-indent-more.png differ diff --git a/client/icons/format-justify-center.png b/client/icons/format-justify-center.png new file mode 100644 index 0000000..a0db2bb Binary files /dev/null and b/client/icons/format-justify-center.png differ diff --git a/client/icons/format-justify-fill.png b/client/icons/format-justify-fill.png new file mode 100644 index 0000000..2a34a8f Binary files /dev/null and b/client/icons/format-justify-fill.png differ diff --git a/client/icons/format-justify-left.png b/client/icons/format-justify-left.png new file mode 100644 index 0000000..ba0e914 Binary files /dev/null and b/client/icons/format-justify-left.png differ diff --git a/client/icons/format-justify-right.png b/client/icons/format-justify-right.png new file mode 100644 index 0000000..2144cb9 Binary files /dev/null and b/client/icons/format-justify-right.png differ diff --git a/client/icons/format-text-bold.png b/client/icons/format-text-bold.png new file mode 100644 index 0000000..99ed19c Binary files /dev/null and b/client/icons/format-text-bold.png differ diff --git a/client/icons/format-text-italic.png b/client/icons/format-text-italic.png new file mode 100644 index 0000000..87ed6f9 Binary files /dev/null and b/client/icons/format-text-italic.png differ diff --git a/client/icons/format-text-strikethrough.png b/client/icons/format-text-strikethrough.png new file mode 100644 index 0000000..b9b55ab Binary files /dev/null and b/client/icons/format-text-strikethrough.png differ diff --git a/client/icons/format-text-underline.png b/client/icons/format-text-underline.png new file mode 100644 index 0000000..0de6b1c Binary files /dev/null and b/client/icons/format-text-underline.png differ diff --git a/client/icons/list-add.png b/client/icons/list-add.png new file mode 100644 index 0000000..2acdd8f Binary files /dev/null and b/client/icons/list-add.png differ diff --git a/client/icons/list-remove.png b/client/icons/list-remove.png new file mode 100644 index 0000000..c5524f7 Binary files /dev/null and b/client/icons/list-remove.png differ diff --git a/client/icons/mail-attachment.png b/client/icons/mail-attachment.png new file mode 100644 index 0000000..78f1e1c Binary files /dev/null and b/client/icons/mail-attachment.png differ diff --git a/client/icons/media-playback-start.png b/client/icons/media-playback-start.png new file mode 100644 index 0000000..66f32d8 Binary files /dev/null and b/client/icons/media-playback-start.png differ diff --git a/client/icons/media-playback-stop.png b/client/icons/media-playback-stop.png new file mode 100644 index 0000000..a094787 Binary files /dev/null and b/client/icons/media-playback-stop.png differ diff --git a/client/icons/network-error.png b/client/icons/network-error.png new file mode 100644 index 0000000..3de26e7 Binary files /dev/null and b/client/icons/network-error.png differ diff --git a/client/icons/network-receive.png b/client/icons/network-receive.png new file mode 100644 index 0000000..b149c5d Binary files /dev/null and b/client/icons/network-receive.png differ diff --git a/client/icons/network-transmit.png b/client/icons/network-transmit.png new file mode 100644 index 0000000..aaa91b8 Binary files /dev/null and b/client/icons/network-transmit.png differ diff --git a/client/icons/office-calendar.png b/client/icons/office-calendar.png new file mode 100644 index 0000000..7817c12 Binary files /dev/null and b/client/icons/office-calendar.png differ diff --git a/client/icons/preferences-system.png b/client/icons/preferences-system.png new file mode 100644 index 0000000..6e52db7 Binary files /dev/null and b/client/icons/preferences-system.png differ diff --git a/client/icons/process-stop.png b/client/icons/process-stop.png new file mode 100644 index 0000000..e7a8d17 Binary files /dev/null and b/client/icons/process-stop.png differ diff --git a/client/icons/software-update-available.png b/client/icons/software-update-available.png new file mode 100644 index 0000000..aadcb91 Binary files /dev/null and b/client/icons/software-update-available.png differ diff --git a/client/icons/starttracking-osx.png b/client/icons/starttracking-osx.png new file mode 100644 index 0000000..d5bfd4b Binary files /dev/null and b/client/icons/starttracking-osx.png differ diff --git a/client/icons/stoptracking-osx.png b/client/icons/stoptracking-osx.png new file mode 100644 index 0000000..7fe3521 Binary files /dev/null and b/client/icons/stoptracking-osx.png differ diff --git a/client/icons/system-search.png b/client/icons/system-search.png new file mode 100644 index 0000000..950d792 Binary files /dev/null and b/client/icons/system-search.png differ diff --git a/client/icons/text-x-generic.png b/client/icons/text-x-generic.png new file mode 100644 index 0000000..928a679 Binary files /dev/null and b/client/icons/text-x-generic.png differ diff --git a/client/icons/tray-default.png b/client/icons/tray-default.png new file mode 100644 index 0000000..bf1a498 Binary files /dev/null and b/client/icons/tray-default.png differ diff --git a/client/icons/tray-running.png b/client/icons/tray-running.png new file mode 100644 index 0000000..9f6def6 Binary files /dev/null and b/client/icons/tray-running.png differ diff --git a/client/icons/tree-add-child-small.png b/client/icons/tree-add-child-small.png new file mode 100644 index 0000000..7705fbb Binary files /dev/null and b/client/icons/tree-add-child-small.png differ diff --git a/client/icons/tree-add-child.png b/client/icons/tree-add-child.png new file mode 100644 index 0000000..811356f Binary files /dev/null and b/client/icons/tree-add-child.png differ diff --git a/client/icons/tree-add-root-small.png b/client/icons/tree-add-root-small.png new file mode 100644 index 0000000..9f65c53 Binary files /dev/null and b/client/icons/tree-add-root-small.png differ diff --git a/client/icons/tree-add-root.png b/client/icons/tree-add-root.png new file mode 100644 index 0000000..eac447a Binary files /dev/null and b/client/icons/tree-add-root.png differ diff --git a/client/icons/tree-add-sibling-small.png b/client/icons/tree-add-sibling-small.png new file mode 100644 index 0000000..dcff3eb Binary files /dev/null and b/client/icons/tree-add-sibling-small.png differ diff --git a/client/logger.cpp b/client/logger.cpp new file mode 100644 index 0000000..c340bc7 --- /dev/null +++ b/client/logger.cpp @@ -0,0 +1,52 @@ +#include "config.h" +#include "logger.h" +#include "helper.h" +#include +#include + +Logger::Logger(QObject *parent) : + QObject(parent), mFile(nullptr) +{ + open(); +} + +Logger::~Logger() +{ + close(); +} + +void Logger::log(const char* msg) +{ + if (!mFile) + return; + + char buffer[512]; + time_t rawtime; + struct tm * timeinfo; + time (&rawtime); + timeinfo = localtime (&rawtime); + sprintf(buffer, "%s : %s\n", asctime(timeinfo), msg); + + puts(buffer); + fputs(buffer, mFile); + fflush(mFile); +} + +void Logger::open() +{ +#if defined(USE_LOGGER) + if (mFile) + return; + + QString p = PathHelper::pathToSettings(); + mFile = fopen(PathHelper::pathToLog().toStdString().c_str(), "wt"); +#endif +} + +void Logger::close() +{ + if (!mFile) + return; + fclose(mFile); + mFile = nullptr; +} diff --git a/client/logger.h b/client/logger.h new file mode 100644 index 0000000..5f77c39 --- /dev/null +++ b/client/logger.h @@ -0,0 +1,27 @@ +#ifndef LOGGER_H +#define LOGGER_H + +#include + +class Logger : public QObject +{ + Q_OBJECT +public: + explicit Logger(QObject *parent = 0); + ~Logger(); + + void log(const char* msg); + +protected: + FILE* mFile; + + void open(); + void close(); + +signals: + +public slots: + +}; + +#endif // LOGGER_H diff --git a/client/main.cpp b/client/main.cpp new file mode 100644 index 0000000..ebfcbf4 --- /dev/null +++ b/client/main.cpp @@ -0,0 +1,16 @@ +#include "mainwindow.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.layout()->invalidate(); + + w.setAttribute(Qt::WA_WState_ExplicitShowHide, false); + w.setAttribute(Qt::WA_WState_Hidden, true); + w.show(); + + return a.exec(); +} diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp new file mode 100644 index 0000000..27b7eb0 --- /dev/null +++ b/client/mainwindow.cpp @@ -0,0 +1,1617 @@ +#include "config.h" +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include "tasktreemodel.h" +#include "timetreemodel.h" +#include "helper.h" +#include "newpassworddlg.h" +#include "passworddlg.h" +#include +#include +#include +#include +#include +#include +#include + +#include "appevents.h" +#include "preferencesdlg.h" +#include "timetreedlg.h" +#include "timereportwizard.h" +#include "aboutdlg.h" +#include "attachmentslist.h" +#include "attachmentsdialog.h" +#include "fvupdater.h" +#include "taskaction.h" +#include "finddialog.h" +#include "startworkdialog.h" +#include "stopworkdialog.h" +#include + +#define SETTINGS mSettings->data() + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow), mPasswordFailed(false), mFindInTasksDlg(this), mDockRecentMenu(nullptr) +{ + mAttachmentsAction = nullptr; + mAttachmentsLabel = nullptr; + + this->setUpdatesEnabled(false); + + mDuplicationSignalLabel = nullptr; + mCurrentIntervalLabel = nullptr; + mTrayIcon = nullptr; + + ui->setupUi(this); + + // Hide Find line edit for now + ui->mFindFrame->setVisible(false); + EscapeKeyEventFilter* eventFilter = new EscapeKeyEventFilter(ui->mFindEdit); + connect(eventFilter, SIGNAL(escapePressed(QObject*)), this, SLOT(findRejected(QObject*))); + ui->mFindEdit->installEventFilter(eventFilter); + + QCoreApplication::setApplicationName(APPNAME); + //QCoreApplication::setOrganizationName(COMPANY); + // Set this to your own appcast URL, of course + FvUpdater::sharedUpdater()->SetFeedURL("http://satorilight.com/LittAppCast.xml"); + + initClient(); + QApplication::postEvent(this, new AttachDatabaseEvent()); +} + +MainWindow::~MainWindow() +{ + delete ui; + //delete mCurrentIntervalLabel; +} + + +void MainWindow::attachDatabase() +{ + // Open database + QString path = PathHelper::pathToDatabase(); + if (mSettings->data()[KEY_DB_FILENAME_SPECIFIED].toBool()) + path = mSettings->data()[KEY_DB_FILENAME].toString(); + + QString folder = QFileInfo(path).absoluteDir().path(); + Storage::instance().setPath(path); + + if (!QFile::exists(path)) + { + QDir().mkpath(folder); + + // Ask about new password + mNewPasswordDlg = new NewPasswordDlg(this); + connect(mNewPasswordDlg, SIGNAL(finished(int)), this, SLOT(newPasswordDialogFinished(int))); + mNewPasswordDlg->show(); + } + else + { + // See if there is stored password + QString password; + if (mSettings->data()[KEY_AUTOSAVE_PASSWORD].toBool() && mSettings->data()[KEY_PASSWORD].toString() != NOPASSWORDSTRING) + password = mSettings->data()[KEY_PASSWORD].toString(); + else + { + mPasswordDlg = new PasswordDlg(this); + connect(mPasswordDlg, SIGNAL(finished(int)), this, SLOT(passwordDialogFinished(int))); + mPasswordDlg->show(); + } + } + this->setUpdatesEnabled(true); +} + +void MainWindow::openDatabase(const QString &password) +{ + Storage::instance().setKey(password); + if (!Storage::instance().open()) + { + mPasswordFailed = true; + alertBox(tr("Error"), tr("Failed to open database"), AlertType_CannotOpen); + } + else + if (mSettings->data()[KEY_AUTOSAVE_PASSWORD].toBool()) + { + mSettings->data()[KEY_PASSWORD] = password; + mSettings->save(); + } +} + +void MainWindow::connectUiToDatabase() +{ + ui->mTaskTree->setModel(mTaskTreeModel = new TaskTreeModel(false)); + ui->mTaskTree->setItemDelegate(&mTaskItemDelegate); + connect(mTaskTreeModel, SIGNAL(onTaskMoved(PTask)), this, SLOT(taskMoved(PTask))); + + ChangesHistory::instance().setTaskTreeModel(mTaskTreeModel); + + connect(ui->mTaskTree->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(taskIndexChanged(QModelIndex,QModelIndex))); + mUpdateTimer = new QTimer(this); + connect(mUpdateTimer, SIGNAL(timeout()), SLOT(updateData())); + mUpdateTimer->setInterval(1000); + mUpdateTimer->setSingleShot(false); + mUpdateTimer->start(); + + connect(this, SIGNAL(onTimeFormatChanged()), this, SLOT(timeFormatChanged())); + connect(this, SIGNAL(onTimeChanged()), this, SLOT(timeFormatChanged())); + + if (mTaskTreeModel->hasChildren()) + ui->mTaskTree->setCurrentIndex(mTaskTreeModel->index(0,0, QModelIndex())); + + mTaskTreeModel->setExpandedState(mSettings->data()[KEY_EXPANDED_TASKS].toString(), *ui->mTaskTree); + mTaskTreeModel->setSelected(mSettings->data()[KEY_SELECTED_TASKS].toString(), *ui->mTaskTree); + + // Load recent tasks + QString recent = mSettings->data()[KEY_RECENT_TASKS].toString(); + QStringList recentList = recent.split(";", QString::SkipEmptyParts); + for (QString& s: recentList) + { + Task::Id id = s.toULongLong(); + PTask t = Storage::instance().findTaskById(id); + if (t) + mRecentTrackingTasks.push_back(t); + } + prepareRecentTasksMenu(ui->mStartRecentTaskMenu); + if (mDockRecentMenu) + prepareRecentTasksMenu(mDockRecentMenu); +} + +void MainWindow::alertBox(const QString &title, const QString &text, AlertType alertType) +{ + mAlertBox = new QMessageBox(alertType == AlertType_Critical ? QMessageBox::Critical : QMessageBox::Warning, + title, text, QMessageBox::Ok, this, + Qt::Sheet); + switch (alertType) + { + case AlertType_Critical: + connect(mAlertBox, SIGNAL(finished(int)), this, SLOT(criticalAlertFinished(int))); + break; + + case AlertType_CannotOpen: + connect(mAlertBox, SIGNAL(finished(int)), this, SLOT(openAlertFinished(int))); + break; + + case AlertType_Warning: + connect(mAlertBox, SIGNAL(finished(int)), this, SLOT(warningAlertFinished(int))); + break; + } + + mAlertBox->show(); +} + +void MainWindow::initClient() +{ + mFindStartIndex = 0; + + // Open settings + mSettings = QSharedPointer(new Settings()); + mLogger = QSharedPointer(new Logger()); + + ui->mAboutAction->setMenuRole(QAction::AboutRole); + ui->mExitAction->setMenuRole(QAction::QuitRole); + ui->mPreferencesAction->setMenuRole(QAction::PreferencesRole); + + connect(ui->mAboutAction, SIGNAL(triggered()), this, SLOT(about())); + connect(ui->mPreferencesAction, SIGNAL(triggered()), this, SLOT(preferences())); + + // Add Check for update to OS X application menu + ui->mCheckForUpdatesAction->setMenuRole(QAction::ApplicationSpecificRole); + + // Build tray icon if system support this one + if (QSystemTrayIcon::isSystemTrayAvailable() && mSettings->data()[KEY_SHOW_TRAY_ICON].toBool()) + initTrayIcon(); + + loadGeometry(); + + ui->mTaskTree->setSelectionBehavior(QAbstractItemView::SelectRows); + ui->mTaskTree->setFocus(); + ui->mTaskTree->setDragEnabled(true); + ui->mTaskTree->setAcceptDrops(true); + ui->mTaskTree->setDropIndicatorShown(true); + ui->mTaskTree->setDragDropMode(QAbstractItemView::InternalMove); + ui->mTaskTree->setAttribute(Qt::WA_MacShowFocusRect, false); + mCurrentIntervalLabel = new QLabel(); + ui->mStatusBar->addPermanentWidget(mCurrentIntervalLabel); + + mDuplicationSignalLabel = new QLabel(); + ui->mStatusBar->addPermanentWidget(mDuplicationSignalLabel); + + mModifiedLabel = new QLabel(); + ui->mStatusBar->addPermanentWidget(mModifiedLabel); + + mActivityTracker = QSharedPointer(new HIDActivityTracker()); + connect(mActivityTracker.data(), SIGNAL(idleDetected()), this, SLOT(idleDetected())); + connect(mActivityTracker.data(), SIGNAL(activityDetected()), this, SLOT(activityDetected())); + + // Configure toolbar + connect(ui->mMainToolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(toolbarVisibilityChanged(bool))); + QWidget *spacerWidget = new QWidget(this); + spacerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + spacerWidget->setVisible(true); + ui->mMainToolbar->addWidget(spacerWidget); + + mAttachmentsAction = new QAction(this); + mAttachmentsAction->setIcon(QIcon(":/icons/icons/mail-attachment.png")); + mAttachmentsAction->setText(tr("Attachments")); + //ui->mMainToolbar->addAction(mAttachmentsAction); + connect(mAttachmentsAction, SIGNAL(triggered()), this, SLOT(showAttachments())); + + mAttachmentsLabel = new QLabel(this); + mAttachmentsLabel->setMargin(5); + mAttachmentsLabel->setOpenExternalLinks(false); + QFont f = mAttachmentsLabel->font(); + f.setUnderline(true); + mAttachmentsLabel->setFont(f); + mAttachmentsLabel->setTextFormat(Qt::RichText); + //mAttachmentsLabel->setStyleSheet("QLabel { color:rgb(142,178,218); }"); + + QPalette newPal(palette()); + newPal.setColor(QPalette::Link, QColor(0x100, 0x100, 0x100)); + newPal.setColor(QPalette::LinkVisited, QColor(0x100, 0x100, 0x100)); + mAttachmentsLabel->setPalette(newPal); + + ui->mMainToolbar->addWidget(mAttachmentsLabel); + connect(mAttachmentsLabel, SIGNAL(linkActivated(QString)), this, SLOT(showAttachments())); + updateAttachmentsLabel(PTask()); + +#ifdef TARGET_OSX + mSleepTracker.install(); + connect(&mSleepTracker, SIGNAL(onSystemSleep()), this, SLOT(systemSleep())); + connect(&mSleepTracker, SIGNAL(onSystemResume()), this, SLOT(systemResume())); + installDockMenu(); +#endif + mTimeFrameHeight = 64;//ui->mTimeFrame->height(); + ui->mStartRecentTaskMenu->setEnabled(false); +} + +void MainWindow::save() +{ + // Flush current task + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + if (t) + { + t->setHtml(ui->mNoteEdit->document()->toPlainText()); + t->save(); + mModifiedLabel->setText(tr("Saved")); + } + + try + { + if (Storage::instance().isOpened()) + Storage::instance().save(); + saveGeometry(); + } + catch(std::exception& e) + {} + catch(...) + {} +} + +QSharedPointer MainWindow::getUndoStack() const +{ + QTextDocument* doc = ui->mNoteEdit->document(); + + return QSharedPointer(new QByteArray()); +} + +void MainWindow::saveGeometry() +{ + QRect geom = this->geometry(); + mSettings->data()[KEY_LEFT] = geom.left(); // "left" + mSettings->data()[KEY_TOP] = geom.top(); // "top" + mSettings->data()[KEY_WIDTH] = geom.width(); // "width" + mSettings->data()[KEY_HEIGHT] = geom.height(); // "height" + mSettings->data()[KEY_MAXIMIZED] = isMaximized(); // "maximized" + QList sizes = ui->mSplitter->sizes(); + if (!sizes.empty()) + { + mSettings->data()[KEY_SPLITTEROFFSET1] = sizes[0]; // ("splitter_offset1", sizes[0]); + mSettings->data()[KEY_SPLITTEROFFSET2] = sizes[1]; //("splitter_offset2", sizes[1]); + } + sizes = ui->mTimeSplitter->sizes(); + if (!sizes.empty()) + { + SETTINGS[KEY_TIMESPLITTER_OFFSET1] = sizes[0]; + SETTINGS[KEY_TIMESPLITTER_OFFSET2] = sizes[1]; + } + + if (mTaskTreeModel) + { + mSettings->data()[KEY_EXPANDED_TASKS] = this->mTaskTreeModel->getExpandedState(*ui->mTaskTree); + mSettings->data()[KEY_SELECTED_TASKS] = this->mTaskTreeModel->getSelected(*ui->mTaskTree); + } + + // Save recent list + QString recent; + for (PTask t: mRecentTrackingTasks) + { + recent += QString::number(t->id()) + ";"; + } + mSettings->data()[KEY_RECENT_TASKS] = recent; + mSettings->save(); +} + +void MainWindow::loadGeometry() +{ + QVariantMap& settings = mSettings->data(); + + QRect geom = this->geometry(); + if (settings.value(KEY_MAXIMIZED).toBool()) + this->showMaximized(); + else + { + if (settings.contains(KEY_LEFT)) + geom.setLeft(settings.value("left").toInt()); + if (settings.contains(KEY_TOP)) + geom.setTop(settings.value("top").toInt()); + if (settings.contains(KEY_WIDTH)) + geom.setWidth(settings.value(KEY_WIDTH).toInt()); + if (settings.contains(KEY_HEIGHT)) + geom.setHeight(settings.value(KEY_HEIGHT).toInt()); + setGeometry(geom); + } + + // Set splitter position + if (settings.contains(KEY_SPLITTEROFFSET1) && settings.contains(KEY_SPLITTEROFFSET2)) + { + QList sizes = ui->mSplitter->sizes(); + sizes[0] = settings.value(KEY_SPLITTEROFFSET1).toInt(); + sizes[1] = settings.value(KEY_SPLITTEROFFSET2).toInt(); + ui->mSplitter->setSizes(sizes); + } + + if (settings.contains(KEY_TIMESPLITTER_OFFSET1) && settings.contains(KEY_TIMESPLITTER_OFFSET2)) + { + QList sizes = ui->mTimeSplitter->sizes(); + sizes[0] = settings.value(KEY_TIMESPLITTER_OFFSET1).toInt(); + sizes[1] = settings.value(KEY_TIMESPLITTER_OFFSET2).toInt(); + ui->mTimeSplitter->setSizes(sizes); + } +} + +void MainWindow::sync() +{ + alertBox(APPNAME, NOTIMPLEMENTEDTEXT, AlertType_Warning); +} + +void MainWindow::closeEvent(QCloseEvent * ev) +{ + // Update DB if document was modified + if (ui->mNoteEdit->document()->isModified()) + { + // See if there is active selection + QModelIndex index = ui->mTaskTree->currentIndex(); + if (index.isValid()) + { + PTask task = mTaskTreeModel->getTask(index); + task->setHtml(ui->mNoteEdit->document()->toPlainText()); + task->save(); + } + } + + if (!mPasswordFailed) + save(); + + ev->accept(); +} + +void MainWindow::customEvent(QEvent *ev) +{ + switch (ev->type()) + { + case (QEvent::Type)ClientInitId: + // Process client initialization here + initClient(); + break; + + case (QEvent::Type)ClientCloseId: + close(); + break; + + case (QEvent::Type)AttachDatabaseId: + attachDatabase(); + break; + + case (QEvent::Type)SelectTaskId: + { + QModelIndex index = mTaskTreeModel->getIndex(dynamic_cast(ev)->task()); + if (index.isValid()) + { + ui->mTaskTree->setCurrentIndex(index); + } + break; + } + default: + break; + } +} + +void MainWindow::preferences() +{ + PreferencesDlg pref(this, *mSettings); + + if (pref.exec() == QDialog::Accepted) + { + // Changes are saved into settings already + // Repaint time labels if no tracking yet + QModelIndex index = ui->mTaskTree->currentIndex(); + PTask t = mTaskTreeModel->getTask(index); + + // Reset time text where needed + emit onTimeFormatChanged(); + + // Delete autosaved password if needed + if (mSettings->data()[KEY_AUTOSAVE_PASSWORD].toBool() == false) + { + mSettings->data()[KEY_PASSWORD] = NOPASSWORDSTRING; + mSettings->save(); + } + + // Hide/Show tray icon if need + if (mSettings->data()[KEY_SHOW_TRAY_ICON].toBool() && !mTrayIcon && QSystemTrayIcon::isSystemTrayAvailable()) + initTrayIcon(); + else + if (!mSettings->data()[KEY_SHOW_TRAY_ICON].toBool() && mTrayIcon) + removeTrayIcon(); + + updateData(); + } +} + +void MainWindow::about() +{ + AboutDlg dlg(this); + dlg.exec(); +} + +void MainWindow::quit() +{ + // TODO - check if stop on idle dialog runs now and stop on idle time + stopTracking(TSR_Manual); + + save(); +#ifdef TARGET_OSX + mSleepTracker.uninstall(); +#endif + close(); +} + +void MainWindow::newRootTask() +{ + PTask rootTask = mTaskTreeModel->addTask(QModelIndex(), Storage::instance().topOfTaskTree().size()); + QModelIndex rootIndex = mTaskTreeModel->getIndex(rootTask); + ui->mTaskTree->setCurrentIndex(rootIndex); + ui->mTaskTree->edit(rootIndex); +} + +void MainWindow::newTask() +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (index.isValid()) + ui->mTaskTree->expand(index); + PTask parent = mTaskTreeModel->getTask(index); + if (!parent) + return; + + PTask child = mTaskTreeModel->addTask(index, parent->children().size()); + if (!child) + return; + + QModelIndex childIndex = mTaskTreeModel->getIndex(child); + ui->mTaskTree->setCurrentIndex(childIndex); + ui->mTaskTree->edit(childIndex); +} + +void MainWindow::newSibling() +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + PTask currentTask = mTaskTreeModel->getTask(index); + if (!currentTask) + return; + + PTask t = mTaskTreeModel->addTask(index.parent(), index.row() + 1); + QModelIndex i = mTaskTreeModel->getIndex(t); + + ui->mTaskTree->setCurrentIndex(i); + ui->mTaskTree->edit(i); +} + +void MainWindow::moveUp() +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + + PTask currentTask = mTaskTreeModel->getTask(index); + if (!currentTask) + return; + + if (index.row() == 0) + return; + + mTaskTreeModel->moveTask(currentTask, -1); + ui->mTaskTree->setCurrentIndex(mTaskTreeModel->getIndex(currentTask)); +} + +void MainWindow::moveDown() +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + + PTask currentTask = mTaskTreeModel->getTask(index); + if (!currentTask) + return; + + if (currentTask->parent()) + { + if (index.row() == currentTask->parent()->children().size() - 1) + return; + } + else + if (index.row() == Storage::instance().topOfTaskTree().size() - 1) + return; + + mTaskTreeModel->moveTask(currentTask, +1); + ui->mTaskTree->setCurrentIndex(mTaskTreeModel->getIndex(currentTask)); +} + +void MainWindow::renameTask() +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (index.isValid()) + ui->mTaskTree->edit(index); +} + +void MainWindow::deleteTask() +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + + PTask t = mTaskTreeModel->getTask(index); + if (!t) + return; + + // Check if deleted task + if (mCurrentTask == t) + { + alertBox(tr("Problem"), tr("Impossible to delete active task. Please stop tracking before task delete."), AlertType_Warning); + } + else + { + if (mAutomaticTask == t) + mAutomaticTask.reset(); + + mTaskTreeModel->deleteTask(ui->mTaskTree->currentIndex()); + } +} + +void MainWindow::taskTreeContextualMenu(const QPoint& point) +{ + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + + QMenu* menu = new QMenu(); + menu->addAction(ui->mNewRootTaskAction); + menu->addAction(ui->mNewTaskAction); + menu->addAction(ui->mRenameTaskAction); + menu->addAction(ui->mDeleteTaskAction); + menu->addAction(ui->mMoveUpAction); + menu->addAction(ui->mMoveDownAction); + menu->addSeparator(); + menu->addAction(ui->mTimelineAction); + menu->addAction(mAttachmentsAction); + menu->addSeparator(); + if (t) + { + ui->mTimeTrackableAction->setChecked(!(t->flags() & Task::Flag_NoTimeTracking)); + menu->addAction(ui->mTimeTrackableAction); + } + //menu->addAction(tr("Add 10 mins to timeline"), this, SLOT(add10Mins())); + menu->exec(this->window()->mapToGlobal(point)); +} + +void MainWindow::taskIndexChanged(const QModelIndex& current, const QModelIndex& previous) +{ + PTask previousTask = mTaskTreeModel->getTask(previous); + if (previousTask) + { + if (ui->mNoteEdit->document()->isModified()) + { + // Copy modified text to task object + previousTask->setHtml(ui->mNoteEdit->document()->toPlainText()); + + // Flush new content to DB + previousTask->save(); + + // Remember corresponding QTextDocument also + // task->setUndoStack(ui->mNoteEdit->document()->getUndoStack()); + } + + // Update status bar + mModifiedLabel->setText(tr("Saved")); + + // Save cursor position + previousTask->setCursorPosition(ui->mNoteEdit->textCursor().position()); + + // Unload content + previousTask->unloadContent(previousTask != mCurrentTask); + } + + updateTrayIcon(Tray_SkipMessage); + + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + if (!mCurrentTask) + { + if (t) + ui->mStartOrStopTrackingAction->setText(tr("Start tracking ") + t->title()); + else + ui->mStartOrStopTrackingAction->setText(tr("Start tracking")); + } + + if (t) + { + mAttachmentsAction->setToolTip(tr("Attachments for ") + t->title()); + updateAttachmentsLabel(t); + } + + if (current.isValid()) + { + // Reset search position + mFindStartIndex = 0; + + // Load doc + PTask task = mTaskTreeModel->getTask(current); + if (task) + { + task->loadContent(); + + ui->mNoteEdit->document()->setPlainText(task->html()); + ui->mNoteEdit->document()->setModified(false); + + // Set cursor position to stored one + if (task->cursorPosition() <= task->html().length()) + { + QTextCursor tmpCursor = ui->mNoteEdit->textCursor(); + tmpCursor.setPosition(task->cursorPosition()); + ui->mNoteEdit->setTextCursor(tmpCursor); + ui->mNoteEdit->ensureCursorVisible(); + } + + mModifiedLabel->setText(tr("Saved")); + + // Enable / disable Move up / move down actions + ui->mMoveUpAction->setEnabled(current.row() > 0); + if (task->parent()) + ui->mMoveDownAction->setEnabled(current.row() < (task->parent()->children().size() - 1)); + else + ui->mMoveDownAction->setEnabled(current.row() < (Storage::instance().topOfTaskTree().size() - 1)); + + } + // Load corresponding undo stack + //ui->mNoteEdit->document()->setUndoStack(task->getUndoStack()); + + // Update total time + emit onTimeChanged(); + + // Set new timeline tree model + /*int w = ui->mTaskTimeTree->columnWidth(0); + ui->mTaskTimeTree->setModel(new TimeTreeModel(task->timeline(), *mSettings)); + ui->mTaskTimeTree->setColumnWidth(0, w);*/ + + // Show or hide time table depending on type of loaded task + handleTrackableState(task); + + ui->mTaskTree->selectionModel()->setCurrentIndex(current, QItemSelectionModel::SelectCurrent); + } +} + +void MainWindow::idleDetected() +{ + mActivityTracker->acceptIdleState(); + + // Check if settings allow smart stop + if (SETTINGS[KEY_SMART_STOP].toBool() && SETTINGS[KEY_SMART_STOP_MINUTES].toInt() > 0) + { + if (SETTINGS[KEY_ASK_STOP].toBool()) + { + // Stop activity tracker to not be confused with following user activity + mActivityTracker->stop(); + + StopWorkDialog* dlg = new StopWorkDialog(); + connect(dlg, SIGNAL(continueTracking()), this, SLOT(continueOnIdle())); + connect(dlg, SIGNAL(breakTracking(QDateTime)), this, SLOT(breakOnIdle(QDateTime))); + showTrayWindow(dlg); + } + else + stopTracking(TSR_Automatic); + } +} + +void MainWindow::activityDetected() +{ + mActivityTracker->acceptUserActiveState(); + + // Check if settings allow smart start + if (SETTINGS[KEY_SMART_START].toBool() && mStopReason == TSR_Automatic) + { + /*if (SETTINGS[KEY_ASK_START].toBool()) + { + StartWorkDialog* dlg = new StartWorkDialog(mAutomaticTask); + connect(dlg, SIGNAL(continueTracking()), this, SLOT(startOnActivity())); + connect(dlg, SIGNAL(breakTracking()), this, SLOT(stopOnActivity())); + showTrayWindow(dlg); + } + else*/ + { + startTracking(); + if (mTrayIcon) + mTrayIcon->showMessage(tr("Time tracking started"), mCurrentTask->path()); + } + } +} + +void MainWindow::handleTrackableState(PTask task) +{ + if (!task) + return; + + bool trackable = !(task->flags() & Task::Flag_NoTimeTracking); + if (!mCurrentTask) + ui->mStartOrStopTrackingAction->setEnabled(trackable); + QList sizes; + if (trackable) + { + sizes.push_back(ui->mTimeSplitter->height() - mTimeFrameHeight - ui->mTimeSplitter->handleWidth()); + sizes.push_back(mTimeFrameHeight); + ui->mTimeSplitter->setHandleWidth(7); + } + else + { + sizes.push_back(ui->mTimeSplitter->height() - ui->mTimeSplitter->handleWidth()); + sizes.push_back(0); + ui->mTimeSplitter->setHandleWidth(0); + } + ui->mTimeSplitter->setSizes(sizes); +} + +void MainWindow::prepareRecentTasksMenu(QMenu* submenu) +{ + submenu->clear(); + submenu->setEnabled(!mRecentTrackingTasks.empty()); + for (PTask t: mRecentTrackingTasks) + { + QAction* action = submenu->addAction(t->title(), this, SLOT(startTrackingRecent())); + action->setProperty("taskid", QVariant(t->id())); + } +} + +void MainWindow::updateAttachmentsLabel(PTask t) +{ + QString text = "" + tr("No attachments") + ""; + + if (t) + { + if (t->getAttachmentCount()) + text = "" + QString::number(t->getAttachmentCount()) + " " + tr("attachments") + ""; + } + mAttachmentsLabel->setText(text); +} + +void MainWindow::startOrStopTracking() +{ + if (!mCurrentTask) + { + // Forget about automatic start - it is manual start + mAutomaticTask.reset(); + startTracking(); + } + else + stopTracking(TSR_Manual); +} + +void MainWindow::startTracking(PTask t) +{ + if (t->flags() & Task::Flag_NoTimeTracking) + return; + + mCurrentTask = t; + + // Tell timeline to start + if (!t->timeline()) + t->loadContent(); + + mCurrentTask->timeline()->start(); + mLastTimelineFlush = QDateTime::currentDateTimeUtc(); + + // Update UI + ui->mStartOrStopTrackingAction->setText(tr("Stop tracking ") + mCurrentTask->title()); + QIcon icon(ACTION_STOP_ICON_NAME); + ui->mStartOrStopTrackingAction->setIcon(icon); + updateTrayIcon(Tray_ShowMessage); + + // Start activity tracker if needed + if (mSettings->data()[KEY_SMART_STOP].toBool() && mSettings->data()[KEY_SMART_STOP_MINUTES].toInt() > 0) + { + mActivityTracker->setInterval(mSettings->data()[KEY_SMART_STOP_MINUTES].toInt() * 60); + mActivityTracker->start(); + } +} + +void MainWindow::startTracking() +{ + // Start tracking if any task is selected + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + + // Trigger permission dialog if needed + if (mSettings->data()[KEY_SMART_STOP].toBool()) + { + if (!ActivityTrackerHelper::ensureSmartTrackingIsPossible()) + mTrayIcon->showMessage(tr("No smart tracking stop/start"), tr("Problem with obtaining permissions"), QSystemTrayIcon::Warning); + } + + // Get pointer to tracking task + PTask t; + if (mStopReason == TSR_Automatic && mAutomaticTask) + { + t = mAutomaticTask; + mAutomaticTask.reset(); + } + else + t = mTaskTreeModel->getTask(index); + + if (t) + startTracking(t); +} + +void MainWindow::startTrackingRecent() +{ + QObject* sender = QObject::sender(); + if (dynamic_cast(sender)) + { + QVariant taskId = sender->property("taskid"); + if (taskId.isValid() && !taskId.isNull()) + { + PTask t = Storage::instance().findTaskById(taskId.toULongLong()); + if (t) + { + if (mCurrentTask) + stopTracking(TSR_Manual); + + startTracking(t); + } + } + } +} + +void MainWindow::stopTracking(TrackingStopReason reason, const QDateTime& currentUtc) +{ + // Check if false call + if (!mCurrentTask) + return; + + // Save stop reason + mStopReason = reason; + + // If stopping due to idle detection - save current task + if (reason == TSR_Automatic) + mAutomaticTask = mCurrentTask; + + + // Tell current task to stop + mCurrentTask->timeline()->flush(true /* save to DB */, currentUtc); + mCurrentTask->timeline()->stop(false /* do not update timeline - it is done in the previous line */); + + // Save stopped task name + QString stoppedTaskName = mCurrentTask->path(); + + // Update recent tracking tasks menu + std::deque::iterator taskIter = std::find(mRecentTrackingTasks.begin(), mRecentTrackingTasks.end(), mCurrentTask); + if (taskIter == mRecentTrackingTasks.end()) + { + mRecentTrackingTasks.push_front(mCurrentTask); + if (mRecentTrackingTasks.size() > 7) + mRecentTrackingTasks.pop_back(); + } + else + { + mRecentTrackingTasks.erase(taskIter); + mRecentTrackingTasks.push_front(mCurrentTask); + } + + // Update UI + prepareRecentTasksMenu(ui->mStartRecentTaskMenu); + if (mDockRecentMenu) + prepareRecentTasksMenu(mDockRecentMenu); + + // Reset pointer to current task + mCurrentTask.clear(); + + // Update UI + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + if (t) + ui->mStartOrStopTrackingAction->setText(tr("Start tracking ") + t->title()); + else + ui->mStartOrStopTrackingAction->setText(tr("Start tracking")); + + QIcon icon(ACTION_START_ICON_NAME); + ui->mStartOrStopTrackingAction->setIcon(icon); + + if (mTrayIcon) + { + updateTrayIcon(Tray_SkipMessage); + + if (reason == TSR_Automatic) + mTrayIcon->showMessage(tr("Time tracking stopped due to inactivity."), tr("Idle interval detected for ") + stoppedTaskName); + else + mTrayIcon->showMessage(tr("Time tracking stopped"), stoppedTaskName); + } + + if (mCurrentIntervalLabel) + mCurrentIntervalLabel->setText(""); + + if (reason == TSR_Manual) + mActivityTracker->stop(); + + // Ensure start/stop buttons are enabled or disabled properly + handleTrackableState(t); +} + +void MainWindow::updateData() +{ + // Update editor icons + bool taskLoaded = ui->mTaskTree->currentIndex().isValid(); + bool hasSelection = ui->mNoteEdit->textCursor().hasSelection(); + bool inEditor = (ui->mNoteEdit->hasFocus()); + + bool editCanUndo = ui->mNoteEdit->document()->availableUndoSteps(); + bool editCanRedo = ui->mNoteEdit->document()->availableRedoSteps(); + + ui->mUndoEditAction->setEnabled((taskLoaded & inEditor && editCanUndo) || ChangesHistory::instance().canUndo()); + ui->mRedoEditAction->setEnabled((taskLoaded & inEditor && editCanRedo) || ChangesHistory::instance().canRedo()); + ui->mSelectAllEditAction->setEnabled(taskLoaded && inEditor); + ui->mCutEditAction->setEnabled(hasSelection & taskLoaded && inEditor); + ui->mPasteEditAction->setEnabled(ui->mNoteEdit->canPaste() & taskLoaded && inEditor); + ui->mCopyEditAction->setEnabled( hasSelection & taskLoaded && inEditor); + + if (mCurrentTask) + { + // Ok, smth is tracking now + + // Save current time on tracking task + QDateTime current = QDateTime::currentDateTimeUtc(); + bool saveToDb = mLastTimelineFlush.secsTo(current) >= TIMELINE_FLUSH_INTERVAL; + + if (saveToDb) + mLogger->log("Flushing timeline to DB start"); + mCurrentTask->timeline()->flush(saveToDb, QDateTime::currentDateTimeUtc()); + if (saveToDb) + { + mLastTimelineFlush = QDateTime::currentDateTimeUtc(); + mLogger->log("Flushing timeline to DB end"); + } + + // Check if duplication detected + bool duplication = mCurrentTask->timeline()->duplicateDetected(); + mDuplicationSignalLabel->setText(duplication ? tr("Duplication detected") : tr("")); + + // Tell subscribers about changed time + //mLogger->log("Sending onTimeChanged() signal begin"); + emit onTimeChanged(); + //mLogger->log("Sending onTimeChanged() signal end"); + } + + if (ui->mNoteEdit->document() && taskLoaded) + { + if (ui->mNoteEdit->document()->isModified()) + { + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + if (t && QDateTime::currentDateTimeUtc().secsTo(mTextModificationTime) <= -TEXT_FLUSH_INTERVAL) + { + t->setHtml(ui->mNoteEdit->document()->toPlainText()); + t->save(); + ui->mNoteEdit->document()->setModified(false); + mModifiedLabel->setText(tr("Saved")); + mTextModificationTime = QDateTime(); + } + } + } +} + +void MainWindow::add10Mins() +{ + // Start tracking if any task is selected + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + + // Get current task + PTask t = mTaskTreeModel->getTask(index); + t->timeline()->load(); + t->timeline()->putDebugRecord(); +} + +void MainWindow::applyTextFormat(const QTextCharFormat& fmt) +{ + QTextCursor c = ui->mNoteEdit->textCursor(); + if (c.hasSelection()) + { + c.mergeCharFormat(fmt); + ui->mNoteEdit->mergeCurrentCharFormat(fmt); + } + else + { + QTextCharFormat f = ui->mNoteEdit->currentCharFormat(); + f.merge(fmt); + ui->mNoteEdit->setCurrentCharFormat(f); + } +} + +void MainWindow::print() +{ + QTextDocument *document = ui->mNoteEdit->document(); + QPrinter printer; + + QPrintDialog *dlg = new QPrintDialog(&printer, this); + if (dlg->exec() != QDialog::Accepted) + return; + + document->print(&printer); +} + +void MainWindow::editSelectionChanged() +{ + +} +void MainWindow::editPositionChanged() +{ + +} +void MainWindow::editFormatChanged(const QTextCharFormat& /*fmt*/) +{ +} + +void MainWindow::editUndo() +{ + if (ui->mNoteEdit->hasFocus()) + { + ui->mNoteEdit->undo(); + } + else + if (ChangesHistory::instance().canUndo()) + ChangesHistory::instance().undo(); +} + +void MainWindow::editRedo() +{ + if (ui->mNoteEdit->hasFocus()) + { + ui->mNoteEdit->redo(); + } + else + if (ChangesHistory::instance().canRedo()) + ChangesHistory::instance().redo(); +} + +void MainWindow::editCut() +{ + ui->mNoteEdit->cut(); +} +void MainWindow::editCopy() +{ + ui->mNoteEdit->copy(); +} +void MainWindow::editPaste() +{ + ui->mNoteEdit->paste(); +} +void MainWindow::editDelete() +{ + ui->mNoteEdit->clear(); +} +void MainWindow::editSelectAll() +{ + ui->mNoteEdit->selectAll(); +} + +void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) +{ + switch (reason) + { + case QSystemTrayIcon::Trigger: + case QSystemTrayIcon::DoubleClick: + //showTrayWindow(); + trayContextualMenu(); + /*if (ui->mStartOrStopTrackingAction->isEnabled()) + startOrStopTracking();*/ + break; + + default: + ; + } +} + +void MainWindow::trayContextualMenu() +{ + // Build context menu for tray icon + QMenu* menu = new QMenu(); + menu->addAction(ui->mStartOrStopTrackingAction); + QMenu* recentMenu = menu->addMenu(ui->mStartRecentTaskMenu->title()); + recentMenu->setIcon(QIcon(":/icons/icons/empty.png")); + prepareRecentTasksMenu(recentMenu); + menu->addAction(ui->mShowLittAction); + //menu->addAction(ui->mPreferencesAction); + //connect(menu, SIGNAL(aboutToHide()), this, SLOT(recoverTrayIcon())); + mTrayIcon->setContextMenu(menu); +} + +int MainWindow::showTrayWindow(QDialog* dlg) +{ + if (!dlg) + return -1; + + // Delete old window (if it exists) + if (mTrayWindow) + delete mTrayWindow; + mTrayWindow = dlg; + connect(mTrayWindow, SIGNAL(destroyed(QObject*)), this, SLOT(trayWindowDestroyed(QObject*))); + dlg->setModal(false); + + int w = dlg->geometry().width(); + int h = dlg->geometry().height(); + QRect rec = QApplication::desktop()->screenGeometry(); + int desktopHeight = rec.height(); + int desktopWidth = rec.width(); + + QRect iconRect; + if (mTrayIcon) + iconRect = mTrayIcon->geometry(); + else + iconRect = QRect(desktopWidth - w - 10, 0, 24, 24); + +#ifdef TARGET_OSX + QRect windowRect(desktopWidth - w - 10, iconRect.bottom() + 10, w, h); +#endif +#ifdef TARGET_WIN + +#endif + dlg->setGeometry(windowRect); + dlg->setVisible(true); + dlg->show(); + dlg->raise(); + dlg->activateWindow(); + +/* +#ifdef TARGET_WIN + Qt::WindowFlags eFlags = windowFlags (); + eFlags |= Qt::WindowStaysOnTopHint; + setWindowFlags(eFlags); + eFlags &= ~Qt::WindowStaysOnTopHint; + setWindowFlags(eFlags); + show(); +#endif +*/ + return 0; +} + +void MainWindow::installDockMenu() +{ + QMenu* menu = new QMenu(); + menu->addAction(ui->mStartOrStopTrackingAction); + mDockRecentMenu = menu->addMenu(ui->mStartRecentTaskMenu->title()); + mDockRecentMenu->setIcon(QIcon(":/icons/icons/empty.png")); + prepareRecentTasksMenu(mDockRecentMenu); + + qt_mac_set_dock_menu(menu); +} + +void MainWindow::timeFormatChanged() +{ + // If there is selected task + showTimeForSelectedTask(); + + // Show stats for tracking task in status bar + showTimeForTrackingTask(); +} + + +void MainWindow::showTimeForSelectedTask() +{ + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + bool showSeconds = mSettings->data()[KEY_SHOW_SECONDS].toBool(); + + // Show stats for current task + if (t) + { + if (!t->timeline()) + t->loadContent(); + + int spentSecondsToday = t->timeline()->today(); + int spentSecondsMonth = t->timeline()->month(); + ui->mTodaySpentTimeLabel->setText(TimeHelper::secondsToDisplay(spentSecondsToday, showSeconds)); + ui->mThisMonthSpentTimeLabel->setText(TimeHelper::secondsToDisplay(spentSecondsMonth, showSeconds)); + } +} + +void MainWindow::showTimeForTrackingTask() +{ + if (mCurrentTask) + { + bool showSeconds = mSettings->data()[KEY_SHOW_SECONDS].toBool(); + + // Update status bar + QString path; + PTask t = mCurrentTask; + while (t) + { + path.insert(0, " / " + t->title()); + t = t->parent(); + } + int spentSecondsToday = mCurrentTask->timeline()->today(); + QString timeString = TimeHelper::secondsToDisplay(spentSecondsToday, showSeconds); + path += " : " + timeString; + mCurrentIntervalLabel->setText(path); + + if (mTrayIcon) + { + QString tooltip = tr("Litt is tracking ") + mCurrentTask->title() + ".\n" + + tr("Time spent today for this task is ") + timeString; + + mTrayIcon->setToolTip(tooltip); + } + } +} + +void MainWindow::initTrayIcon() +{ + if (QSystemTrayIcon::isSystemTrayAvailable() && !mTrayIcon) + { + mTrayIcon = new QSystemTrayIcon(); + connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); + updateTrayIcon(Tray_ShowMessage); + + mTrayIcon->setVisible(true); + } +} + +void MainWindow::removeTrayIcon() +{ + if (mTrayIcon) + { + delete mTrayIcon; + mTrayIcon = nullptr; + } +} + +void MainWindow::updateTrayIcon(TrayShowMessage flag) +{ + if (!mTrayIcon) + return; + + QString tooltip; + if (mCurrentTask) + { + bool showSeconds = mSettings->data()[KEY_SHOW_SECONDS].toBool(); + int spentSecondsToday = mCurrentTask->timeline()->today(); + QString timeString = TimeHelper::secondsToDisplay(spentSecondsToday, showSeconds); + tooltip = tr("Litt is tracking ") + mCurrentTask->title() + ".\n" + + tr("Time spent today for this task is ") + timeString; + } + else + { + tooltip = tr("Litt is not tracking now."); + } + + mTrayIcon->setToolTip(tooltip); + + if (mCurrentTask) + { + QIcon icon(TRAY_RUNNING_ICON_NAME); +#if defined(TARGET_OSX) + icon.setIsMask(true); +#endif + mTrayIcon->setIcon(icon); + if (flag == Tray_ShowMessage) + mTrayIcon->showMessage(tr("Time tracking started"), mCurrentTask->path()); + } + else + { + QIcon icon(TRAY_DEFAULT_ICON_NAME); +#if defined(TARGET_OSX) + icon.setIsMask(true); +#endif + mTrayIcon->setIcon(icon); + } +} + +void MainWindow::showTimeline() +{ + if (!ui->mTaskTree->currentIndex().isValid()) + return; + + PTask t = mTaskTreeModel->getTask(ui->mTaskTree->currentIndex()); + TimeTreeDlg dlg(this, t->timeline(), *mSettings); + dlg.exec(); + + // Refresh current timeline stats + showTimeForSelectedTask(); +} + +void MainWindow::showTimeReport() +{ + TimeReportWizard trz(*mSettings, this); + trz.exec(); +} + +void MainWindow::newPasswordDialogFinished(int status) +{ + if (status == QDialog::Accepted) + { + Storage::instance().setKey(mNewPasswordDlg->password()); + if (!Storage::instance().create()) + { + // Quit application + mPasswordFailed = true; + alertBox(tr("Error"), tr("Failed to initialize database"), AlertType_Critical); + } + + // Remember password if it is specified in settings + if (mSettings->data()[KEY_AUTOSAVE_PASSWORD].toBool()) + mSettings->data()[KEY_PASSWORD] = mNewPasswordDlg->password(); + else + mSettings->data()[KEY_PASSWORD] = NOPASSWORDSTRING; + + // Flush settings + mSettings->save(); + + connectUiToDatabase(); + } + else + close(); +} + +void MainWindow::passwordDialogFinished(int status) +{ + QString password; + if (status == QDialog::Accepted) + { + password = mPasswordDlg->password(); + openDatabase(password); + connectUiToDatabase(); + } + else + { + mPasswordFailed = false; + QApplication::postEvent(this, new ClientCloseEvent()); + } +} + +void MainWindow::criticalAlertFinished(int /*status*/) +{ + QApplication::postEvent(this, new ClientCloseEvent()); +} + +void MainWindow::openAlertFinished(int /*status*/) +{ + mPasswordDlg = new PasswordDlg(this); + connect(mPasswordDlg, SIGNAL(finished(int)), this, SLOT(passwordDialogFinished(int))); + mPasswordDlg->show(); +} + +void MainWindow::warningAlertFinished(int /*status*/) +{ +} + +void MainWindow::toolbarVisibilityChanged(bool visible) +{ + ui->mShowToolbarAction->setChecked(visible); +} + +void MainWindow::showHideToolbar() +{ + ui->mMainToolbar->setVisible(ui->mShowToolbarAction->isChecked()); +} + +void MainWindow::showAttachments() +{ + QModelIndex taskIndex = ui->mTaskTree->currentIndex(); + if (!taskIndex.isValid()) + return; + + PTask t = mTaskTreeModel->getTask(taskIndex); + AttachmentsDialog dlg(t, this); + dlg.exec(); + + // Refresh current item in task tree to ensure attachment icon is shown/hidden + mTaskTreeModel->dataChanged(taskIndex, taskIndex); + + // Refresh attachments link + updateAttachmentsLabel(t); +} + +void MainWindow::checkForUpdates() +{ + FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent(); +} + +void MainWindow::systemSleep() +{ + //qDebug() << "System goes to sleep"; + stopTracking(TSR_Automatic, QDateTime::currentDateTimeUtc()); +} + +void MainWindow::systemResume() +{ + //qDebug() << "System raised from sleep"; + if (mStopReason == TSR_Automatic) + startTracking(); +} + +void MainWindow::changeTimeTrackableFlag(bool trackable) +{ + QModelIndex index = ui->mTaskTree->currentIndex(); + if (!index.isValid()) + return; + + PTask t = mTaskTreeModel->getTask(index); + if (!t) + return; + + if (trackable) + t->setFlags(t->flags() & ~Task::Flag_NoTimeTracking ); + else + t->setFlags(t->flags() | Task::Flag_NoTimeTracking ); + + // Stop task if it is marked as non tracking and it is running now + if (!trackable && mCurrentTask == t) + stopTracking(TSR_Manual, QDateTime::currentDateTimeUtc()); + + // Update UI + handleTrackableState(t); +} + +void MainWindow::find() +{ + ui->mFindFrame->setVisible(true); + ui->mFindEdit->setFocus(); +} + +void MainWindow::findInTasks() +{ + if (mFindInTasksDlg.exec() == QDialog::Accepted) + { + FindResultItem& r = mFindInTasksDlg.getResult(); + if (r.mTask) + { + // Find task in row and load its content to edit control + QModelIndex taskIndex = mTaskTreeModel->getIndex(r.mTask); + if (taskIndex.isValid()) + { + ui->mTaskTree->setCurrentIndex(taskIndex); + QTextCursor c = ui->mNoteEdit->document()->find(r.mFoundWord, 0); + if (!c.isNull()) + ui->mNoteEdit->setTextCursor(c); + } + } + } +} + +void MainWindow::findRequested() +{ + QString pattern = ui->mFindEdit->text(); + if (pattern.isEmpty()) + return; + + if (pattern != mFindPattern) + { + mFindPattern = pattern; + mFindStartIndex = 0; + } + + //ui->mFindEdit->setVisible(false); + QTextCursor c = ui->mNoteEdit->document()->find(pattern, mFindStartIndex, 0); + if (c.isNull()) + { + mFindStartIndex = 0; + c = ui->mNoteEdit->document()->find(pattern, mFindStartIndex, 0); + } + if (!c.isNull()) + { + //c.select(QTextCursor::BlockUnderCursor); + ui->mNoteEdit->setTextCursor(c); + mFindStartIndex = c.position() + 1; + } +} + +void MainWindow::findRejected(QObject* obj) +{ + if (obj == ui->mFindEdit) + { + ui->mFindFrame->setVisible(false); + ui->mNoteEdit->setFocus(); + } +} + +void MainWindow::taskTextChanged() +{ + mModifiedLabel->setText(tr("Modified")); + if (mTextModificationTime.isNull()) + mTextModificationTime = QDateTime::currentDateTimeUtc(); +} + +void MainWindow::taskMoved(PTask task) +{ + QApplication::postEvent(this, new SelectTaskEvent(task)); + + //QModelIndex index = mTaskTreeModel->getIndex(task); + + //if (index.isValid()) + // ui->mTaskTree->setCurrentIndex(index); +} + +void MainWindow::focusTaskTree() +{ + ui->mTaskTree->setFocus(); +} + +void MainWindow::focusTaskText() +{ + ui->mNoteEdit->setFocus(); +} + +void MainWindow::showMainWindow() +{ + this->show(); + this->raise(); + this->activateWindow(); + +#ifdef TARGET_OSX +#endif + +#ifdef TARGET_WIN + Qt::WindowFlags eFlags = windowFlags (); + eFlags |= Qt::WindowStaysOnTopHint; + setWindowFlags(eFlags); + eFlags &= ~Qt::WindowStaysOnTopHint; + setWindowFlags(eFlags); + show(); +#endif +} + +void MainWindow::continueOnIdle() +{ + // Disable idle detection at all - it is not needed in this session anymore + mActivityTracker->stop(); +} + +void MainWindow::breakOnIdle(const QDateTime& stopTime) +{ + // Stop tracking + stopTracking(TSR_Manual, stopTime); + showTimeForSelectedTask(); +} + +void MainWindow::startOnActivity() +{ + // Start tracking + startTracking(); + + // Show message if needed + if (mTrayIcon) + mTrayIcon->showMessage(tr("Time tracking started"), mCurrentTask->path()); +} + +void MainWindow::stopOnActivity() +{ + stopTracking(TSR_Manual); +} + +void MainWindow::trayWindowDestroyed(QObject *object) +{ + mTrayWindow = nullptr; +} diff --git a/client/mainwindow.h b/client/mainwindow.h new file mode 100644 index 0000000..475ce38 --- /dev/null +++ b/client/mainwindow.h @@ -0,0 +1,212 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include +#include +#include +#include +#include +#include + +#include "tasktreemodel.h" +#include "settings.h" +#include "passworddlg.h" +#include "newpassworddlg.h" +#include "logger.h" +#include "platforms/hidtracker.h" +#include "finddialog.h" +#include + +#ifdef TARGET_OSX +# include "platforms/osx/sleeptracker_osx.h" +#endif + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); +protected: + void closeEvent(QCloseEvent *); + void customEvent(QEvent *); + +private: + enum TrackingStopReason + { + TSR_None, // Used to init only + TSR_Manual, + TSR_Automatic + }; + + QSharedPointer mLogger; + QSharedPointer mActivityTracker; + TrackingStopReason mStopReason; + + Ui::MainWindow *ui; + TaskTreeModel* mTaskTreeModel; + PTask mCurrentTask, mAutomaticTask; + QTimer* mUpdateTimer; + QLabel* mModifiedLabel; + QLabel* mCurrentIntervalLabel; + QLabel* mDuplicationSignalLabel; + QSystemTrayIcon *mTrayIcon; + QSharedPointer mSettings; + bool mPasswordFailed; + PasswordDlg* mPasswordDlg; + NewPasswordDlg* mNewPasswordDlg; + QMessageBox* mAlertBox; + + // Time when current note was saved to DB last time + QDateTime mLastTimelineFlush; + + // Attachments action + QAction* mAttachmentsAction; + + // Attachments label + QLabel* mAttachmentsLabel; + + // Delegate to draw task items in custom way + TaskItemDelegate mTaskItemDelegate; + + // Find text in document start index + int mFindStartIndex; + QString mFindPattern; + FindInTasksDialog mFindInTasksDlg; + +#ifdef TARGET_OSX + SleepTracker mSleepTracker; +#endif + QSharedPointer getUndoStack() const; + int mTimeFrameHeight; + + QDateTime mTextModificationTime; + std::deque mRecentTrackingTasks; + QMenu* mDockRecentMenu; + QDialog* mTrayWindow = nullptr; + + void saveGeometry(); + void loadGeometry(); + void applyTextFormat(const QTextCharFormat& fmt); + void initClient(); + + // Checks if database exists, requests passwords etc. + void attachDatabase(); + + // Just open database via Storage::instance() + void openDatabase(const QString& password); + + // Creates task tree model, adjusts UI + void connectUiToDatabase(); + + // Shows window with alert text and button OK + enum AlertType + { + AlertType_Warning, + AlertType_Critical, + AlertType_CannotOpen + }; + + void alertBox(const QString& title, const QString& text, AlertType alertType); + + void showTimeForSelectedTask(); + void showTimeForTrackingTask(); + void initTrayIcon(); + void removeTrayIcon(); + + enum TrayShowMessage + { + Tray_ShowMessage = 0, + Tray_SkipMessage = 1 + }; + void updateTrayIcon(TrayShowMessage flag); + void handleTrackableState(PTask task); + void trayContextualMenu(); + int showTrayWindow(QDialog* dlg); + void installDockMenu(); + void startTracking(PTask t); + void prepareRecentTasksMenu(QMenu* submenu); + void updateAttachmentsLabel(PTask t); + +signals: + void onTimeFormatChanged(); + void onTimeChanged(); + +public slots: + void save(); + void sync(); + void about(); + void preferences(); + void print(); + void quit(); + void newRootTask(); + void newTask(); + void newSibling(); + void moveUp(); + void moveDown(); + void renameTask(); + void deleteTask(); + void taskTreeContextualMenu(const QPoint& point); + void taskIndexChanged(const QModelIndex&, const QModelIndex&); + void idleDetected(); + void activityDetected(); + void startOrStopTracking(); + void startTracking(); + void startTrackingRecent(); + + void stopTracking(TrackingStopReason reason, const QDateTime& currentUtc = QDateTime::currentDateTimeUtc()); + void updateData(); + void add10Mins(); + + void editSelectionChanged(); + void editPositionChanged(); + void editFormatChanged(const QTextCharFormat& fmt); + + void editUndo(); + void editRedo(); + void editCut(); + void editCopy(); + void editPaste(); + void editDelete(); + void editSelectAll(); + + void iconActivated(QSystemTrayIcon::ActivationReason reason); + void timeFormatChanged(); + void showTimeline(); + void showTimeReport(); + + void newPasswordDialogFinished(int status); + void passwordDialogFinished(int status); + void criticalAlertFinished(int status); + void openAlertFinished(int status); + void warningAlertFinished(int status); + void toolbarVisibilityChanged(bool visible); + void showHideToolbar(); + void showAttachments(); + void checkForUpdates(); + void systemSleep(); + void systemResume(); + void changeTimeTrackableFlag(bool trackable); + void find(); + void findInTasks(); + void findRequested(); + void findRejected(QObject* obj); + void taskTextChanged(); + void taskMoved(PTask task); + void focusTaskTree(); + void focusTaskText(); + void showMainWindow(); + void continueOnIdle(); + void breakOnIdle(const QDateTime& stopTime); + void startOnActivity(); + void stopOnActivity(); + void trayWindowDestroyed(QObject* object); +}; + +#endif // MAINWINDOW_H diff --git a/client/mainwindow.qrc b/client/mainwindow.qrc new file mode 100644 index 0000000..b48bab0 --- /dev/null +++ b/client/mainwindow.qrc @@ -0,0 +1,62 @@ + + + + icons/document-new.png + icons/document-print.png + icons/document-save.png + icons/edit-clear.png + icons/edit-copy.png + icons/edit-cut.png + icons/edit-delete.png + icons/edit-find.png + icons/edit-find-replace.png + icons/edit-paste.png + icons/edit-redo.png + icons/edit-select-all.png + icons/edit-undo.png + icons/folder.png + icons/folder-new.png + icons/folder-open.png + icons/format-indent-less.png + icons/format-indent-more.png + icons/format-justify-center.png + icons/format-justify-fill.png + icons/format-justify-left.png + icons/format-justify-right.png + icons/format-text-bold.png + icons/format-text-italic.png + icons/format-text-strikethrough.png + icons/format-text-underline.png + icons/list-add.png + icons/list-remove.png + icons/media-playback-start.png + icons/media-playback-stop.png + icons/network-error.png + icons/network-receive.png + icons/network-transmit.png + icons/software-update-available.png + icons/text-x-generic.png + icons/empty.png + icons/starttracking-osx.png + icons/stoptracking-osx.png + icons/mail-attachment.png + icons/appointment-new.png + icons/accessories-calculator.png + icons/office-calendar.png + icons/tray-default.png + icons/tray-running.png + icons/folder-saved-search.png + icons/applications-development.png + icons/dialog-error.png + icons/emblem-system.png + icons/preferences-system.png + icons/process-stop.png + icons/system-search.png + icons/tree-add-child-small.png + icons/tree-add-child.png + icons/tree-add-root-small.png + icons/tree-add-root.png + icons/clock-32x32.png + icons/tree-add-sibling-small.png + + diff --git a/client/mainwindow.ui b/client/mainwindow.ui new file mode 100644 index 0000000..3cd5b8f --- /dev/null +++ b/client/mainwindow.ui @@ -0,0 +1,1315 @@ + + + MainWindow + + + + 0 + 0 + 647 + 508 + + + + + 0 + 0 + + + + Litt + + + + + 0 + 0 + + + + + QLayout::SetMaximumSize + + + 2 + + + 2 + + + 2 + + + 2 + + + + + + 0 + 0 + + + + + 600 + 200 + + + + Qt::Horizontal + + + + Qt::CustomContextMenu + + + true + + + QAbstractItemView::InternalMove + + + Qt::MoveAction + + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 0 + + + Qt::Vertical + + + + QFrame::StyledPanel + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + + false + + + background-color:white; + + + QFrame::NoFrame + + + QFrame::Raised + + + 0 + + + + 5 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Find: + + + + + + + + + + + + + + + 16777215 + 70 + + + + QFrame::StyledPanel + + + + + + Today: + + + + + + + 0 hours 0 minutes + + + + + + + This month: + + + + + + + 0 hours 0 minutes + + + + + + + + + + + + + + + + + 0 + 0 + 647 + 22 + + + + + &File + + + + + + + + + + + + + Edit + + + + + + + + + + + + + + + + + + + + + + + &Tools + + + + Track recent task + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + + + + + + + + + + + View + + + + + + + + + + + Qt::NoContextMenu + + + Toolbar + + + false + + + false + + + TopToolBarArea + + + false + + + + + + + + + + + false + + + + :/icons/icons/network-receive.png:/icons/icons/network-receive.png + + + S&ync... + + + false + + + + + + :/icons/icons/document-print.png:/icons/icons/document-print.png + + + &Print... + + + + + E&xit + + + + + Pre&ferences... + + + + + + :/icons/icons/document-save.png:/icons/icons/document-save.png + + + &Save + + + Ctrl+S + + + + + + :/icons/icons/list-remove.png:/icons/icons/list-remove.png + + + Delete task + + + Delete task + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Rename task + + + + + + :/icons/icons/tree-add-child-small.png:/icons/icons/tree-add-child-small.png + + + New child task + + + New child task + + + New child task + + + Ctrl+Shift+N + + + + + + :/icons/icons/tree-add-root-small.png:/icons/icons/tree-add-root-small.png + + + New root task + + + Ctrl+N + + + + + + :/icons/icons/clock-32x32.png:/icons/icons/clock-32x32.png + + + Start tracking + + + Ctrl+T + + + + + + :/icons/icons/edit-undo.png:/icons/icons/edit-undo.png + + + Undo + + + Ctrl+Z + + + + + + :/icons/icons/edit-redo.png:/icons/icons/edit-redo.png + + + Redo + + + Ctrl+Shift+Z + + + + + + :/icons/icons/edit-cut.png:/icons/icons/edit-cut.png + + + Cut + + + Ctrl+X + + + + + + :/icons/icons/edit-copy.png:/icons/icons/edit-copy.png + + + Copy + + + Ctrl+C + + + + + + :/icons/icons/edit-paste.png:/icons/icons/edit-paste.png + + + Paste + + + Ctrl+V + + + + + + :/icons/icons/edit-clear.png:/icons/icons/edit-clear.png + + + Delete + + + + + + :/icons/icons/edit-select-all.png:/icons/icons/edit-select-all.png + + + Select all note + + + Ctrl+A + + + + + About... + + + + + + :/icons/icons/office-calendar.png:/icons/icons/office-calendar.png + + + Timeline... + + + + + + :/icons/icons/appointment-new.png:/icons/icons/appointment-new.png + + + Time report... + + + + + true + + + true + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Show toolbar + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Attachments + + + View&edit attachments + + + + + Check for updates... + + + + + true + + + + :/icons/icons/accessories-calculator.png:/icons/icons/accessories-calculator.png + + + Time trackable + + + + + + :/icons/icons/folder-saved-search.png:/icons/icons/folder-saved-search.png + + + Find in tasks... + + + Ctrl+Shift+F + + + + + + :/icons/icons/edit-find.png:/icons/icons/edit-find.png + + + Find... + + + Ctrl+F + + + + + + :/icons/icons/format-justify-fill.png:/icons/icons/format-justify-fill.png + + + Show Litt window + + + Bring Litt window to foreground + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Switch to task tree + + + Ctrl+1 + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Switch to task text + + + Ctrl+2 + + + + + + :/icons/icons/tree-add-sibling-small.png:/icons/icons/tree-add-sibling-small.png + + + Add sibling + + + Add sibling document + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Decrease level + + + Decrease document level + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Increase level + + + Increase document level + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Move up + + + Move document up + + + Ctrl+Shift+Up + + + + + + :/icons/icons/empty.png:/icons/icons/empty.png + + + Move down + + + Move document down + + + Ctrl+Shift+Down + + + + + + + TaskTreeView + QTreeView +
tasktreemodel.h
+
+
+ + + + + + mExitAction + triggered() + MainWindow + quit() + + + -1 + -1 + + + 323 + 253 + + + + + mSaveAction + triggered() + MainWindow + save() + + + -1 + -1 + + + 323 + 253 + + + + + mSyncAction + triggered() + MainWindow + sync() + + + -1 + -1 + + + 323 + 253 + + + + + mTaskTree + customContextMenuRequested(QPoint) + MainWindow + taskTreeContextualMenu(QPoint) + + + 152 + 262 + + + 323 + 253 + + + + + mNewTaskAction + triggered() + MainWindow + newTask() + + + -1 + -1 + + + 323 + 253 + + + + + mRenameTaskAction + triggered() + MainWindow + renameTask() + + + -1 + -1 + + + 323 + 253 + + + + + mDeleteTaskAction + triggered() + MainWindow + deleteTask() + + + -1 + -1 + + + 323 + 253 + + + + + mNewRootTaskAction + triggered() + MainWindow + newRootTask() + + + -1 + -1 + + + 323 + 253 + + + + + mStartOrStopTrackingAction + triggered() + MainWindow + startOrStopTracking() + + + -1 + -1 + + + 323 + 253 + + + + + mPrintAction + triggered() + MainWindow + print() + + + -1 + -1 + + + 323 + 253 + + + + + mCopyEditAction + triggered() + MainWindow + editCopy() + + + -1 + -1 + + + 323 + 253 + + + + + mCutEditAction + triggered() + MainWindow + editCut() + + + -1 + -1 + + + 323 + 253 + + + + + mDeleteEditAction + triggered() + MainWindow + editDelete() + + + -1 + -1 + + + 323 + 253 + + + + + mPasteEditAction + triggered() + MainWindow + editPaste() + + + -1 + -1 + + + 323 + 253 + + + + + mRedoEditAction + triggered() + MainWindow + editRedo() + + + -1 + -1 + + + 323 + 253 + + + + + mUndoEditAction + triggered() + MainWindow + editUndo() + + + -1 + -1 + + + 323 + 253 + + + + + mSelectAllEditAction + triggered() + MainWindow + editSelectAll() + + + -1 + -1 + + + 323 + 253 + + + + + mTimelineAction + triggered() + MainWindow + showTimeline() + + + -1 + -1 + + + 323 + 253 + + + + + mTimeReportAction + triggered() + MainWindow + showTimeReport() + + + -1 + -1 + + + 323 + 253 + + + + + mShowToolbarAction + changed() + MainWindow + showHideToolbar() + + + -1 + -1 + + + 323 + 253 + + + + + mAttachmentsAction + triggered() + MainWindow + showAttachments() + + + -1 + -1 + + + 323 + 253 + + + + + mCheckForUpdatesAction + triggered() + MainWindow + checkForUpdates() + + + -1 + -1 + + + 323 + 253 + + + + + mTimeTrackableAction + toggled(bool) + MainWindow + changeTimeTrackableFlag(bool) + + + -1 + -1 + + + 323 + 253 + + + + + mActionSearch + triggered() + MainWindow + find() + + + -1 + -1 + + + 323 + 253 + + + + + mActionSearchInTasks + triggered() + MainWindow + findInTasks() + + + -1 + -1 + + + 323 + 253 + + + + + mFindEdit + returnPressed() + MainWindow + findRequested() + + + 466 + 335 + + + 323 + 253 + + + + + mShowLittAction + triggered() + MainWindow + showMainWindow() + + + -1 + -1 + + + 323 + 253 + + + + + mFocusTaskTreeAction + triggered() + MainWindow + focusTaskTree() + + + -1 + -1 + + + 323 + 253 + + + + + mFocusTaskTextAction + triggered() + MainWindow + focusTaskText() + + + -1 + -1 + + + 323 + 253 + + + + + mNoteEdit + textChanged() + MainWindow + taskTextChanged() + + + 473 + 229 + + + 323 + 253 + + + + + mAddSiblingAction + triggered() + MainWindow + newSibling() + + + -1 + -1 + + + 323 + 253 + + + + + mMoveDownAction + triggered() + MainWindow + moveDown() + + + -1 + -1 + + + 323 + 253 + + + + + mMoveUpAction + triggered() + MainWindow + moveUp() + + + -1 + -1 + + + 323 + 253 + + + + + + save() + sync() + quit() + taskTreeContextualMenu(QPoint) + newTask() + renameTask() + deleteTask() + newRootTask() + startOrStopTracking() + print() + editFormatChanged(QTextCharFormat) + editUndo() + editRedo() + editCut() + editCopy() + editPaste() + editDelete() + editSelectAll() + preferences() + showTimeline() + showTimeReport() + showHideToolbar() + showAttachments() + checkForUpdates() + changeTimeTrackableFlag(bool) + find() + findInTasks() + findRequested() + findRejected() + taskTextChanged() + focusTaskTree() + focusTaskText() + showMainWindow() + newSibling() + moveUp() + moveDown() + +
diff --git a/client/platforms/hidtracker.cpp b/client/platforms/hidtracker.cpp new file mode 100644 index 0000000..d48040e --- /dev/null +++ b/client/platforms/hidtracker.cpp @@ -0,0 +1,156 @@ +#include "hidtracker.h" +#include "hidtrackerimpl.h" +#include + +#ifdef TARGET_OSX +# include "platforms/osx/hidtrackerimpl_osx.h" +#endif + +HIDActivityTracker::HIDActivityTracker() + :mInterval(600), mTrackerActive(false), mState(None) +{ +#ifdef TARGET_OSX + mImpl = new HIDTrackerImplOSX(); + mImpl->setInterval(mInterval); +#endif + + // Check timer belongs to this object + mCheckTimer = new QTimer(this); + mCheckTimer->setSingleShot(false); + connect(mCheckTimer, SIGNAL(timeout()), this, SLOT(checkState())); +} + +HIDActivityTracker::~HIDActivityTracker() +{ +} + +bool HIDActivityTracker::isPossible() +{ + if (!mImpl) + return false; + return mImpl->isPossible(); +} + +void HIDActivityTracker::setInterval(int seconds) +{ + if (mImpl) + mImpl->setInterval(seconds); + + mInterval = seconds; +} + +int HIDActivityTracker::interval() const +{ + return mInterval; +} + +bool HIDActivityTracker::isTrackerActive() +{ + return mTrackerActive; +} + +bool HIDActivityTracker::start() +{ + if (mTrackerActive) + return true; + + if (mImpl) + mTrackerActive = mImpl->start(); + + mState = None; + mIdleSignalSent = false; + mActivitySignalSent = false; + if (mTrackerActive) + mCheckTimer->start(1000); + + return mTrackerActive; +} + +void HIDActivityTracker::stop() +{ + if (!mTrackerActive) + return; + + if (mImpl) + mImpl->stop(); + + mState = None; + mCheckTimer->stop(); + mTrackerActive = false; +} + +bool HIDActivityTracker::isUserActive() +{ + if (!mImpl) + return true; + + return mImpl->isUserActive(); +} + +void HIDActivityTracker::resetUserActive() +{ + if (!mImpl) + return; + mState = None; + mImpl->resetUserActive(); +} + +void HIDActivityTracker::acceptIdleState() +{ + mState = Idle; +} + +void HIDActivityTracker::acceptUserActiveState() +{ + mState = UserActive; +} + +void HIDActivityTracker::checkState() +{ + if (!mTrackerActive) + return; + + // Now activity tracker is started, check if there was user activity during interval + if (!mImpl->isUserActive()) + { + switch (mState) + { + case None: + mState = Idle; + break; + + case Idle: + break; + + case UserActive: + if (!mIdleSignalSent) + { + mIdleSignalSent = true; + mActivitySignalSent = false; + emit idleDetected(); + } + break; + } + } + else + { + switch (mState) + { + case None: + mState = UserActive; + break; + + case UserActive: + break; + + case Idle: + if (!mActivitySignalSent) + { + mActivitySignalSent = true; + mIdleSignalSent = false; + emit activityDetected(); + } + break; + } + } +} diff --git a/client/platforms/hidtracker.h b/client/platforms/hidtracker.h new file mode 100644 index 0000000..5c06ccd --- /dev/null +++ b/client/platforms/hidtracker.h @@ -0,0 +1,54 @@ +#ifndef __HID_TRACKER_H +#define __HID_TRACKER_H + +class HIDActivityTrackerImpl; +class QTimer; +#include + +class HIDActivityTracker: public QObject +{ + Q_OBJECT + +public: + HIDActivityTracker(); + virtual ~HIDActivityTracker(); + + bool isPossible(); + + void setInterval(int seconds); + int interval() const; + + bool isTrackerActive(); + bool start(); + void stop(); + bool isUserActive(); + void resetUserActive(); + + // These methods must be called in response to idleDetected() / activityDetected() signals + void acceptIdleState(); + void acceptUserActiveState(); + +signals: + void idleDetected(); + void activityDetected(); + +protected: + int mInterval; + HIDActivityTrackerImpl* mImpl; + bool mTrackerActive; + QTimer* mCheckTimer; + enum State + { + None, + Idle, + UserActive + }; + State mState; + bool mIdleSignalSent = false; + bool mActivitySignalSent = false; + +protected slots: + void checkState(); +}; + +#endif diff --git a/client/platforms/hidtrackerimpl.cpp b/client/platforms/hidtrackerimpl.cpp new file mode 100644 index 0000000..ae2a69f --- /dev/null +++ b/client/platforms/hidtrackerimpl.cpp @@ -0,0 +1,19 @@ +#include "hidtrackerimpl.h" + +HIDActivityTrackerImpl::HIDActivityTrackerImpl() + :mInterval(600) +{} + +HIDActivityTrackerImpl::~HIDActivityTrackerImpl() +{ +} + +void HIDActivityTrackerImpl::setInterval(int seconds) +{ + mInterval = seconds; +} + +int HIDActivityTrackerImpl::interval() const +{ + return mInterval; +} diff --git a/client/platforms/hidtrackerimpl.h b/client/platforms/hidtrackerimpl.h new file mode 100644 index 0000000..ab70131 --- /dev/null +++ b/client/platforms/hidtrackerimpl.h @@ -0,0 +1,24 @@ +#ifndef __HID_TRACKER_IMPL_H +#define __HID_TRACKER_IMPL_H + +class HIDActivityTrackerImpl +{ +public: + HIDActivityTrackerImpl(); + virtual ~HIDActivityTrackerImpl(); + + virtual bool isPossible() { return false; } + + void setInterval(int seconds); + int interval() const; + + virtual bool start() = 0; + virtual void stop() = 0; + virtual bool isUserActive() = 0; + virtual void resetUserActive() = 0; + +protected: + int mInterval; +}; + +#endif diff --git a/client/platforms/osx/hidtrackerimpl_osx.h b/client/platforms/osx/hidtrackerimpl_osx.h new file mode 100644 index 0000000..4c07426 --- /dev/null +++ b/client/platforms/osx/hidtrackerimpl_osx.h @@ -0,0 +1,25 @@ +#ifndef __USER_ACTIVITY_OSX_H +#define __USER_ACTIVITY_OSX_H + +#include "platforms/hidtrackerimpl.h" +#include + +class HIDTrackerImplOSX: public HIDActivityTrackerImpl +{ +public: + HIDTrackerImplOSX(); + virtual ~HIDTrackerImplOSX(); + + bool isPossible(); + + bool start(); + void stop(); + bool isUserActive(); + void resetUserActive(); + +protected: + CFMachPortRef mMachPortRef; + CFRunLoopSourceRef mKeyboardEventSrc; +}; + +#endif diff --git a/client/platforms/osx/hidtrackerimpl_osx.mm b/client/platforms/osx/hidtrackerimpl_osx.mm new file mode 100644 index 0000000..f114ac1 --- /dev/null +++ b/client/platforms/osx/hidtrackerimpl_osx.mm @@ -0,0 +1,147 @@ +#import "Config.h" +#import "hidtrackerimpl_osx.h" +#include +#include + +HIDTrackerImplOSX::HIDTrackerImplOSX() + :mMachPortRef(0), mKeyboardEventSrc(0) +{ + +} + +HIDTrackerImplOSX::~HIDTrackerImplOSX() +{ + +} + + +bool HIDTrackerImplOSX::isPossible() +{ + if (AXIsProcessTrustedWithOptions != NULL) + { + // 10.9 and later + const void * keys[] = { kAXTrustedCheckOptionPrompt }; + const void * values[] = { kCFBooleanTrue }; + + CFDictionaryRef options = CFDictionaryCreate( + kCFAllocatorDefault, + keys, + values, + sizeof(keys) / sizeof(*keys), + &kCFCopyStringDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + return AXIsProcessTrustedWithOptions(options); + } + else + return AXAPIEnabled() != 0; +} + +time_t LastKeyboardActivityTime = 0; +time_t LastMouseActivityTime = 0; + +CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon) +{ + if (type != NX_KEYUP && type != NX_OMOUSEDOWN && type != NX_OMOUSEUP && type != NX_OMOUSEDRAGGED && + type != NX_LMOUSEUP && type != NX_LMOUSEDOWN && type != NX_RMOUSEUP && type != NX_RMOUSEDOWN && + type != NX_MOUSEMOVED && type != NX_LMOUSEDRAGGED && type != NX_RMOUSEDRAGGED) + return event; + + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + + NSEvent* sysEvent = [NSEvent eventWithCGEvent:event]; + if (type == NX_KEYUP && [sysEvent type] == NSKeyUp) + LastKeyboardActivityTime = time(NULL); + else + LastMouseActivityTime = time(NULL); + + [pool release]; + return event; +} + +bool HIDTrackerImplOSX::start() +{ + LastKeyboardActivityTime = LastMouseActivityTime = time(NULL); + CGEventMask keyboardMask = CGEventMaskBit(kCGEventKeyUp); + CGEventMask mouseMask = CGEventMaskBit(kCGEventMouseMoved) | CGEventMaskBit(kCGEventLeftMouseDown) | + CGEventMaskBit(kCGEventRightMouseDown); + + CGEventMask mask = keyboardMask + mouseMask;// + mouseMask;//CGEventMaskBit(kCGEventKeyDown) | CGEventMaskBit(kCGEventMouseMoved); + + // Try to create keyboard-only hook. It will fail if Assistive Devices are not set. + mMachPortRef = CGEventTapCreate( + kCGAnnotatedSessionEventTap, + kCGTailAppendEventTap, // kCGHeadInsertEventTap + kCGEventTapOptionListenOnly, + keyboardMask, + (CGEventTapCallBack)eventTapFunction, + 0 ); + if (!mMachPortRef) + return false; + else + CFRelease(mMachPortRef); + + mMachPortRef = CGEventTapCreate( + kCGAnnotatedSessionEventTap, + kCGTailAppendEventTap, // kCGHeadInsertEventTap + kCGEventTapOptionListenOnly, + mask, + (CGEventTapCallBack)eventTapFunction, + 0 ); + if (!mMachPortRef) + return false; + + mKeyboardEventSrc = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, mMachPortRef, 0); + if ( !mKeyboardEventSrc ) + { + CFRelease(mMachPortRef); mMachPortRef = 0; + return false; + } + + CFRunLoopRef runLoop = CFRunLoopGetCurrent(); + if ( !runLoop ) + { + CFRelease(mMachPortRef); mMachPortRef = 0; + return false; + } + + CFRunLoopAddSource(runLoop, mKeyboardEventSrc, kCFRunLoopDefaultMode); + return true; +} + +void HIDTrackerImplOSX::stop() +{ + if (mKeyboardEventSrc && mMachPortRef) + CFRunLoopRemoveSource(CFRunLoopGetCurrent(), mKeyboardEventSrc, kCFRunLoopDefaultMode); + if (mKeyboardEventSrc) + CFRelease(mKeyboardEventSrc); + if (mMachPortRef) + CFRelease(mMachPortRef); + + mKeyboardEventSrc = NULL; + mMachPortRef = NULL; +} + +bool HIDTrackerImplOSX::isUserActive() +{ + if (!LastKeyboardActivityTime && !LastMouseActivityTime) + { + LastKeyboardActivityTime = LastMouseActivityTime = time(NULL); + return true; + } + + time_t current = time(NULL); + if (current - LastKeyboardActivityTime <= mInterval) + return true; + + if (current - LastMouseActivityTime <= mInterval) + return true; + + return false; +} + +void HIDTrackerImplOSX::resetUserActive() +{ + LastKeyboardActivityTime = 0; + LastMouseActivityTime = 0; +} diff --git a/client/platforms/osx/sleeptracker_osx.h b/client/platforms/osx/sleeptracker_osx.h new file mode 100644 index 0000000..cafb2a3 --- /dev/null +++ b/client/platforms/osx/sleeptracker_osx.h @@ -0,0 +1,31 @@ +#ifndef SLEEPTRACKER_OSX_H +#define SLEEPTRACKER_OSX_H + +#include + +class SleepTracker: public QObject +{ + Q_OBJECT +public: + explicit SleepTracker(QObject* parent = nullptr); + ~SleepTracker(); + + void install(); + void uninstall(); + + static SleepTracker& sharedInstance(); + + // For internal calls only + void onAppWillSleep(); + void onAppDidWake(); + +signals: + void onSystemSleep(); + void onSystemResume(); + +protected: + void* mHandler; +}; + +#endif // SLEEPTRACKER_OSX_H + diff --git a/client/platforms/osx/sleeptracker_osx.mm b/client/platforms/osx/sleeptracker_osx.mm new file mode 100644 index 0000000..0975f49 --- /dev/null +++ b/client/platforms/osx/sleeptracker_osx.mm @@ -0,0 +1,110 @@ +#include "sleeptracker_osx.h" +#include +#include + +@interface SleepNotificationHandler: NSObject +{ + SleepTracker* mTracker; +} + +- (id)initWithTracker:(SleepTracker*)tracker; +- (void)dealloc; +- (void)install; +- (void)uninstall; + +- (void)appWillSleep:(NSNotification*)notification; +- (void)appDidWake:(NSNotification*)notification; +@end + +@implementation SleepNotificationHandler + +- (id)initWithTracker:(SleepTracker*)tracker +{ + if (![super init]) + return nil; + + mTracker = tracker; + return self; +} + +- (void)dealloc +{ + [super dealloc]; +} + +- (void)install +{ + NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter]; + [center addObserver:self + selector:@selector(appWillSleep:) + name:NSWorkspaceWillSleepNotification + object:NULL]; + + [center addObserver:self + selector:@selector(appDidWake:) + name:NSWorkspaceDidWakeNotification + object:NULL]; +} + +- (void)uninstall +{ + NSNotificationCenter *center = [[NSWorkspace sharedWorkspace] notificationCenter]; + [center removeObserver: self]; +} + +- (void)appWillSleep:(NSNotification*)notification +{ + if (self->mTracker) + self->mTracker->onAppWillSleep(); +} + +- (void)appDidWake:(NSNotification*)notification +{ + if (self->mTracker) + self->mTracker->onAppDidWake(); +} +@end + +SleepTracker STSharedInstance; + +SleepTracker::SleepTracker(QObject *parent) + :QObject(parent), mHandler(nullptr) + +{ + +} + +SleepTracker::~SleepTracker() +{ + +} + +void SleepTracker::install() +{ + if (!mHandler) + { + mHandler = [[SleepNotificationHandler alloc] initWithTracker: this]; + [(id)mHandler install]; + } +} + +void SleepTracker::uninstall() +{ + if (mHandler) + { + [(id)mHandler uninstall]; + [(id)mHandler release]; + mHandler = nullptr; + } +} + +void SleepTracker::onAppWillSleep() +{ + emit onSystemSleep(); +} + +void SleepTracker::onAppDidWake() +{ + emit onSystemResume(); +} + diff --git a/client/platforms/osx/updater_osx.h b/client/platforms/osx/updater_osx.h new file mode 100644 index 0000000..5c96dc4 --- /dev/null +++ b/client/platforms/osx/updater_osx.h @@ -0,0 +1,30 @@ +#ifndef UPDATER_OSX_H +#define UPDATER_OSX_H + +#include +#include "../updater.h" + +class CocoaInitializer +{ + public: + CocoaInitializer(); + ~CocoaInitializer(); + + private: + class Private; + Private* d; +}; + +class SparkleAutoUpdater : public AutoUpdater +{ + public: + SparkleAutoUpdater(const QString url); + ~SparkleAutoUpdater(); + virtual void checkForUpdates(); + private: + class Private; + Private* d; +}; + +#endif // UPDATER_OSX_H + diff --git a/client/platforms/osx/updater_osx.mm b/client/platforms/osx/updater_osx.mm new file mode 100644 index 0000000..1b75961 --- /dev/null +++ b/client/platforms/osx/updater_osx.mm @@ -0,0 +1,51 @@ +#include "updater_osx.h" + +#include +#include +#include +#include <../lib/osx/Sparkle.Framework/Headers/Sparkle.h> + +class CocoaInitializer::Private +{ +public: + NSAutoreleasePool* autoReleasePool_; +}; + +CocoaInitializer::CocoaInitializer() +{ + d = new CocoaInitializer::Private(); + NSApplicationLoad(); + d->autoReleasePool_ = [[NSAutoreleasePool alloc] init]; +} + +CocoaInitializer::~CocoaInitializer() +{ + [d->autoReleasePool_ release]; + delete d; +} + + +class SparkleAutoUpdater::Private { + public: + SUUpdater* updater; +}; + +SparkleAutoUpdater::SparkleAutoUpdater(const QString& aUrl) +{ + d = new Private; + d->updater = [[SUUpdater sharedUpdater] retain]; + NSURL* url = [NSURL URLWithString: + [NSString stringWithUTF8String: aUrl.toUtf8().data()]]; + [d->updater setFeedURL: url]; +} + +SparkleAutoUpdater::~SparkleAutoUpdater() +{ + [d->updater release]; + delete d; +} + +void SparkleAutoUpdater::checkForUpdates() +{ + [d->updater checkForUpdatesInBackground]; +} diff --git a/client/platforms/updater.h b/client/platforms/updater.h new file mode 100644 index 0000000..e7f2a8b --- /dev/null +++ b/client/platforms/updater.h @@ -0,0 +1,10 @@ +#ifndef UPDATER_H +#define UPDATER_H + +class AutoUpdater { + public: + virtual void checkForUpdates() = 0; +}; + +#endif // UPDATER_H + diff --git a/client/sqlitecpp/.cproject b/client/sqlitecpp/.cproject new file mode 100644 index 0000000..2db6872 --- /dev/null +++ b/client/sqlitecpp/.cproject @@ -0,0 +1,538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/sqlitecpp/.gitignore b/client/sqlitecpp/.gitignore new file mode 100644 index 0000000..d879d2a --- /dev/null +++ b/client/sqlitecpp/.gitignore @@ -0,0 +1,29 @@ +Debug +Release +build +example1 +*.a + +/SQLiteCpp.sln +*.ncb +*.suo +*.user +*sdf +*.vc* +*~ +doc +core +*ipch +.settings/ + +CMakeCache.txt +CMakeFiles +*.cmake +*.dir +Testing +Win32 + +SQLiteCpp_example1 +SQLiteCpp_tests + +!FindSQLiteCpp.cmake diff --git a/client/sqlitecpp/.gitmodules b/client/sqlitecpp/.gitmodules new file mode 100644 index 0000000..e5caef6 --- /dev/null +++ b/client/sqlitecpp/.gitmodules @@ -0,0 +1,3 @@ +[submodule "googletest"] + path = googletest + url = https://git.chromium.org/git/external/googletest.git diff --git a/client/sqlitecpp/.project b/client/sqlitecpp/.project new file mode 100644 index 0000000..eb159f5 --- /dev/null +++ b/client/sqlitecpp/.project @@ -0,0 +1,79 @@ + + + SQLiteC++ + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + -j + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/client/sqlitecpp/.travis.yml b/client/sqlitecpp/.travis.yml new file mode 100644 index 0000000..694e5f8 --- /dev/null +++ b/client/sqlitecpp/.travis.yml @@ -0,0 +1,19 @@ +language: cpp + +compiler: + - gcc + - clang + +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq cppcheck + +# using a symbolic link to get the "make test" to work as if launched from the root directorys +before_script: + - mkdir build + - cd build + - cmake -DSQLITECPP_RUN_CPPLINT=ON -DSQLITECPP_RUN_CPPCHECK=ON -DSQLITECPP_BUILD_EXAMPLES=ON -DSQLITECPP_BUILD_TESTS=ON .. + - ln -s ../examples examples + +script: make && ctest --output-on-failure + diff --git a/client/sqlitecpp/CHANGELOG.txt b/client/sqlitecpp/CHANGELOG.txt new file mode 100644 index 0000000..fc69057 --- /dev/null +++ b/client/sqlitecpp/CHANGELOG.txt @@ -0,0 +1,46 @@ +Mar 30 2012 + Start of a new thin C++ SQLite wrapper + +Apr 2 2012 + The wrapper is functionnal + Added documentation and examples + Publication on GitHub + +Version 0.1.0 - Apr 4 2012 + Added a Database::exec() methode to execute simple SQL statement + Added a version number like in sqlite3.h, starting with 0.1.0 + +Version 0.2.0 - Apr 11 2012 + Added getLastInsertId() and setBusyTimout() + Added bind() by name methods + +Version 0.3.0 - Apr 16 2012 + Added an easy wrapper Database::execAngGet() + +Version 0.4.0 - Apr 23 2012 + Added a Database::tableExists() easy to use function + +Dec 10 2012 + Added a Statement::exec() method to execute a one-step query with no expected result + +Version 0.5.0 - March 9 2013 + Added assert() on errors on destructors + Added getBytes() + Added getBlob(), getType() and isInteger/isFloat/isText/isBlob/isNull + Added bind() for binary blob data + +Version 0.5.1 - April 7 2013 + Added Column::getName() + +Version 0.6.0 - November 22 2013 + Renamed Column::getName() to Column::getOriginName() + Added a new Column::getName() + +Version 0.7.0 - January 9 2014 + Added a new Database::createFunction() API + Added std::string version of existing APIs + Improved CMake with more build options and Doxygen auto-detection + +Version 0.8.0 - Februrary 26 2014 + Changed Column::getText() to return empty string "" by default instead of NULL pointer (to handle std::string conversion) + diff --git a/client/sqlitecpp/CMakeLists.txt b/client/sqlitecpp/CMakeLists.txt new file mode 100644 index 0000000..9e50c9b --- /dev/null +++ b/client/sqlitecpp/CMakeLists.txt @@ -0,0 +1,209 @@ +# Main CMake file for compiling the library itself, examples and tests. +# +# Copyright (c) 2012-2014 Sebastien Rombauts (sebastien.rombauts@gmail.com) +# +# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt +# or copy at http://opensource.org/licenses/MIT) + +cmake_minimum_required(VERSION 2.6) +project(SQLiteCpp) + +option(SQLITE_ENABLE_COLUMN_METADATA "Enable Column::getName(). Require support from sqlite3 library." OFF) +if (SQLITE_ENABLE_COLUMN_METADATA) + # Enable the use of SQLite column metadata and Column::getName() method, + # Require that the sqlite3 library is also compiled with this flag (default under Debian/Ubuntu, but not on Mac OS X). + add_definitions(-DSQLITE_ENABLE_COLUMN_METADATA) +endif (SQLITE_ENABLE_COLUMN_METADATA) + +option(SQLITE_ENABLE_ASSERT_HANDLER "Enable the user defintion of a assertion_failed() handler." OFF) +if (SQLITE_ENABLE_ASSERT_HANDLER) + # Enable the user defintion of a assertion_failed() handler (default to false, easier to handler for begginers). + add_definitions(-DSQLITECPP_ENABLE_ASSERT_HANDLER) +endif (SQLITE_ENABLE_ASSERT_HANDLER) + +# Define useful variables to handle OS differences: +if (WIN32) + set(DEV_NULL "NUL") +else (WIN32) + set(DEV_NULL "/dev/null") +endif (WIN32) +# then Compiler/IDE differences: +if (MSVC) + set(CPPLINT_ARG_OUTPUT "--output=vs7") + set(CPPCHECK_ARG_TEMPLATE "--template=vs") + # disable Visual Studio warnings for fopen() used in the example + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + # Flags for linking with multithread static C++ runtime + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") +else (MSVC) + set(CPPLINT_ARG_OUTPUT "--output=eclipse") + set(CPPCHECK_ARG_TEMPLATE "--template=gcc") + if (CMAKE_COMPILER_IS_GNUCXX) + # GCC flags + add_definitions(-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline) + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # Clang flags + add_definitions(-fstack-protector-all -Wall -Wextra -pedantic -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wshadow -Wcast-qual -Wconversion -Winline) + endif (CMAKE_COMPILER_IS_GNUCXX) +endif (MSVC) +# and then common variables +set(CPPLINT_ARG_VERBOSE "--verbose=3") +set(CPPLINT_ARG_LINELENGTH "--linelength=120") + + +## Core source code ## + +# adding a new file require explicittly modifing the CMakeLists.txt +# so that CMake knows that it should rebuild the project (it is best practice) + +# list of sources files of the library +set(SQLITECPP_SRC + ${PROJECT_SOURCE_DIR}/src/Column.cpp + ${PROJECT_SOURCE_DIR}/src/Database.cpp + ${PROJECT_SOURCE_DIR}/src/Statement.cpp + ${PROJECT_SOURCE_DIR}/src/Transaction.cpp +) +source_group(src FILES ${SQLITECPP_SRC}) + +# list of header files of the library +set(SQLITECPP_INC + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/SQLiteCpp.h + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Assertion.h + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Column.h + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Database.h + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Exception.h + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Statement.h + ${PROJECT_SOURCE_DIR}/include/SQLiteCpp/Transaction.h +) +source_group(inc FILES ${SQLITECPP_INC}) + +# list of test files of the library +set(SQLITECPP_TESTS + tests/Database_test.cpp + tests/Statement_test.cpp +) +source_group(tests FILES ${SQLITECPP_TESTS}) + +# list of example files of the library +set(SQLITECPP_EXAMPLES + examples/example1/main.cpp +) +source_group(example1 FILES ${SQLITECPP_EXAMPLES}) + +# list of doc files of the library +set(SQLITECPP_DOC + README.md + WRAPPERS.md + LICENSE.txt + TODO.txt +) +source_group(doc FILES ${SQLITECPP_DOC}) + +# All includes are relative to the "include" directory +include_directories("${PROJECT_SOURCE_DIR}/include") + +# add sources of the wrapper as a "SQLiteCpp" static library +add_library(SQLiteCpp ${SQLITECPP_SRC} ${SQLITECPP_INC} ${SQLITECPP_DOC}) + +if (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) + set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-fPIC") +endif (UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) + + +# SQLite3 library (Windows only) + +option (SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON) +if (WIN32) + if (SQLITECPP_INTERNAL_SQLITE) + # build the SQLite3 C library for Windows (for ease of use) versus Linux sqlite3-dev package + add_subdirectory(sqlite3) + include_directories("${PROJECT_SOURCE_DIR}/sqlite3") + endif (SQLITECPP_INTERNAL_SQLITE) +endif (WIN32) + + +# Optional additional targets: + +option(SQLITECPP_RUN_CPPLINT "Run cpplint.py tool for Google C++ StyleGuide." OFF) +if (SQLITECPP_RUN_CPPLINT) + # add a cpplint target to the "all" target + add_custom_target(SQLiteCpp_cpplint + ALL + COMMAND python ${PROJECT_SOURCE_DIR}/cpplint.py ${CPPLINT_ARG_OUTPUT} ${CPPLINT_ARG_VERBOSE} ${CPPLINT_ARG_LINELENGTH} ${SQLITECPP_SRC} ${SQLITECPP_INC} + ) +else (SQLITECPP_RUN_CPPLINT) + message(STATUS "SQLITECPP_RUN_CPPLINT OFF") +endif (SQLITECPP_RUN_CPPLINT) + +option(SQLITECPP_RUN_CPPCHECK "Run cppcheck C++ static analysis tool." OFF) +if (SQLITECPP_RUN_CPPCHECK) + find_program(CPPCHECK_EXECUTABLE NAMES cppcheck) + if (CPPCHECK_EXECUTABLE) + # add a cppcheck target to the "all" target + add_custom_target(SQLiteCpp_cppcheck + ALL + COMMAND cppcheck -j 4 cppcheck --enable=style --quiet ${CPPCHECK_ARG_TEMPLATE} ${PROJECT_SOURCE_DIR}/src + ) + else (CPPCHECK_EXECUTABLE) + message(STATUS "cppcheck not found") + endif (CPPCHECK_EXECUTABLE) +else (SQLITECPP_RUN_CPPCHECK) + message(STATUS "SQLITECPP_RUN_CPPCHECK OFF") +endif (SQLITECPP_RUN_CPPCHECK) + +option(SQLITECPP_RUN_DOXYGEN "Run Doxygen C++ documentation tool." OFF) +if (SQLITECPP_RUN_DOXYGEN) + find_package(Doxygen) + if (DOXYGEN_FOUND) + # add a Doxygen target to the "all" target + add_custom_target(SQLiteCpp_doxygen + ALL + COMMAND doxygen Doxyfile > ${DEV_NULL} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) + else (DOXYGEN_FOUND) + message(STATUS "Doxygen not found") + endif (DOXYGEN_FOUND) +else (SQLITECPP_RUN_DOXYGEN) + message(STATUS "SQLITECPP_RUN_DOXYGEN OFF") +endif (SQLITECPP_RUN_DOXYGEN) + +option(SQLITECPP_BUILD_EXAMPLES "Build examples." OFF) +if (SQLITECPP_BUILD_EXAMPLES) + # add the basic example executable + add_executable(SQLiteCpp_example1 ${SQLITECPP_EXAMPLES}) + target_link_libraries(SQLiteCpp_example1 SQLiteCpp sqlite3) +else(SQLITECPP_BUILD_EXAMPLES) + message(STATUS "SQLITECPP_BUILD_EXAMPLES OFF") +endif(SQLITECPP_BUILD_EXAMPLES) + +option(SQLITECPP_BUILD_TESTS "Build and run tests." OFF) +if (SQLITECPP_BUILD_TESTS) + # add the subdirectory containing the CMakeLists.txt for the gtest library + if (NOT MSVC) + add_definitions(-Wno-variadic-macros -Wno-long-long -Wno-conversion -Wno-switch-enum) + endif (NOT MSVC) + + add_subdirectory(googletest) + include_directories("${PROJECT_SOURCE_DIR}/googletest/include") + + # add the unit test executable + add_executable(SQLiteCpp_tests ${SQLITECPP_TESTS}) + target_link_libraries(SQLiteCpp_tests gtest_main SQLiteCpp sqlite3) + + # add a "test" target: + enable_testing() + + # does the tests pass? + add_test(UnitTests SQLiteCpp_tests) + + if (SQLITECPP_BUILD_EXAMPLES) + # does the example1 runs successfully? + add_test(Example1Run SQLiteCpp_example1) + endif(SQLITECPP_BUILD_EXAMPLES) +else (SQLITECPP_BUILD_TESTS) + message(STATUS "SQLITECPP_BUILD_TESTS OFF") +endif (SQLITECPP_BUILD_TESTS) diff --git a/client/sqlitecpp/Doxyfile b/client/sqlitecpp/Doxyfile new file mode 100644 index 0000000..37a4754 --- /dev/null +++ b/client/sqlitecpp/Doxyfile @@ -0,0 +1,2315 @@ +# Doxyfile 1.8.6 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = SQLiteC++ + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = 0.8.0 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "SQLiteC++ is a smart and easy to use C++ SQLite3 wrapper." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 7 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = src \ + include + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.cpp \ + *.h + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /