blob: 2e2e3f2e75a5c1184dcb19d6443056781468b07a (
plain) (
tree)
|
|
#ifndef XRANDR_H
#define XRANDR_H
#include <QList>
#include <QString>
#include <QSize>
struct ScreenInfo;
class XPrivate;
class QSocketNotifier;
typedef QVector<QSize> ResolutionVector;
///////////////////////////////////////////////////////////////////////////
enum class ScreenMode
{
Single,
Clone,
Dual,
Advanced,
};
struct ScreenInfo
{
int position;
QString name;
QString output;
QSize currentResolution;
QSize preferredResolution;
bool isProjector;
ResolutionVector modes;
};
enum class ConnectionEvent
{
Connected,
Disconnected,
Unknown,
};
class ScreenSetup : public QObject
{
Q_OBJECT
public:
void updateScreenResources();
void initModes();
ScreenMode getCurrentMode();
ScreenMode setDefaultMode(bool dryRun = false);
bool createMode(unsigned int resX, unsigned int resY, float refresh, QString name);
void revertChanges();
bool setCenteredClone();
bool setClone(const QSize &resolution);
bool setCustom(const QList<QPair<QSize, QList<QString>>> &list);
ResolutionVector getCommonModes() const;
int getOutputCount() const;
int queryCurrentOutputCount() const;
QMap<QString, ScreenInfo> getScreenPositions() const;
const ResolutionVector &getVirtualResolutions() const;
// Singleton
inline static ScreenSetup* inst() {
if (_instance == nullptr) _instance = new ScreenSetup();
return _instance;
}
private:
ScreenSetup();
~ScreenSetup();
static ScreenSetup * _instance;
XPrivate *a;
QSocketNotifier *_socketNotifier;
signals:
void outputConfigChanged(ConnectionEvent event);
};
///////////////////////////////////////////////////////////////////////////
#endif // XRANDR_H
|