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 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. @<SettingsWindow implementation@>=
  20. SettingsWindow::SettingsWindow() : QMainWindow(NULL)
  21. {
  22. QTabWidget *settingsTab = new QTabWidget;
  23. DeviceConfigurationWindow *deviceSettings = new DeviceConfigurationWindow;
  24. settingsTab->addTab(deviceSettings, tr("Roasters"));
  25. GraphSettingsWidget *graphSettings = new GraphSettingsWidget;
  26. settingsTab->addTab(graphSettings, tr("Graph"));
  27. setCentralWidget(settingsTab);
  28. }
  29. @ This widget is made available to the host environment for access wherever
  30. appropriate.
  31. @<Function prototypes for scripting@>=
  32. QScriptValue constructSettingsWindow(QScriptContext *context, QScriptEngine *engine);
  33. @ The constructor is trivial.
  34. @<Functions for scripting@>=
  35. QScriptValue constructSettingsWindow(QScriptContext *, QScriptEngine *engine)
  36. {
  37. QScriptValue object = engine->newQObject(new SettingsWindow);
  38. return object;
  39. }
  40. @ The host environment is informed of this as usual.
  41. @<Set up the scripting engine@>=
  42. constructor = engine->newFunction(constructSettingsWindow);
  43. value = engine->newQMetaObject(&DeviceConfigurationWindow::staticMetaObject, constructor);
  44. engine->globalObject().setProperty("SettingsWindow", value);
  45. @i graphsettings.w