changeset 1476:c268fe2ad597 by-id

Couple more updates
author Chris Cannam
date Tue, 02 Jul 2019 15:38:37 +0100
parents 84c4ddb38415
children 0769eaacc6bf
files view/View.cpp widgets/AudioDial.cpp widgets/InteractiveFileFinder.cpp
diffstat 3 files changed, 26 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/view/View.cpp	Tue Jul 02 15:29:17 2019 +0100
+++ b/view/View.cpp	Tue Jul 02 15:38:37 2019 +0100
@@ -1750,8 +1750,9 @@
 
         if (i->second.cancel == cancel) {
 
+/*!!!
             Layer *layer = i->first;
-/*!!!            Model *model = layer->getModel();
+            Model *model = layer->getModel();
 
             //!!! todo: restore this behaviour
             if (model) model->abandon();
@@ -1819,20 +1820,21 @@
                 m_lastError = error;
             }
 
-            Model *model = i->first->getModel();
-            RangeSummarisableTimeValueModel *wfm = 
-                dynamic_cast<RangeSummarisableTimeValueModel *>(model);
+            ModelId modelId = i->first->getModel();
+
+            auto model = ModelById::get(modelId);
+            auto wfm = std::dynamic_pointer_cast
+                <RangeSummarisableTimeValueModel>(model);
 
             if (completion > 0) {
                 pb->setMaximum(100); // was 0, for indeterminate start
             }
 
             if (completion >= 100) {
-
-                //!!!
+                
                 if (wfm ||
                     (model && 
-                     (wfm = dynamic_cast<RangeSummarisableTimeValueModel *>
+                     (wfm = ModelById::getAs<RangeSummarisableTimeValueModel>
                       (model->getSourceModel())))) {
                     completion = wfm->getAlignmentCompletion();
 
@@ -2366,6 +2368,11 @@
                       (i->getEndFrame() - i->getStartFrame(), sampleRate)
                       .toText(true)))
                 .arg(i->getEndFrame() - i->getStartFrame());
+            
+    // Qt 5.13 deprecates QFontMetrics::width(), but its suggested
+    // replacement (horizontalAdvance) was only added in Qt 5.11
+    // which is too new for us
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
             int sw = metrics.width(startText),
                 ew = metrics.width(endText),
--- a/widgets/AudioDial.cpp	Tue Jul 02 15:29:17 2019 +0100
+++ b/widgets/AudioDial.cpp	Tue Jul 02 15:38:37 2019 +0100
@@ -132,7 +132,7 @@
         
     QColor knobColor(m_knobColor);
     if (knobColor == Qt::black) {
-        knobColor = palette().window().color().light(150);
+        knobColor = palette().window().color().lighter(150);
     }
     bool knobIsDark =
         (knobColor.red() + knobColor.green() + knobColor.blue() <= 384);
@@ -183,9 +183,9 @@
     int darkWidth = (width-2*indent) * 3 / 4;
     while (darkWidth) {
         if (knobIsDark) {
-            c = c.dark(102);
+            c = c.darker(102);
         } else {
-            c = c.light(102);
+            c = c.lighter(102);
         }
         pen.setColor(c);
         paint.setPen(pen);
@@ -238,9 +238,9 @@
 
     int shadowAngle = -720;
     if (knobIsDark) {
-        c = knobColor.light();
+        c = knobColor.lighter();
     } else {
-        c = knobColor.dark();
+        c = knobColor.darker();
     }
     for (int arc = 120; arc < 2880; arc += 240) {
         pen.setColor(c);
@@ -250,9 +250,9 @@
         paint.drawArc(indent, indent,
                       width-2*indent, width-2*indent, shadowAngle - arc, 240);
         if (knobIsDark) {
-            c = c.dark(110);
+            c = c.darker(110);
         } else {
-            c = c.light(110);
+            c = c.lighter(110);
         }
     }
 
@@ -266,7 +266,7 @@
         int arc = i * 240 + 120;
         paint.drawArc(scale/2, scale/2,
                       width-scale, width-scale, shadowAngle + arc, 240);
-        c = c.light(110);
+        c = c.lighter(110);
     }
     c = palette().shadow().color();
     for (int i = 0; i < 12; ++i) {
@@ -275,7 +275,7 @@
         int arc = i * 240 + 120;
         paint.drawArc(scale/2, scale/2,
                       width-scale, width-scale, shadowAngle - arc, 240);
-        c = c.light(110);
+        c = c.lighter(110);
     }
 
     // Scale ends...
@@ -310,9 +310,9 @@
     c = notchColor;
     if (isEnabled()) {
         if (knobIsDark) {
-            c = c.light(130);
+            c = c.lighter(130);
         } else {
-            c = c.dark(130);
+            c = c.darker(130);
         }
     }
     pen.setColor(c);
--- a/widgets/InteractiveFileFinder.cpp	Tue Jul 02 15:29:17 2019 +0100
+++ b/widgets/InteractiveFileFinder.cpp	Tue Jul 02 15:38:37 2019 +0100
@@ -388,7 +388,7 @@
     dialog.setDirectory(lastPath);
     dialog.setAcceptMode(QFileDialog::AcceptSave);
     dialog.setFileMode(QFileDialog::AnyFile);
-    dialog.setConfirmOverwrite(false); // we'll do that
+    dialog.setOption(QFileDialog::DontConfirmOverwrite, true); // we'll do that
     
     QString defaultSuffix;
     if (type == SessionFile) {