Mercurial > clickerconvert
comparison src/mainwindow.cpp @ 53:a43d8cf2fa95
Various fixes and improvements. Fix windows packaging.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 19 Jul 2016 17:45:57 +0200 |
parents | 36ee5dd46fd3 |
children | 82d38421fdf3 |
comparison
equal
deleted
inserted
replaced
52:263880612637 | 53:a43d8cf2fa95 |
---|---|
50 inoutLay->addWidget(inputLabel, 0, 0); | 50 inoutLay->addWidget(inputLabel, 0, 0); |
51 mInputRequester = new FileNameRequester(QDir::Files); | 51 mInputRequester = new FileNameRequester(QDir::Files); |
52 mInputRequester->setExistingOnly(true); | 52 mInputRequester->setExistingOnly(true); |
53 inputLabel->setBuddy(mInputRequester); | 53 inputLabel->setBuddy(mInputRequester); |
54 | 54 |
55 setWindowTitle(QStringLiteral(PRETTY_NAME)); | |
56 | |
55 inoutLay->addWidget(mInputRequester, 0, 1); | 57 inoutLay->addWidget(mInputRequester, 0, 1); |
56 | 58 |
57 auto outLabel = new QLabel(tr("Export Folder:")); | 59 auto outLabel = new QLabel(tr("Export Folder:")); |
58 inoutLay->addWidget(outLabel, 1, 0); | 60 inoutLay->addWidget(outLabel, 1, 0); |
59 mOutRequester = new FileNameRequester(QDir::Dirs); | 61 mOutRequester = new FileNameRequester(QDir::Dirs); |
102 connect(mHtmlChk, &QCheckBox::stateChanged, this, &MainWindow::checkCompleted); | 104 connect(mHtmlChk, &QCheckBox::stateChanged, this, &MainWindow::checkCompleted); |
103 connect(mXlsxChk, &QCheckBox::stateChanged, this, &MainWindow::checkCompleted); | 105 connect(mXlsxChk, &QCheckBox::stateChanged, this, &MainWindow::checkCompleted); |
104 connect(mTitleEdit, &QLineEdit::textChanged, this, &MainWindow::checkCompleted); | 106 connect(mTitleEdit, &QLineEdit::textChanged, this, &MainWindow::checkCompleted); |
105 connect(mInputRequester, &FileNameRequester::fileNameChanged, this, &MainWindow::checkCompleted); | 107 connect(mInputRequester, &FileNameRequester::fileNameChanged, this, &MainWindow::checkCompleted); |
106 connect(mOutRequester, &FileNameRequester::fileNameChanged, this, &MainWindow::checkCompleted); | 108 connect(mOutRequester, &FileNameRequester::fileNameChanged, this, &MainWindow::checkCompleted); |
109 connect(btns, &QDialogButtonBox::rejected, this, &QMainWindow::close); | |
107 } | 110 } |
108 | 111 |
109 void MainWindow::showErrorMessage(const QString& errMsg) { | 112 void MainWindow::showErrorMessage(const QString& errMsg) { |
110 QMessageBox::warning(this, tr("Error!"), errMsg); | 113 QMessageBox::warning(this, tr("Error!"), errMsg); |
111 } | 114 } |
118 | 121 |
119 void MainWindow::readSettings() { | 122 void MainWindow::readSettings() { |
120 if (mSettings.contains("geometry")) { | 123 if (mSettings.contains("geometry")) { |
121 restoreGeometry(mSettings.value("geometry").toByteArray()); | 124 restoreGeometry(mSettings.value("geometry").toByteArray()); |
122 restoreState(mSettings.value("windowState").toByteArray()); | 125 restoreState(mSettings.value("windowState").toByteArray()); |
126 } else { | |
127 resize(480, 360); | |
123 } | 128 } |
124 | 129 |
125 setInputFile(mSettings.value("lastInput", | 130 setInputFile(mSettings.value("lastInput", |
126 QStandardPaths::writableLocation(DEFAULT_DIR)).toString()); | 131 QStandardPaths::writableLocation(DEFAULT_DIR)).toString()); |
127 mOutRequester->setFileName(mSettings.value("lastOutput", | 132 mOutRequester->setFileName(mSettings.value("lastOutput", |
133 } | 138 } |
134 | 139 |
135 void MainWindow::setInputFile(const QString& file) | 140 void MainWindow::setInputFile(const QString& file) |
136 { | 141 { |
137 mInputRequester->setFileName(file); | 142 mInputRequester->setFileName(file); |
143 QFileInfo fi(file); | |
144 mOutRequester->setFileName(fi.dir().path()); | |
138 } | 145 } |
139 | 146 |
140 void MainWindow::setTitle(const QString& title) { | 147 void MainWindow::setTitle(const QString& title) { |
141 mTitleEdit->setText(title); | 148 mTitleEdit->setText(title); |
142 } | 149 } |