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

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