Typica is a free program for professional coffee roasters. https://typica.us
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. @* The Feedback Wizard.
  2. \noindent While the About Typica window includes a link for sending email, this
  3. is not as obvious as a Send Feedback option from the Help menu. It also does
  4. not provide an adequate amount of prompting for feedback to be useful.
  5. This functionality is provided in the form of a |QWizard| and five
  6. |QWizardPage|s to guide people through the feedback process.
  7. @(feedback.h@>=
  8. #include <QWizard>
  9. #include <QComboBox>
  10. #include <QTextEdit>
  11. #include <QLabel>
  12. #ifndef FeedbackHeader
  13. #define FeedbackHeader
  14. class FeedbackWizard : public QWizard
  15. {
  16. Q_OBJECT
  17. public:
  18. FeedbackWizard();
  19. private slots:
  20. void setCommentInstructions(int index);
  21. private:
  22. QComboBox *feedbackType;
  23. QLabel *commentInstructions;
  24. QTextEdit *comment;
  25. };
  26. #endif
  27. @ Implementation is in a separate file.
  28. @(feedback.cpp@>=
  29. #include "feedback.h"
  30. #include <QLabel>
  31. #include <QVBoxLayout>
  32. #include <QWizardPage>
  33. @<Feedback wizard implementation@>@;
  34. @ The feedback wizard constructor is responsible for setting up its appearance,
  35. adding pages, and ensuring connections for properly responding to input are set
  36. up.
  37. @<Feedback wizard implementation@>=
  38. FeedbackWizard::FeedbackWizard() : QWizard()
  39. {
  40. @<Set wizard graphics@>@;
  41. @<Set feedback wizard pages@>@;
  42. }
  43. @ At present we do not have any custom graphics for wizards. If we did, they
  44. would go here.
  45. @<Set wizard graphics@>=
  46. /* Nothing needs to be done here. */
  47. @ The first page presented is an introduction page where we would like to know
  48. what sort of feedback is going to be provided. This is selected in a
  49. |QComboBox| which wil be used to update information on later pages.
  50. @<Set feedback wizard pages@>=
  51. QWizardPage *introPage = new QWizardPage;
  52. introPage->setTitle(tr("Send Feedback"));
  53. introPage->setSubTitle("Select the type of feedback you wish to provide");
  54. setPixmap(QWizard::LogoPixmap, QPixmap(":/resources/icons/appicons/logo48.png"));
  55. QLabel *page1prompt = new QLabel(tr("What sort of feedback would you like to provide?"));
  56. feedbackType = new QComboBox;
  57. feedbackType->addItem(tr("Bug Report"));
  58. feedbackType->addItem(tr("Comment"));
  59. feedbackType->addItem(tr("Feature Request"));
  60. feedbackType->addItem(tr("Question"));
  61. QVBoxLayout *page1layout = new QVBoxLayout;
  62. page1layout->addStretch();
  63. page1layout->addWidget(page1prompt);
  64. page1layout->addWidget(feedbackType);
  65. page1layout->addStretch();
  66. introPage->setLayout(page1layout);
  67. addPage(introPage);
  68. connect(feedbackType, SIGNAL(currentIndexChanged(int)), this, SLOT(setCommentInstructions(int)));
  69. commentInstructions = new QLabel;
  70. commentInstructions->setWordWrap(true);
  71. setCommentInstructions(0);
  72. @ The selection on the first page influences the instructions provided on the
  73. second page.
  74. @<Feedback wizard implementation@>=
  75. void FeedbackWizard::setCommentInstructions(int index)
  76. {
  77. switch(index)
  78. {
  79. case 0:
  80. commentInstructions->setText(tr("Please provide as complete a description of the issue as possible. Useful information includes step by step instructions for replicating the issue, the resulting behavior, and what you expected."));
  81. break;
  82. case 1:
  83. commentInstructions->setText(tr("If you would like action to occur based on your comment, please be specific."));
  84. break;
  85. case 2:
  86. commentInstructions->setText(tr("Please try to be as clear as possible about what you want, where you believe this would fit in with what is already provided, and provide a description of why this would be useful."));
  87. break;
  88. case 3:
  89. commentInstructions->setText(tr("Please be specific and provide any information that you think might be useful in answering your question."));
  90. break;
  91. default:
  92. commentInstructions->setText("");
  93. break;
  94. }
  95. }
  96. @ The second page provides both guidance on writing feedback and an area for typing this.
  97. @<Set feedback wizard pages@>=
  98. QWizardPage *commentPage = new QWizardPage;
  99. commentPage->setTitle(tr("Send Feedback"));
  100. commentPage->setSubTitle(tr("Your feedback is appreciated"));
  101. comment = new QTextEdit;
  102. QVBoxLayout *page2layout = new QVBoxLayout;
  103. page2layout->addStretch();
  104. page2layout->addWidget(commentInstructions);
  105. page2layout->addWidget(comment);
  106. page2layout->addStretch();
  107. commentPage->setLayout(page2layout);
  108. addPage(commentPage);