Skeleton DPI test app

This commit is contained in:
Sebastian Kügler 2014-01-17 13:48:17 +01:00
parent bdc2ad2a84
commit ff1d062b47
5 changed files with 173 additions and 0 deletions

View File

@ -1 +1,2 @@
add_subdirectory(kplugins)
add_subdirectory(dpi)

View File

@ -0,0 +1,13 @@
project("dpitest")
add_executable(dpitest
main.cpp
dpitest.cpp
)
target_link_libraries(dpitest KF5::Plasma KF5::I18n Qt5::Gui)
message("INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}")
install(TARGETS dpitest ${INSTALL_TARGETS_DEFAULT_ARGS})

View File

@ -0,0 +1,63 @@
/******************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*******************************************************************************/
#include "dpitest.h"
#include <QDebug>
#include <plasma/theme.h>
#include <qcommandlineparser.h>
#include <QStringList>
#include <QTimer>
#include <iostream>
#include <iomanip>
namespace Plasma
{
class DPITestPrivate {
public:
QString pluginName;
QCommandLineParser *parser;
};
DPITest::DPITest(int& argc, char** argv, QCommandLineParser *parser) :
QApplication(argc, argv)
{
d = new DPITestPrivate;
d->parser = parser;
QTimer::singleShot(0, this, SLOT(runMain()));
}
DPITest::~DPITest()
{
delete d;
}
void DPITest::runMain()
{
qDebug() << "DPI test runs: ";
exit(0);
return;
}
}
#include "moc_dpitest.cpp"

View File

@ -0,0 +1,50 @@
/******************************************************************************
* Copyright 2012 Sebastian Kügler <sebas@kde.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*******************************************************************************/
#ifndef PLUGINTEST_H
#define PLUGINTEST_H
#include <QCoreApplication>
#include <QApplication>
class QCommandLineParser;
namespace Plasma
{
class DPITestPrivate;
class DPITest : public QApplication
{
Q_OBJECT
public:
DPITest(int& argc, char** argv, QCommandLineParser *parser);
virtual ~DPITest();
public Q_SLOTS:
void runMain();
private:
DPITestPrivate* d;
};
}
#endif

View File

@ -0,0 +1,46 @@
/*
* Copyright 2008 Aaron Seigo <aseigo@kde.org>
* Copyright 2013 Sebastian Kügler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <QScreen>
#include <plasma/theme.h>
#include <qcommandlineparser.h>
#include <qcommandlineoption.h>
#include <KLocalizedString>
#include "dpitest.h"
int main(int argc, char **argv)
{
QCommandLineParser *parser = new QCommandLineParser;
Plasma::DPITest app(argc, argv, parser);
const QString description = i18n("DPI test app");
const char version[] = "2.0";
app.setApplicationVersion(version);
parser->addVersionOption();
parser->setApplicationDescription(description);
parser->addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate <name>", "Show icon sizes"), "name"));
return app.exec();
}