From 141451ea9f34d71d4255f323492cb463d96dd865 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Wed, 9 Apr 2014 19:44:28 +0200 Subject: [beamergui] Several changes + mouse position will be centered after changing the resolution. + fixed the bug with the positioning of the gui + fixed curious X async bug + deleted a lot of crap and old debug statements + current resolution will be highlighted --- src/main.cpp | 319 +---------------------------------------------------------- 1 file changed, 2 insertions(+), 317 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 6a5fa7c..7c2daab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,330 +1,15 @@ // Copyright 2013, University of Freiburg, // Author: Manuel Schneider -#include -#include -#include +#include // for Qt4 #include "widget.h" int main(int argc, char *argv[]) { - //if (argc != 2) { - // std::cout << "Usage: " << argv[0] << " " << std::endl; - //} else { - // // Check if file exists - // std::ifstream f(argv[1]); - // if (!f) { - // std::cerr << "The config file does not exist." << std::endl; - // exit(1); - // } - // else - // f.close(); - //} - QApplication a(argc, argv); Widget w; w.show(); return a.exec(); } - - - -////////////////////////////////////////// CODE MÜLLEIMER - - - // eine datei - - -//Widget::Widget(QWidget *parent) : -// QWidget(parent), -// ui(new Ui::Widget) -//{ -// ui->setupUi(this); - -// for (std::vector::iterator i = DisplayManager::Inst()->getConnectedOutputs().begin(); -// i != DisplayManager::Inst()->getConnectedOutputs().end(); -// ++i) -// { -// qDebug() << "EDID?" << ( (*i).hasEDID() ? "true" : "false"); -// qDebug() << "Proj?" << ( (*i).isProjector() ? "true" : "false"); -// qDebug() << "Current?" -// << DisplayManager::Inst()->getResolution((*i).getCurrentMode()).width -// << DisplayManager::Inst()->getResolution((*i).getCurrentMode()).height; -// Resolution res; -// if ((*i).getPreferredMode()) -// qDebug() << "Preferred?" -// << DisplayManager::Inst()->getResolution((*i).getPreferredMode()).width -// << DisplayManager::Inst()->getResolution((*i).getPreferredMode()).height; - -// QSet modes = (*i).getSupportedModes(); - -// for ( QSet::iterator i = modes.begin(); i != modes.end(); ++i ) -// { -// qDebug() << "---- " -// << DisplayManager::Inst()->getResolution(*i).width -// << DisplayManager::Inst()->getResolution(*i).height; -// } -// } - - -// switch ( DisplayManager::Inst()->getConnectedOutputs().size() ){ -// /*************************************************************************/ -// case 1:// In case of one connected output - xrandr --auto -// qDebug() << "Normal output"; -// exit(0); -// break; -// /*************************************************************************/ -// case 2: // In case of two connected outputs - -// /*********************************************************************/ -// // If one of the two connected outputs is a beamer - -// if ( true)//DisplayManager::Inst()->isProjectorConnected() ) -// { -// /* -// Here the usecases have to be listed theoretically there are two -// in this case. 2 Projectors, 1 projectors and on monitor. Only the -// latter is asumed here. -// */ - -// // Remember which one is the projector -// int ProjectorIndex; -// DisplayManager::Inst()->getConnectedOutputs().at(0).isProjector() -// ? ProjectorIndex = 0 : ProjectorIndex = 0; - -// /*****************************************************************/ -// // If the beamer transmits reliable EDID data. -// if( DisplayManager::Inst()->getConnectedOutputs().at(ProjectorIndex).hasEDID() ) -// { -// // Now we can assume that the preferred mode of the projector to be correnct -// // to be correct. - -// // Get the AR of the beamer -// Resolution res; -// if ( DisplayManager::Inst()->getConnectedOutputs().at(ProjectorIndex).getPreferredMode() ) -// fprintf(stderr, "Beamer has EDID but no preferred mode."); - -// float AR = res.width/res.height; - -// QSet BeamerModes = -// DisplayManager::Inst()->getConnectedOutputs().at(ProjectorIndex).getSupportedModes(); - -// QSet MonitorModes = -// DisplayManager::Inst()->getConnectedOutputs().at(1-ProjectorIndex).getSupportedModes(); - -// QSet CommonModes = BeamerModes.unite(MonitorModes); - -// CommonModes.intersect(BeamerModes); -// CommonModes.intersect(MonitorModes); - -// // Fill treewidget with data from cups dests; -// for ( QSet::iterator i = CommonModes.begin(); i != CommonModes.end(); ++i ) -// { -// char * ModeString; -// sprintf(ModeString, "%dx%d", -// DisplayManager::Inst()->getResolution(*i).width, -// DisplayManager::Inst()->getResolution(*i).height -// ); - -// qDebug() << ModeString; -// ui->comboBox->addItem(ModeString, QVariant((unsigned long long int)*i)); -// } -// } -// /*****************************************************************/ -// // If the beamer DOES NOT transmits reliable EDID data. -// else -// { -// qDebug() << "beamer output no reliable EDID "; -// configureWidgetForBeamerWithEDID(); -// } -// /*****************************************************************/ - -// } -// /*********************************************************************/ -// // If NEITHER of the outputs is a beamer (likely dualscreen setup) -// else -// { -// // Just apply preferred settings - -// qDebug() << "dualscreen output"; - -// } -// break; -// /*************************************************************************/ -// default: -// // If there are more than 3 outputs -// // its up to the user. Quit. -// exit(0); -// break; -// } -// /*************************************************************************/ - - - - - - -// //Remove borders and stuff -// setWindowFlags(windowFlags() | Qt::FramelessWindowHint); - - - - -// // QSet outputs0, outputs1; -// // for (int i = 0; i < XManager::Inst()->getOutputInfos()[0]->nmode; ++i) -// // outputs0.insert(XManager::Inst()->getOutputInfos()[0]->modes[i]); -// // for (int i = 0; i < XManager::Inst()->getOutputInfos()[1]->nmode; ++i) -// // outputs1.insert(XManager::Inst()->getOutputInfos()[1]->modes[i]); -// // outputs0.intersect(outputs1); - -// // // Fill treewidget with data from cups dests; -// // for ( QSet::iterator it = outputs0.begin(); it != outputs0.end(); ++it ) -// // { -// // qDebug() << *it; -// // qDebug() << XManager::Inst()->getModeMap()[*it]; -// // ui->comboBox->addItem(XManager::Inst()->getModeMap().at(*it), (unsigned long long int)*it); -// // } - -// // // Fill treewidget with data from cups dests; -// // for ( map::iterator it = XManager::Inst()->getModeMap().begin(); it != XManager::Inst()->getModeMap().end(); ++it ) -// // { -// // qDebug() << it->first ; -// //// qDebug() << XManager::getInstance()->getModeMap()[*it]; -// //// ui->comboBox->addItem(XManager::getInstance()->getModeMap().at(*it), (unsigned long long int)*it); -// // } - -// // Resize widget to its content -// resize(sizeHint()); - -// // Center dialog on screenbottom -// const QRect desktopRect = QApplication::desktop()->screenGeometry(); -// this->move( desktopRect.width()/2-this->width()/2, -// desktopRect.height()-this->height()); -// } - -// Widget::~Widget() -// { -// delete ui; -// } - -// void Widget::configureWidgetForBeamerWithEDID() -// { -// } - -// void Widget::configureWidgetForBeamerWithOUTEDID() -// { -// } - - - - - - // eine andre datei - - - - - - -//Widget::Widget(QWidget *parent) : -// QWidget(parent), -// ui(new Ui::Widget) -//{ -// ui->setupUi(this); - - -// X11::XManager * XM = X11::XManager::getInstance(); - - -// switch ( XM->getOutputInfos().size() ){ -// /*************************************************************************/ -// case 1:// In case of one connected output - xrandr --auto -// qDebug() << "Normal output"; -// exit(0); -// break; -// /*************************************************************************/ -// case 2: // In case of two connected outputs - -// /*********************************************************************/ -// // If one of the two connected outputs is a beamer -// if ( true ) //( XM->getOutputInfos()[0]->mm_width == 0 && XM->getOutputInfos()[0]->mm_height == 0 ) -// // || ( XM->getOutputInfos()[1]->mm_width == 0 && XM->getOutputInfos()[1]->mm_height == 0 ) ) -// { -// /*****************************************************************/ -// // If the beamer transmits reliable EDID data. -// if( isReliableEDIDpresent() ) -// { -// qDebug() << "beamer output reliable EDID "; -// configureWidgetForBeamerWithEDID(); -// } -// /*****************************************************************/ -// // If the beamer DOES NOT transmits reliable EDID data. -// else -// { -// qDebug() << "beamer output no reliable EDID "; -// configureWidgetForBeamerWithEDID(); -// } -// /*****************************************************************/ - -// } -// /*********************************************************************/ -// // If NEITHER of the outputs is a beamer (likely dualscreen setup) -// else -// { -// // Just apply preferred settings -// qDebug() << "dualscreen output"; - -// } -// break; -// /*************************************************************************/ -// default: -// // If there are more than 3 outputs -// // its up to the user. Quit. -// exit(0); -// break; -// } -// /*************************************************************************/ - - - - -// Remove borders and stuff -// setWindowFlags(windowFlags() | Qt::FramelessWindowHint); - - - - -// QSet outputs0, outputs1; -// for (int i = 0; i < XManager::Inst()->getOutputInfos()[0]->nmode; ++i) -// outputs0.insert(XManager::Inst()->getOutputInfos()[0]->modes[i]); -// for (int i = 0; i < XManager::Inst()->getOutputInfos()[1]->nmode; ++i) -// outputs1.insert(XManager::Inst()->getOutputInfos()[1]->modes[i]); -// outputs0.intersect(outputs1); - -// // Fill treewidget with data from cups dests; -// for ( QSet::iterator it = outputs0.begin(); it != outputs0.end(); ++it ) -// { -// qDebug() << *it; -// qDebug() << XManager::Inst()->getModeMap()[*it]; -// ui->comboBox->addItem(XManager::Inst()->getModeMap().at(*it), (unsigned long long int)*it); -// } - -// // Fill treewidget with data from cups dests; -// for ( map::iterator it = XManager::Inst()->getModeMap().begin(); it != XManager::Inst()->getModeMap().end(); ++it ) -// { -// qDebug() << it->first ; -//// qDebug() << XManager::getInstance()->getModeMap()[*it]; -//// ui->comboBox->addItem(XManager::getInstance()->getModeMap().at(*it), (unsigned long long int)*it); -// } - -// // Resize widget to its content -// resize(sizeHint()); - -// // Center dialog on screenbottom -// const QRect desktopRect = QApplication::desktop()->screenGeometry(); -// this->move( desktopRect.width()/2-this->width()/2, -// desktopRect.height()-this->height()); -//} - - +//////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-55-g7522