Changeset 384:c4d0f0e6a3db in SMSSender
- Timestamp:
- Apr 16, 2014 11:15:13 AM (7 years ago)
- Branch:
- separation-frontend-backend
- Location:
- gateways/Schoolnet/gui/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gateways/Schoolnet/gui/ui/senddialogintegration.cpp
r379 r384 54 54 55 55 56 SendDialogIntegrationHelper::SendDialogIntegrationHelper(ISendingDialog *sendDialog, 57 DeepThought::DeepThoughtHelper *deepThoughtHelper, 58 const Account &account) 56 SendDialogIntegrationHelper::SendDialogIntegrationHelper( 57 ISendingDialog *sendDialog, 58 DeepThought::DeepThoughtHelper *deepThoughtHelper, 59 const Account &account) 59 60 : QObject(sendDialog) 60 61 , m_sendDialog(sendDialog) … … 63 64 , m_question(NULL) 64 65 { 65 //m_oldMinSize = m_sendDialog->minimumSize();66 67 66 m_sendDialog->preventClose(); 68 69 // Install the question dialog70 QGridLayout *layout = qobject_cast<QGridLayout*>(m_sendDialog->layout());71 Q_ASSERT(layout);72 67 73 68 loadNextQuestion(); 74 69 if (m_question) { 70 // Installs the question dialog. 71 QGridLayout *layout = qobject_cast<QGridLayout*>(m_sendDialog->layout()); 72 Q_ASSERT(layout); 73 75 74 m_questionBox.reset(new DeepThought::UI::QuestionBox(*m_question, sendDialog)); 76 connect(m_questionBox.data(), SIGNAL(answerProvided(Answer*)), 77 this, SLOT(onAnswerProvided(Answer*)), Qt::DirectConnection); 75 connect(m_questionBox.data(), SIGNAL(answerProvided(DeepThought::Answer*)), 76 this, SLOT(onAnswerProvided(DeepThought::Answer*)), 77 Qt::DirectConnection); 78 78 connect(m_questionBox.data(), SIGNAL(nextQuestionRequested()), 79 this, SLOT(loadNextQuestion()), Qt::DirectConnection); 79 this, SLOT(loadNextQuestion()), 80 Qt::DirectConnection); 80 81 connect(m_questionBox.data(), SIGNAL(rejected()), 81 this, SLOT(removeIntegration()), Qt::DirectConnection); 82 this, SLOT(deleteLater()), 83 Qt::DirectConnection); 82 84 83 layout->addWidget(m_questionBox.data(), layout->rowCount()+1, 0, layout->columnCount()-1, layout->columnCount()); 85 layout->addWidget(m_questionBox.data(), layout->rowCount()+1, 0, 86 layout->columnCount()-1, layout->columnCount()); 87 m_sendDialog->adjustSize(); 84 88 } else { 85 m_sendDialog->allowClose();89 deleteLater(); 86 90 } 87 91 } 88 92 89 void SendDialogIntegrationHelper::removeIntegration() { 90 /* Resize the sending dialog 91 m_sendDialog->setMinimumSize(0, 0); 92 m_sendDialog->adjustSize(); 93 m_sendDialog->setMinimumSize(std::max(m_oldMinSize.width(), m_sendDialog->size().width()), 94 std::max(m_oldMinSize.height(), m_sendDialog->size().height())); 95 */ 93 SendDialogIntegrationHelper::~SendDialogIntegrationHelper() { 94 m_questionBox.reset(); 95 m_sendDialog->adjustSize(); 96 96 97 97 m_sendDialog->allowClose(); 98 deleteLater();99 98 } 100 99 101 100 void SendDialogIntegrationHelper::onAnswerProvided(DeepThought::Answer *answer) { 102 101 m_deepThoughtHelper->proposeAnswer(&m_account, answer); 103 removeIntegration();102 deleteLater(); 104 103 } 105 104 -
gateways/Schoolnet/gui/ui/senddialogintegration_p.h
r319 r384 37 37 DeepThought::DeepThoughtHelper *deepThoughtHelper, 38 38 const Account &account); 39 ~SendDialogIntegrationHelper(); 40 39 41 private slots: 40 void removeIntegration();41 42 void onAnswerProvided(DeepThought::Answer *answer); 42 43 void loadNextQuestion();
Note: See TracChangeset
for help on using the changeset viewer.