Browse Source

Choose tab based on existence of scheduled batches

Neal Wilson 6 years ago
parent
commit
558e8daae1
3 changed files with 367 additions and 345 deletions
  1. 5
    1
      config/Windows/newbatch.xml
  2. 353
    344
      src/typica.cpp
  3. 9
    0
      src/typica.w

+ 5
- 1
config/Windows/newbatch.xml View File

@@ -149,7 +149,6 @@
149 149
             tabs.currentChanged.connect(function(index) {
150 150
                 pages.setCurrentIndex(index);
151 151
             });
152
-            tabs.setCurrentIndex(1);
153 152
             var batches = findChildObject(this, 'batches');
154 153
             var filter = findChildObject(this, 'filter');
155 154
             var filtervalue = findChildObject(this, 'filtervalue');
@@ -177,6 +176,11 @@
177 176
                 updateSchedule();
178 177
             });
179 178
             updateSchedule();
179
+            if(batches.rows() > 0) {
180
+                tabs.setCurrentIndex(0);
181
+            } else {
182
+                tabs.setCurrentIndex(1);
183
+            }
180 184
             batches.setHeaderData(0, TTR("batchWindow", "ID"));
181 185
             batches.setHeaderData(1, TTR("batchWindow", "Roasted Coffee"));
182 186
             batches.setHeaderData(2, TTR("batchWindow", "Green Weight"));

+ 353
- 344
src/typica.cpp
File diff suppressed because it is too large
View File


+ 9
- 0
src/typica.w View File

@@ -14201,6 +14201,8 @@ QScriptValue SqlQueryView_setQuery(QScriptContext *context,
14201 14201
                                    QScriptEngine *engine);
14202 14202
 QScriptValue SqlQueryView_setHeaderData(QScriptContext *context,
14203 14203
                                         QScriptEngine *engine);
14204
+QScriptValue SqlQueryView_rows(QScriptContext *context,
14205
+                               QScriptEngine *engine);
14204 14206
 
14205 14207
 @ The script constructor is passed to the host environment.
14206 14208
 
@@ -14226,6 +14228,7 @@ void setSqlQueryViewProperties(QScriptValue value, QScriptEngine *engine)
14226 14228
     value.setProperty("setHeaderData",
14227 14229
                       engine->newFunction(SqlQueryView_setHeaderData));
14228 14230
     value.setProperty("setQuery", engine->newFunction(SqlQueryView_setQuery));
14231
+    value.setProperty("rows", engine->newFunction(SqlQueryView_rows));
14229 14232
 }
14230 14233
 
14231 14234
 @ The properties added are simplified wrappers around the class methods.
@@ -14250,6 +14253,12 @@ QScriptValue SqlQueryView_setHeaderData(QScriptContext *context,
14250 14253
     return QScriptValue();
14251 14254
 }
14252 14255
 
14256
+QScriptValue SqlQueryView_rows(QScriptContext *context, QScriptEngine *)
14257
+{
14258
+    SqlQueryView *self = getself<SqlQueryView *>(context);
14259
+    return QScriptValue(self->model()->rowCount());
14260
+}
14261
+
14253 14262
 @** Reporting.
14254 14263
 
14255 14264
 \noindent \pn{} version 1.4 added a new type of menu which is designed to

Loading…
Cancel
Save