File indexing completed on 2024-06-02 05:45:31

0001 /*
0002  * This file is part of the KDE wacomtablet project. For copyright
0003  * information and license terms see the AUTHORS and COPYING files
0004  * in the top-level directory of this distribution.
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU General Public License as
0008  * published by the Free Software Foundation; either version 2 of
0009  * the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #include "screenrotation.h"
0021 
0022 using namespace Wacom;
0023 
0024 /*
0025  * Instantiate static instances-container of the ScreenRotation template specialization.
0026  * This has to be done here obviously before any instance is created.
0027  */
0028 template<>
0029 ScreenRotationTemplateSpecialization::Container ScreenRotationTemplateSpecialization::instances = ScreenRotationTemplateSpecialization::Container();
0030 
0031 /*
0032  * Instantiate Device Types.
0033  */
0034 const ScreenRotation ScreenRotation::NONE(QLatin1String("none"));
0035 const ScreenRotation ScreenRotation::CCW(QLatin1String("ccw"));
0036 const ScreenRotation ScreenRotation::HALF(QLatin1String("half"));
0037 const ScreenRotation ScreenRotation::CW(QLatin1String("cw"));
0038 
0039 const ScreenRotation ScreenRotation::AUTO(QLatin1String("auto"));
0040 const ScreenRotation ScreenRotation::AUTO_INVERTED(QLatin1String("auto-inverted"));
0041 
0042 const ScreenRotation &ScreenRotation::invert() const
0043 {
0044     if (*this == ScreenRotation::CW) {
0045         return ScreenRotation::CCW;
0046 
0047     } else if (*this == ScreenRotation::CCW) {
0048         return ScreenRotation::CW;
0049     }
0050 
0051     return *this;
0052 }