aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/test/main.cpp
blob: f78efbd1bfa0cab1a9f4eedc32d97cfb808161ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <QDebug>
#include <QApplication>

#include "../LuminaRandR.h"


int main(int argc, char** argv){
  QString toggle = "DVI-I-1";
  QRect toggleGeom(7680,0, 1024,768);
  int toggleOK = -1; //-1: automatic, 0: enable monitor, 1: disable monitor

  QApplication A(argc, argv);
  qDebug() << "Load Monitor Device Information";
  OutputDeviceList devList;

  qDebug() << "Detected Information:";
  for(int i=0; i<devList.length(); i++){
    qDebug() << "["+devList.at(i)->ID()+"]";
    qDebug() << "  - isConnected:" << devList.at(i)->isConnected();
    if(devList.at(i)->isConnected()){
      qDebug() << "  - isEnabled:" << devList.at(i)->isEnabled();
      qDebug() << "  - isPrimary:" << devList.at(i)->isPrimary();
      qDebug() << "  - Current Geometry:" << devList.at(i)->currentGeometry();
      qDebug() << "  - Physical Size (mm):" << devList.at(i)->physicalSizeMM();
      qDebug() << "  - Current DPI:" << devList.at(i)->physicalDPI();
      qDebug() << "  - Available Resolutions:" << devList.at(i)->availableResolutions();
      if(devList.at(i)->ID() == toggle && toggleOK<0){ toggleOK = (devList.at(i)->isEnabled() ? 1 : 0); }
    }
  }
  qDebug() << "\n================\n";
  if(toggleOK == 0){
    qDebug() << "Try Enabling Monitor:" << toggle << toggleGeom;
    bool ok = devList.enableMonitor(toggle, toggleGeom);
    qDebug() << " -- Success:" << ok;
  }else if(toggleOK == 1){
    qDebug() << "Try Disabling Monitor:" << toggle;
    bool ok = devList.disableMonitor(toggle);
    qDebug() << " -- Success:" << ok;
  }

  /*QString setprimary = "eDP-1";
  if(devList.primaryMonitor() != setprimary){
    qDebug() << "Try setting monitor as primary:" << setprimary;
    devList.setPrimaryMonitor(setprimary);
    //Now see if the status changed on X itself
    for(int i=0; i<devList.length(); i++){
      if(devList.at(i)->ID() == setprimary){
        devList.at(i)->updateInfoCache(); //resync with X server info
        qDebug() << "Successful:" << devList.at(i)->isPrimary();
      }
    }
  }*/

  qDebug() << "[  Finished Test!  ]";
  return 0;
}
bgstack15