1 |
|
#include "wmformatpage.h" |
2 |
|
#include "ui_wmformatpage.h" |
3 |
|
|
4 |
< |
WmFormatPage::WmFormatPage(Logger *myLogger, QWidget *parent) : |
4 |
> |
WmFormatPage::WmFormatPage(QWidget *parent) : |
5 |
|
QWizardPage(parent), |
6 |
|
ui(new Ui::WmFormatPage) |
7 |
|
{ |
8 |
|
ui->setupUi(this); |
9 |
|
|
10 |
– |
this->myLogger = myLogger; |
11 |
– |
|
10 |
|
this->setTitle("Pages Formatting"); |
11 |
|
this->setSubTitle("Create and format the pages here.\nNote that Oni doesn't support partial words formatting so the whole line will be formatted."); |
12 |
|
setupComboBoxTextSize(); |
48 |
|
ui->pbDeleteCurrentPage->setEnabled(true); |
49 |
|
break; |
50 |
|
case WINDOW_TYPE::ENUM_END: |
51 |
< |
UtilVago::showAndLogErrorPopUp(this->myLogger, "An error ocurred: WmFormatPage::initializePage invalid WINDOW_TYPE"); |
51 |
> |
UtilVago::showAndLogErrorPopUp("An error ocurred: WmFormatPage::initializePage invalid WINDOW_TYPE"); |
52 |
|
break; |
53 |
|
} |
54 |
|
|
69 |
|
currentPage->getFooterText().toPlainText().trimmed() == "" |
70 |
|
) |
71 |
|
{ |
72 |
< |
Util::showErrorPopUp("You need to fill at least one text section in all pages!"); |
72 |
> |
Util::Dialogs::showError("You need to fill at least one text section in all pages!"); |
73 |
|
return false; |
74 |
|
} |
75 |
|
|
77 |
|
|
78 |
|
// If we can add more than one page, ask the user if he already added them all |
79 |
|
if(ui->pbAddPageAfter->isEnabled()){ |
80 |
< |
return Util::showQuestionPopUp(this, "Have you added all the window pages?"); |
80 |
> |
return Util::Dialogs::showQuestion(this, "Have you added all the window pages?"); |
81 |
|
} |
82 |
|
|
83 |
|
return true; |
123 |
|
this->currentPages[indexForInsertion]->showFooterText(); |
124 |
|
break; |
125 |
|
case WINDOW_TYPE::ENUM_END: |
126 |
< |
UtilVago::showAndLogErrorPopUp(this->myLogger, "An error ocurred: WmFormatPage::addPage invalid WINDOW_TYPE"); |
126 |
> |
UtilVago::showAndLogErrorPopUp("An error ocurred: WmFormatPage::addPage invalid WINDOW_TYPE"); |
127 |
|
break; |
128 |
|
} |
129 |
|
|
187 |
|
} |
188 |
|
|
189 |
|
if(textEdits.size() == 0){ |
190 |
< |
Util::showPopUp("Select some text first."); |
190 |
> |
Util::Dialogs::showInfo("Select some text first."); |
191 |
|
return; |
192 |
|
} |
193 |
|
|
249 |
|
double newFontSize = ui->cbTextSize->currentText().toDouble(&ok); |
250 |
|
|
251 |
|
if(!ok){ |
252 |
< |
Util::showErrorPopUp("The inputted font size is not valid!"); |
252 |
> |
Util::Dialogs::showError("The inputted font size is not valid!"); |
253 |
|
ui->cbTextSize->setCurrentIndex(0); // reset to default number |
254 |
|
return; |
255 |
|
} |
276 |
|
void WmFormatPage::on_pbDeleteCurrentPage_clicked() |
277 |
|
{ |
278 |
|
if(ui->twPages->count() <= 1){ |
279 |
< |
Util::showErrorPopUp("You must have at least one page!"); |
279 |
> |
Util::Dialogs::showError("You must have at least one page!"); |
280 |
|
return; |
281 |
|
} |
282 |
|
|
283 |
< |
if(Util::showQuestionPopUp(this, "Are you sure do you want to delete the current page?")){ |
283 |
> |
if(Util::Dialogs::showQuestion(this, "Are you sure do you want to delete the current page?")){ |
284 |
|
int indexToDelete = ui->twPages->currentIndex(); |
285 |
|
|
286 |
|
currentPages.removeAt(indexToDelete); |