@@ -60,9 +60,52 @@ UltragridWindow::UltragridWindow(QWidget *parent): QMainWindow(parent){
60
60
61
61
queryOpts ();
62
62
63
+ checkPreview ();
64
+
63
65
startPreview ();
64
66
}
65
67
68
+ void UltragridWindow::checkPreview (){
69
+ QStringList out;
70
+
71
+ QProcess process;
72
+
73
+ QString command = ultragridExecutable;
74
+
75
+ command += " -d help" ;
76
+
77
+ process.start (command);
78
+
79
+ process.waitForFinished ();
80
+ QByteArray output = process.readAllStandardOutput ();
81
+ QList<QByteArray> lines = output.split (' \n ' );
82
+
83
+ foreach ( const QByteArray &line, lines ) {
84
+ if (line.size () > 0 && QChar (line[0 ]).isSpace ()) {
85
+ QString opt = QString (line).trimmed ();
86
+ if (opt != " none"
87
+ && !opt.startsWith (" --" )
88
+ && !opt.contains (" unavailable" ))
89
+ out.append (QString (line).trimmed ());
90
+ }
91
+ }
92
+
93
+ if (!out.contains (" multiplier" ) || !out.contains (" preview" )){
94
+ ui.previewCheckBox ->setChecked (false );
95
+ ui.previewCheckBox ->setEnabled (false );
96
+
97
+ QMessageBox warningBox (this );
98
+ warningBox.setWindowTitle (" Preview disabled" );
99
+ warningBox.setText (" Preview is disabled, because UltraGrid was compiled"
100
+ " without preview and multiplier displays."
101
+ " Please build UltraGrid configured with the --enable-qt flag"
102
+ " to enable preview." );
103
+ warningBox.setStandardButtons (QMessageBox::Ok);
104
+ warningBox.setIcon (QMessageBox::Warning);
105
+ warningBox.exec ();
106
+ }
107
+ }
108
+
66
109
void UltragridWindow::about (){
67
110
QMessageBox aboutBox (this );
68
111
aboutBox.setWindowTitle (" About UltraGrid" );
@@ -108,7 +151,10 @@ void UltragridWindow::start(){
108
151
}
109
152
110
153
void UltragridWindow::startPreview (){
111
- if (process.state () != QProcess::NotRunning || !ui.previewCheckBox ->isChecked ()){
154
+ if (!ui.previewCheckBox ->isEnabled ()
155
+ || process.state () != QProcess::NotRunning
156
+ || !ui.previewCheckBox ->isChecked ()
157
+ ){
112
158
return ;
113
159
}
114
160
0 commit comments