1 #include <QDebug> 2 #include <QApplication> 3 4 #include "../LuminaRandR.h" 5 6 main(int argc,char ** argv)7int main(int argc, char** argv){ 8 QString toggle = "DVI-I-1"; 9 QRect toggleGeom(7680,0, 1024,768); 10 int toggleOK = -1; //-1: automatic, 0: enable monitor, 1: disable monitor 11 12 QApplication A(argc, argv); 13 qDebug() << "Load Monitor Device Information"; 14 OutputDeviceList devList; 15 16 qDebug() << "Detected Information:"; 17 for(int i=0; i<devList.length(); i++){ 18 qDebug() << "["+devList.at(i)->ID()+"]"; 19 qDebug() << " - isConnected:" << devList.at(i)->isConnected(); 20 if(devList.at(i)->isConnected()){ 21 qDebug() << " - isEnabled:" << devList.at(i)->isEnabled(); 22 qDebug() << " - isPrimary:" << devList.at(i)->isPrimary(); 23 qDebug() << " - Current Geometry:" << devList.at(i)->currentGeometry(); 24 qDebug() << " - Physical Size (mm):" << devList.at(i)->physicalSizeMM(); 25 qDebug() << " - Current DPI:" << devList.at(i)->physicalDPI(); 26 qDebug() << " - Available Resolutions:" << devList.at(i)->availableResolutions(); 27 if(devList.at(i)->ID() == toggle && toggleOK<0){ toggleOK = (devList.at(i)->isEnabled() ? 1 : 0); } 28 } 29 } 30 qDebug() << "\n================\n"; 31 if(toggleOK == 0){ 32 qDebug() << "Try Enabling Monitor:" << toggle << toggleGeom; 33 bool ok = devList.enableMonitor(toggle, toggleGeom); 34 qDebug() << " -- Success:" << ok; 35 }else if(toggleOK == 1){ 36 qDebug() << "Try Disabling Monitor:" << toggle; 37 bool ok = devList.disableMonitor(toggle); 38 qDebug() << " -- Success:" << ok; 39 } 40 41 /*QString setprimary = "eDP-1"; 42 if(devList.primaryMonitor() != setprimary){ 43 qDebug() << "Try setting monitor as primary:" << setprimary; 44 devList.setPrimaryMonitor(setprimary); 45 //Now see if the status changed on X itself 46 for(int i=0; i<devList.length(); i++){ 47 if(devList.at(i)->ID() == setprimary){ 48 devList.at(i)->updateInfoCache(); //resync with X server info 49 qDebug() << "Successful:" << devList.at(i)->isPrimary(); 50 } 51 } 52 }*/ 53 54 qDebug() << "[ Finished Test! ]"; 55 return 0; 56 } 57