Typica is a free program for professional coffee roasters. https://typica.us
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings.w 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. @** A window for program configuration.
  2. \noindent A previous version of Typica introduced a window specifically for
  3. configuring the measurement pipeline in Typica. This is a fairly limited subset
  4. of things that should be more easily configurable in Typica. Starting with
  5. version 1.6 that window has been converted into a widget that is available
  6. through a tab in a more general configuration window with other tabs available
  7. for settings that do not logically belong with a single part of the measurement
  8. pipeline.
  9. @<Class declarations@>=
  10. class SettingsWindow : public QMainWindow@/
  11. {@/
  12. @[Q_OBJECT@]@;
  13. public:@/
  14. SettingsWindow();
  15. };
  16. @ The constructor takes care of the initial interface setup. Most of the
  17. functionality is delegated to more specialized widgets that are available
  18. through a set of tabs.
  19. @s QTabWidget int
  20. @s GraphSettingsWidget int
  21. @<SettingsWindow implementation@>=
  22. SettingsWindow::SettingsWindow() : QMainWindow(NULL)
  23. {
  24. QTabWidget *settingsTab = new QTabWidget;
  25. DeviceConfigurationWindow *deviceSettings = new DeviceConfigurationWindow;
  26. settingsTab->addTab(deviceSettings, tr("Roasters"));
  27. GraphSettingsWidget *graphSettings = new GraphSettingsWidget;
  28. settingsTab->addTab(graphSettings, tr("Graph"));
  29. AdvancedSettingsWidget *advancedSettings = new AdvancedSettingsWidget;
  30. settingsTab->addTab(advancedSettings, tr("Advanced"));
  31. setCentralWidget(settingsTab);
  32. }
  33. @ This widget is made available to the host environment for access wherever
  34. appropriate.
  35. @<Function prototypes for scripting@>=
  36. QScriptValue constructSettingsWindow(QScriptContext *context, QScriptEngine *engine);
  37. @ The constructor is trivial.
  38. @<Functions for scripting@>=
  39. QScriptValue constructSettingsWindow(QScriptContext *, QScriptEngine *engine)
  40. {
  41. QScriptValue object = engine->newQObject(new SettingsWindow);
  42. return object;
  43. }
  44. @ The host environment is informed of this as usual.
  45. @<Set up the scripting engine@>=
  46. constructor = engine->newFunction(constructSettingsWindow);
  47. value = engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject, constructor);
  48. engine->globalObject().setProperty("SettingsWindow", value);
  49. @i graphsettings.w
  50. @i advancedsettings.w