@@ -150,7 +150,8 @@ void DisplayWindow::changeDisplay(int msgid){
150150#else
151151while (1 ){
152152 // msgrcv to receive message
153- msgrcv (msgid, &message, sizeof (message), 0 , 0 );
153+ size_t t = msgrcv (msgid, &message, sizeof (message), 0 , 0 );
154+ emit printLog (" t: " +QString::number (t)+" type: " +QString::number (message.mesg_type )+" \n " );
154155
155156 if (message.mesg_type == 2 ){ // type = 1 (default) -> normal message | -> 2 finish | -> 3 setup
156157 break ;
@@ -169,9 +170,10 @@ void DisplayWindow::changeDisplay(int msgid){
169170 else
170171 buffer.resize (res_x*res_y);
171172 displayPicture = new QImage (res_x, res_y, QImage::Format_RGB32);
172- displayPicture->fill (qRgb (0 , 0 , 0 ));
173+ displayPicture->fill (qRgb (255 , 255 , 255 ));
174+ scrollAreaWidgetContents->setFixedSize (res_x*zoom+26 , res_y*zoom+26 );
175+ this ->setFixedSize (QSize (res_x+60 , res_y+92 ));
173176 displayImageLabel->setPixmap (QPixmap::fromImage (displayPicture->scaled (res_x*zoom,res_y*zoom)));
174- this ->setFixedSize (QSize (res_x+60 , res_y+92 ));
175177 continue ;
176178 }
177179 // display the message and print on display
@@ -182,7 +184,7 @@ void DisplayWindow::changeDisplay(int msgid){
182184 memcpy (buffer.data ()+i, &message.mesg_text [0 ], std::min (8184 , needed_bytes-i));
183185 }
184186 updateDisplay ();
185- qint64 elapsed_time = programExecutionTime.elapsed ();
187+ qint64 elapsed_time = programExecutionTime.elapsed ();
186188 if (elapsed_time < 1000 /fps)
187189 usleep (1000 /fps - elapsed_time);
188190 displayImageLabel->setPixmap (QPixmap::fromImage (displayPicture->scaled (res_x*zoom,res_y*zoom)));
@@ -194,35 +196,8 @@ void DisplayWindow::changeDisplay(int msgid){
194196}
195197
196198void DisplayWindow::finish (int msgid){
197- this ->msgid = msgid;
199+ this ->msgid = msgid;
198200 #ifdef Q_OS_WIN32
199- /* char c[8184];
200- c[0] = 2;
201- HANDLE hFile = CreateFileW(
202- L"\\\\.\\pipe\\SASMPIPE",
203- GENERIC_WRITE,
204- FILE_SHARE_READ | FILE_SHARE_WRITE,
205- NULL,
206- OPEN_EXISTING,
207- 0,
208- NULL);
209- if(hFile == INVALID_HANDLE_VALUE){
210- emit printLog(QString("Could not create file object (")+QString::number(GetLastError())+")\n", Qt::red);
211- return;
212- }
213- DWORD dwNoBytesWrote = 0;
214- BOOL writeSuccess = WriteFile(
215- hFile,
216- c,
217- sizeof(c),
218- &dwNoBytesWrote,
219- NULL);
220- if(!writeSuccess){
221- emit printLog(QString("Could not write to file (")+QString::number(GetLastError())+")\n", Qt::red);
222- }
223- if(!FlushFileBuffers(hFile)){
224- emit printLog(QString("Could not flush the file (")+QString::number(GetLastError())+")\n", Qt::red);
225- }*/
226201 #else
227202 mesg_buffer end;
228203 end.mesg_type = 2 ;
@@ -233,9 +208,8 @@ void DisplayWindow::finish(int msgid){
233208
234209void DisplayWindow::zoomSettingsChanged (int value){
235210 zoom = std::pow (2 , value);
236- updateDisplay ();
237- scrollAreaWidgetContents->setFixedSize (res_x*zoom+26 , res_y*zoom+26 );
238- this ->setFixedSize (QSize (res_x+60 , res_y+92 ));
211+ scrollAreaWidgetContents->setFixedSize (res_x*zoom+26 , res_y*zoom+26 );
212+ this ->setFixedSize (QSize (res_x+60 , res_y+92 ));
239213 displayImageLabel->setPixmap (QPixmap::fromImage (displayPicture->scaled (res_x*zoom, res_y*zoom)));
240214}
241215
0 commit comments