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.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. setCentralWidget(settingsTab);
  30. }
  31. @ This widget is made available to the host environment for access wherever
  32. appropriate.
  33. @<Function prototypes for scripting@>=
  34. QScriptValue constructSettingsWindow(QScriptContext *context, QScriptEngine *engine);
  35. @ The constructor is trivial.
  36. @<Functions for scripting@>=
  37. QScriptValue constructSettingsWindow(QScriptContext *, QScriptEngine *engine)
  38. {
  39. QScriptValue object = engine->newQObject(new SettingsWindow);
  40. return object;
  41. }
  42. @ The host environment is informed of this as usual.
  43. @<Set up the scripting engine@>=
  44. constructor = engine->newFunction(constructSettingsWindow);
  45. value = engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject, constructor);
  46. engine->globalObject().setProperty("SettingsWindow", value);
  47. @i graphsettings.w