[med-svn] [Git][med-team/edfbrowser][upstream] New upstream version 1.91+dfsg

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Fri Feb 11 12:13:12 GMT 2022



Étienne Mollier pushed to branch upstream at Debian Med / edfbrowser


Commits:
59967834 by Étienne Mollier at 2022-02-05T19:04:32+01:00
New upstream version 1.91+dfsg
- - - - -


9 changed files:

- check_edf_file.cpp
- doc/manual.html
- global.h
- mainwindow.cpp
- mainwindow.h
- mainwindow_constr.cpp
- qt_headers.h
- read_write_settings.cpp
- version.txt


Changes:

=====================================
check_edf_file.cpp
=====================================
@@ -1345,7 +1345,7 @@ struct edfhdrblock * EDFfileCheck::check_edf_file(FILE *inputfile, char *txt_str
     }
 
     p = 0;
-    if(edfhdr->patient[p]=='X')
+    if((edfhdr->patient[p]=='X') && (edfhdr->patient[p+1]==' '))
     {
       edfhdr->plus_patientcode[0] = 0;
       p += 2;
@@ -1594,7 +1594,7 @@ struct edfhdrblock * EDFfileCheck::check_edf_file(FILE *inputfile, char *txt_str
 
     edfhdr->plus_admincode_offset = p;
 
-    if(edfhdr->recording[p]=='X')
+    if((edfhdr->recording[p]=='X') && (edfhdr->recording[p+1]==' '))
     {
       edfhdr->plus_admincode[0] = 0;
       p += 2;
@@ -1616,7 +1616,7 @@ struct edfhdrblock * EDFfileCheck::check_edf_file(FILE *inputfile, char *txt_str
 
     edfhdr->plus_technician_offset = p;
 
-    if(edfhdr->recording[p]=='X')
+    if((edfhdr->recording[p]=='X') && (edfhdr->recording[p+1]==' '))
     {
       edfhdr->plus_technician[0] = 0;
       p += 2;
@@ -1638,7 +1638,7 @@ struct edfhdrblock * EDFfileCheck::check_edf_file(FILE *inputfile, char *txt_str
 
     edfhdr->plus_equipment_offset = p;
 
-    if(edfhdr->recording[p]=='X')
+    if((edfhdr->recording[p]=='X') && (edfhdr->recording[p+1]==' '))
     {
       edfhdr->plus_equipment[0] = 0;
       p += 2;


=====================================
doc/manual.html
=====================================
@@ -21,7 +21,7 @@
     </style>
 </head><body>
 
-<h1>EDFbrowser 1.90 manual</h1>
+<h1>EDFbrowser 1.91 manual</h1>
 
 <p><br></p>
 


=====================================
global.h
=====================================
@@ -59,7 +59,7 @@
 #define QT_NO_DEPRECATED_WARNINGS
 
 #define PROGRAM_NAME                "EDFbrowser"
-#define PROGRAM_VERSION                   "1.90"
+#define PROGRAM_VERSION                   "1.91"
 #define PROGRAM_BETA_SUFFIX                   ""
 #define MINIMUM_QT4_VERSION             0x040701
 #define MINIMUM_QT5_VERSION             0x050901


=====================================
mainwindow.cpp
=====================================
@@ -126,6 +126,9 @@ void UI_Mainwindow::closeEvent(QCloseEvent *cl_event)
 
     close_all_files();
 
+    window_width_sav_rest = width();
+    window_height_sav_rest = height();
+
     write_settings();
 
     free(spectrum_colorbar);
@@ -1480,7 +1483,7 @@ void UI_Mainwindow::open_new_file()
 
   rc_file_open_err = 0;
 
-  if(edflib_version() != 120)  return;
+  if(edflib_version() != 121)  return;
 
   if(annot_editor_active && files_open)
   {
@@ -3944,17 +3947,17 @@ QString UI_Mainwindow::specialFolder(int type)
         typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL);
         GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW");
         if (SHGetSpecialFolderPath) {
-            TCHAR path[MAX_PATH];
-            SHGetSpecialFolderPath(0, path, type, false);
-            result = QString::fromUtf16((ushort*)path);
+            TCHAR path_w[MAX_PATH];
+            SHGetSpecialFolderPath(0, path_w, type, false);
+            result = QString::fromUtf16((ushort*)path_w);
         }
     } , {
         typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, char*, int, BOOL);
         GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathA");
         if (SHGetSpecialFolderPath) {
-            char path[MAX_PATH];
-            SHGetSpecialFolderPath(0, path, type, false);
-            result = QString::fromLocal8Bit(path);
+            char path_w[MAX_PATH];
+            SHGetSpecialFolderPath(0, path_w, type, false);
+            result = QString::fromLocal8Bit(path_w);
         }
     } );
 
@@ -4622,7 +4625,56 @@ void UI_Mainwindow::signalcomp_invert(int inv, int n)
 }
 
 
+void UI_Mainwindow::desktop_resized(int)
+{
+  QFontMetrics fm(*myfont);
+
+  font_pixel_height = fm.ascent();
+
+#if QT_VERSION >= 0x050B00
+  font_pixel_width = (fm.horizontalAdvance("ABCDEFGHIJKLMNOPQRSTUVWXYZ") / 26.0) + 0.5;
+#else
+  font_pixel_width = (fm.width("ABCDEFGHIJKLMNOPQRSTUVWXYZ") / 26.0) + 0.5;
+#endif
+//  printf("font_pixel_height: %i    font_pixel_width: %i\n", font_pixel_height, font_pixel_width);
+
+  h_scaling = fm.height() / 18.0;
+
+#if QT_VERSION >= 0x050B00
+  w_scaling = fm.horizontalAdvance("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") / 260.0;
+#else
+  w_scaling = fm.width("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") / 260.0;
+#endif
+
+  if(w_scaling > 4.0)  w_scaling = 4.0;
+  if(w_scaling < 1.0)  w_scaling = 1.0;
+
+  if(h_scaling > 4.0)  h_scaling = 4.0;
+  if(h_scaling < 1.0)  h_scaling = 1.0;
+
+//  printf("w_scaling: %f    h_scaling: %f\n", w_scaling, h_scaling);
+
+  dpix = maincurve->physicalDpiX();
 
+  dpiy = maincurve->physicalDpiY();
+
+//  printf("dpix: %i    dpiy: %i\n", dpix, dpiy);
+
+  if(auto_dpi)
+  {
+    y_pixelsizefactor = 2.54 / dpiy;
+
+    x_pixelsizefactor = 2.54 / dpix;
+  }
+
+  maincurve->update();
+}
+
+
+void UI_Mainwindow::screen_changed(QScreen *)
+{
+  desktop_resized(0);
+}
 
 
 


=====================================
mainwindow.h
=====================================
@@ -263,7 +263,9 @@ public:
       rc_load_mtg_file_num,
       rc_err_queue_idx,
       rc_err_queue[RC_ERR_QUEUE_SZ],
-      rc_system_locked;
+      rc_system_locked,
+      window_width_sav_rest,
+      window_height_sav_rest;
 
 volatile int rc_cmd_in_progress;
 
@@ -710,6 +712,8 @@ private slots:
   void rc_host_server_new_connection();
   void rc_host_sock_rxdata_handler();
   void rc_host_sock_disconnected_handler();
+  void desktop_resized(int);
+  void screen_changed(QScreen *);
 //  void search_pattern();
 
 protected:


=====================================
mainwindow_constr.cpp
=====================================
@@ -161,6 +161,9 @@ UI_Mainwindow::UI_Mainwindow()
 
   edf_debug = 0;
 
+  window_width_sav_rest = 0;
+  window_height_sav_rest = 0;
+
   for(i=0; i<8; i++)
   {
     annot_edit_user_button_enabled[i] = 0;
@@ -1270,7 +1273,32 @@ UI_Mainwindow::UI_Mainwindow()
     }
   }
 
-  showMaximized();
+#if QT_VERSION >= 0x050B00
+//   if((window_width_sav_rest > (QGuiApplication::screens()[0]->availableGeometry().width())) ||
+//      (window_height_sav_rest > (QGuiApplication::screens()[0]->availableGeometry().height())))
+  if((window_width_sav_rest > (QGuiApplication::primaryScreen()->availableGeometry().width())) ||
+     (window_height_sav_rest > (QGuiApplication::primaryScreen()->availableGeometry().height())))
+  {
+    window_width_sav_rest = 0;
+    window_height_sav_rest = 0;
+  }
+#else
+  if((window_width_sav_rest > (QApplication::desktop()->availableGeometry().width())) ||
+     (window_height_sav_rest > (QApplication::desktop()->availableGeometry().height())))
+  {
+    window_width_sav_rest = 0;
+    window_height_sav_rest = 0;
+  }
+#endif
+  if((!window_width_sav_rest) || (!window_height_sav_rest))
+  {
+    showMaximized();
+  }
+  else
+  {
+    resize(window_width_sav_rest, window_height_sav_rest);
+    show();
+  }
 
   maincurve->setFocus(Qt::OtherFocusReason);
 
@@ -1333,7 +1361,7 @@ UI_Mainwindow::UI_Mainwindow()
 
   update_checker = NULL;
 
-  if(edflib_version() != 120)
+  if(edflib_version() != 121)
   {
     cmdlineargument = 0;
 
@@ -1408,7 +1436,11 @@ UI_Mainwindow::UI_Mainwindow()
     }
   }
 
-  QObject::connect(maincurve, SIGNAL(file_dropped()), this, SLOT(open_new_file()));
+  QObject::connect(maincurve,                      SIGNAL(file_dropped()),          this, SLOT(open_new_file()));
+#if QT_VERSION >= 0x050000
+  QObject::connect(this->window()->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(screen_changed(QScreen*)));
+#endif
+  QObject::connect(QApplication::desktop(),        SIGNAL(resized(int)),            this, SLOT(desktop_resized(int)));
 }
 
 


=====================================
qt_headers.h
=====================================
@@ -11,10 +11,14 @@
 #ifndef QT_HEADERS_INCLUDE_H
 #define QT_HEADERS_INCLUDE_H
 
-
 #include <QtGlobal>
 #include <QObject>
 #include <QApplication>
+#include <QDesktopWidget>
+#if QT_VERSION >= 0x050000
+#include <QGuiApplication>
+#endif
+#include <QScreen>
 #include <QStyle>
 #include <QStyleFactory>
 #include <QEvent>
@@ -118,12 +122,10 @@
 #include <QBrush>
 #include <QColorDialog>
 #include <QElapsedTimer>
-#include <QDesktopWidget>
 #include <QPainterPath>
 #include <QShortcut>
 #include <QTcpServer>
 #include <QMutex>
-
 #if QT_VERSION >= 0x050200
 #include <QFontDatabase>
 #endif


=====================================
read_write_settings.cpp
=====================================
@@ -663,6 +663,49 @@ void UI_Mainwindow::read_general_settings()
     xml_go_up(xml_hdl);
   }
 
+  if(!(xml_goto_nth_element_inside(xml_hdl, "window_geometry", 0)))
+  {
+    if(xml_goto_nth_element_inside(xml_hdl, "window_width_sav_rest", 0))
+    {
+      xml_close(xml_hdl);
+      return;
+    }
+    if(xml_get_content_of_element(xml_hdl, result, XML_STRBUFLEN))
+    {
+      xml_close(xml_hdl);
+      return;
+    }
+
+    window_width_sav_rest = atoi(result);
+    if((window_width_sav_rest < 640) || (window_width_sav_rest > 100000))
+    {
+      window_width_sav_rest = 0;
+    }
+
+    xml_go_up(xml_hdl);
+
+    if(xml_goto_nth_element_inside(xml_hdl, "window_height_sav_rest", 0))
+    {
+      xml_close(xml_hdl);
+      return;
+    }
+    if(xml_get_content_of_element(xml_hdl, result, XML_STRBUFLEN))
+    {
+      xml_close(xml_hdl);
+      return;
+    }
+
+    window_height_sav_rest = atoi(result);
+    if((window_height_sav_rest < 480) || (window_height_sav_rest > 100000))
+    {
+      window_height_sav_rest = 0;
+      window_width_sav_rest = 0;
+    }
+
+    xml_go_up(xml_hdl);
+  }
+  xml_go_up(xml_hdl);
+
   if(xml_goto_nth_element_inside(xml_hdl, "pixelsizefactor", 0))
   {
     xml_close(xml_hdl);
@@ -2675,8 +2718,14 @@ void UI_Mainwindow::write_settings()
                      "  <cfg_app_version>" PROGRAM_NAME " " PROGRAM_VERSION "</cfg_app_version>\n"
                      "  <UI>\n"
                      "    <font_size>%i</font_size>\n"
-                     "    <monofont_size>%i</monofont_size>\n"
-                     "    <colors>\n", font_size, monofont_size);
+                     "    <monofont_size>%i</monofont_size>\n", font_size, monofont_size);
+
+    fprintf(cfgfile, "    <window_geometry>\n"
+                     "      <window_width_sav_rest>%i</window_width_sav_rest>\n"
+                     "      <window_height_sav_rest>%i</window_height_sav_rest>\n"
+                     "    </window_geometry>\n", window_width_sav_rest, window_height_sav_rest);
+
+    fprintf(cfgfile, "    <colors>\n");
 
     fprintf(cfgfile, "      <backgroundcolor>\n"
                     "        <red>%i</red>\n"


=====================================
version.txt
=====================================
@@ -1,4 +1,14 @@
 
+ version 1.91      February 4, 2022
+ --------------
+
+ - Save/restore the windowsize when closing/starting the program.
+
+ - Fixed a bug where EDFplus patient and recording subfields where not read correctly if they started with an 'X'.
+
+ - Adjust scaling when dragged to another screen with a different resolution.
+
+
  version 1.90      January 2, 2022
  --------------
 



View it on GitLab: https://salsa.debian.org/med-team/edfbrowser/-/commit/59967834166ca9b6f4e76c80373a626cf808c4ae

-- 
View it on GitLab: https://salsa.debian.org/med-team/edfbrowser/-/commit/59967834166ca9b6f4e76c80373a626cf808c4ae
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220211/43403548/attachment-0001.htm>


More information about the debian-med-commit mailing list