2 * Copyright 2008 Aike J Sommer <dev@aikesommer.name>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "kephalapp.h"
22 #include "kephal/screens.h"
23 #include "kephal/outputs.h"
29 #include <QTextStream>
32 using namespace Kephal
;
34 int main(int argc
, char *argv
[])
36 KephalApp
app(argc
, argv
);
42 KephalApp::KephalApp(int & argc
, char ** argv
)
43 : QApplication(argc
, argv
)
45 //qDebug() << "kephal starting up";
49 KephalApp::~KephalApp()
53 void KephalApp::init() {
55 QTimer::singleShot(0, this, SLOT(run()));
58 void KephalApp::run() {
63 void KephalApp::query() {
64 QTextStream
cout(stdout
);
66 foreach (Screen
* screen
, Screens::self()->screens()) {
67 cout
<< " Screen " << screen
->id() << ":\n";
68 cout
<< " Size: " << screen
->size().width() << "x" << screen
->size().height() << "\n";
69 cout
<< " Position: (" << screen
->position().x() << "," << screen
->position().y() << ")\n";
71 foreach (Output
* output
, screen
->outputs()) {
72 cout
<< " Output: " << output
->id() << "\n";
76 cout
<< "\nOutputs:\n";
77 foreach (Output
* output
, Outputs::self()->outputs()) {
78 cout
<< " Output " << output
->id() << ":\n";
79 cout
<< " Connected: " << output
->isConnected() << "\n";
81 if (! output
->isConnected()) continue;
83 cout
<< " Activated: " << output
->isActivated() << "\n";
84 cout
<< " Size: " << output
->size().width() << "x" << output
->size().height() << "\n";
85 cout
<< " Position: (" << output
->position().x() << "," << output
->position().y() << ")\n";
86 cout
<< " Vendor: " << output
->vendor() << "\n";
87 cout
<< " PreferredSize: " << output
->preferredSize().width() << "x" << output
->preferredSize().height() << "\n";
88 cout
<< " Rotation: " << output
->rotation() << "\n";
89 cout
<< " ReflectX: " << output
->reflectX() << "\n";
90 cout
<< " ReflectY: " << output
->reflectY() << "\n";
91 cout
<< " Rate: " << output
->rate() << "\n";
92 cout
<< " Screen: " << (output
->screen() ? output
->screen()->id() : -1) << "\n";
94 cout
<< "\n Available sizes: ";
95 foreach (QSize size
, output
->availableSizes()) {
96 cout
<< size
.width() << "x" << size
.height() << ", ";
99 cout
<< "\n Available positions: ";
100 foreach (QPoint pos
, output
->availablePositions()) {
101 cout
<< "(" << pos
.x() << "," << pos
.y() << "), ";
104 cout
<< "\n Available rates: ";
105 foreach (float rate
, output
->availableRates()) {
106 cout
<< rate
<< ", ";