Changeset 384:c4d0f0e6a3db in SMSSender


Ignore:
Timestamp:
Apr 16, 2014 11:15:13 AM (4 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
separation-frontend-backend
Message:
  • Connects the correct signal-slot pairs in Schoolnet send-integration.
  • Makes the Schoolnet send-integration helper in all cases self-destructive.
  • Resizes the send dialog to the required size in the Schoolnet send-integration.
Location:
gateways/Schoolnet/gui/ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gateways/Schoolnet/gui/ui/senddialogintegration.cpp

    r379 r384  
    5454
    5555
    56 SendDialogIntegrationHelper::SendDialogIntegrationHelper(ISendingDialog *sendDialog,
    57                                                          DeepThought::DeepThoughtHelper *deepThoughtHelper,
    58                                                          const Account &account)
     56SendDialogIntegrationHelper::SendDialogIntegrationHelper(
     57        ISendingDialog *sendDialog,
     58        DeepThought::DeepThoughtHelper *deepThoughtHelper,
     59        const Account &account)
    5960    : QObject(sendDialog)
    6061    , m_sendDialog(sendDialog)
     
    6364    , m_question(NULL)
    6465{
    65     //m_oldMinSize = m_sendDialog->minimumSize();
    66 
    6766    m_sendDialog->preventClose();
    68 
    69     // Install the question dialog
    70     QGridLayout *layout = qobject_cast<QGridLayout*>(m_sendDialog->layout());
    71     Q_ASSERT(layout);
    7267
    7368    loadNextQuestion();
    7469    if (m_question) {
     70        // Installs the question dialog.
     71        QGridLayout *layout = qobject_cast<QGridLayout*>(m_sendDialog->layout());
     72        Q_ASSERT(layout);
     73
    7574        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);
    7878        connect(m_questionBox.data(), SIGNAL(nextQuestionRequested()),
    79                 this, SLOT(loadNextQuestion()), Qt::DirectConnection);
     79                this, SLOT(loadNextQuestion()),
     80                Qt::DirectConnection);
    8081        connect(m_questionBox.data(), SIGNAL(rejected()),
    81                 this, SLOT(removeIntegration()), Qt::DirectConnection);
     82                this, SLOT(deleteLater()),
     83                Qt::DirectConnection);
    8284
    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();
    8488    } else {
    85         m_sendDialog->allowClose();
     89        deleteLater();
    8690    }
    8791}
    8892
    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         */
     93SendDialogIntegrationHelper::~SendDialogIntegrationHelper() {
     94    m_questionBox.reset();
     95    m_sendDialog->adjustSize();
    9696
    9797    m_sendDialog->allowClose();
    98     deleteLater();
    9998}
    10099
    101100void SendDialogIntegrationHelper::onAnswerProvided(DeepThought::Answer *answer) {
    102101    m_deepThoughtHelper->proposeAnswer(&m_account, answer);
    103     removeIntegration();
     102    deleteLater();
    104103}
    105104
  • gateways/Schoolnet/gui/ui/senddialogintegration_p.h

    r319 r384  
    3737                                DeepThought::DeepThoughtHelper *deepThoughtHelper,
    3838                                const Account &account);
     39    ~SendDialogIntegrationHelper();
     40
    3941private slots:
    40     void removeIntegration();
    4142    void onAnswerProvided(DeepThought::Answer *answer);
    4243    void loadNextQuestion();
Note: See TracChangeset for help on using the changeset viewer.