GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — webtooth-extractor/properties.cpp at master · RedSilkSoftware/webtooth-extractor Expand file tree/ Copy pathproperties.cppMore file actions 284 lines (246 loc) · 8.13 KB / Copy pathproperties.cppFile metadata and controls284 lines (246 loc) · 8.13 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 /* This file is part of WebTooth-Extractor and for personal use the GPL3 license applies. For any kind of commercial usage, you have to acquire a commercial license before use. The copyright of the WebTooth application and source code remains with Patrick Scheller and any contributor to the project agrees with his commits to renounce to the copyright of his parts completely. WebTooth-Extractor is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License. WebTooth-Extractor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with WebTooth-Extractor. If not, see http://www.gnu.org/licenses/ . */ #include <QStandardPaths> #include <QFileDialog> #include <QDateTime> #include <QDebug> #include "properties.h" #include "ui_properties.h" Properties::Properties(QWidget *parent) : QDialog(parent), ui(new Ui::Properties), sUrlPath(""), bCropThumb(true), thumbHeight(500), thumbWidth(300), sAuthor(""), sProjectNotes(""), uProjectUrl(""), sLastModificationDate(""), csvSeparator(",") { ui->setupUi(this); QDateTime now = QDateTime::currentDateTime(); //sLastModificationDate = now.toString(Qt::ISODate); //ui->lineEditLastModificationDate->setText(sLastModificationDate); hProjectData.insert("projectapp", "WebTooth-Extractor"); // Name of this application hProjectData.insert("projectname", ""); // Project-File-Name hProjectData.insert("projectauthor", ""); hProjectData.insert("projectmodified", ""); // Date of last saved modification hProjectData.insert("projecnotes", ""); hProjectData.insert("projecturl", ""); hProjectData.insert("cropthumb", "true"); // true or falsse hProjectData.insert("thumbwidth", "300"); // in pixels hProjectData.insert("thumbheight", "500"); // in pixels hProjectData.insert("csvseparator", ","); // in pixels } Properties::~Properties() { delete ui; } // Save-Button void Properties::on_buttonBox_accepted() { // SetDirty if user has entered/modified properties if (this->sUrlPath != ui->lineEdit_URL->text()) { this->sUrlPath = ui->lineEdit_URL->text(); this->isDirtyPropData = true; } if (bCropThumb != ui->checkBoxCropThumb->isChecked()) { bCropThumb = ui->checkBoxCropThumb->isChecked(); this->isDirtyPropData = true; } if (thumbHeight != ui->spinBoxThumbHeight->value()) { thumbHeight = ui->spinBoxThumbHeight->value(); this->isDirtyPropData = true; } if (thumbWidth != ui->spinBoxThumbWidth->value()) { thumbWidth = ui->spinBoxThumbWidth->value(); this->isDirtyPropData = true; } if (sAuthor != ui->lineEditAuthorName->text()) { sAuthor = ui->lineEditAuthorName->text(); this->isDirtyPropData = true; } if (sProjectNotes != ui->plainTextEditUserNotes->toPlainText()) { sProjectNotes = ui->plainTextEditUserNotes->toPlainText(); this->isDirtyPropData = true; } if (csvSeparator != ui->lineEditCSVSeparator->text()) { csvSeparator = ui->lineEditCSVSeparator->text(); this->isDirtyPropData = true; } if (this->isDirtyPropData) { hProjectData["projectauthor"] = sAuthor; //qDebug() << "Author has been modified:" << hProjectData["projectauthor"]; hProjectData["projecnotes"] = sProjectNotes; hProjectData["projecturl"] = sUrlPath; hProjectData["cropthumb"] = (bCropThumb ? "true" : "false"); hProjectData["thumbwidth"] = QString::number(thumbWidth); hProjectData["thumbheight"] = QString::number(thumbHeight); hProjectData["csvseparator"] = csvSeparator; } } // Load after an OpenFile void Properties::LoadData(void) { sAuthor = hProjectData["projectauthor"]; sProjectNotes = hProjectData["projecnotes"]; sUrlPath = hProjectData["projecturl"]; bCropThumb = (hProjectData["cropthumb"] == "true" ? true : false); thumbWidth = hProjectData["thumbwidth"].toShort(); thumbHeight = hProjectData["thumbheight"].toShort(); csvSeparator = hProjectData["csvseparator"]; sLastModificationDate = hProjectData["projectmodified"]; //qDebug() << "Properties:" << sAuthor << ", " << sProjectNotes << ", " << sUrlPath << ", " << (bCropThumb ? "true" : "false") << ", " // << QString::number(thumbWidth) << ", " << QString::number(thumbHeight); ui->lineEdit_URL->setText(this->sUrlPath); ui->checkBoxCropThumb->setChecked(this->bCropThumb); ui->spinBoxThumbHeight->setValue(this->thumbHeight); ui->spinBoxThumbWidth->setValue(this->thumbWidth); ui->lineEditAuthorName->setText(this->sAuthor); ui->plainTextEditUserNotes->setPlainText(this->sProjectNotes); ui->lineEditCSVSeparator->setText(this->csvSeparator); ui->lineEditLastModificationDate->setText(this->sLastModificationDate); } void Properties::on_toolButton_clicked() { // Call the URL-FileDialog QUrl homePath(QStandardPaths::locate(QStandardPaths::DocumentsLocation, QString(), QStandardPaths::LocateDirectory)); QUrl urlpath = QFileDialog::getOpenFileUrl(this, "Open URL Or Local HTML File", homePath, "HTML File (*.html *.htm);;Text Files (*.txt);;All Files (*.*)"); if (!urlpath.isEmpty()) ui->lineEdit_URL->setText(urlpath.toString()); } qint16 Properties::getThumbWidth() const { return thumbWidth; } void Properties::setThumbWidth(const qint16 &value) { thumbWidth = value; } qint16 Properties::getThumbHeight() const { return thumbHeight; } void Properties::setThumbHeight(const qint16 &value) { thumbHeight = value; } bool Properties::getBCropThumb() const { return bCropThumb; } void Properties::setBCropThumb(bool value) { bCropThumb = value; } QString Properties::getSLastModificationDate() const { return sLastModificationDate; } void Properties::setSLastModificationDate(const QString &value) { sLastModificationDate = value; ui->lineEditLastModificationDate->setText(sLastModificationDate); } QString Properties::getSUserNotes() const { return sUserNotes; } void Properties::setSUserNotes(const QString &value) { sUserNotes = value; } QString Properties::getSAuthorName() const { return sAuthorName; } void Properties::setSAuthorName(const QString &value) { sAuthorName = value; } QString Properties::getSUrlPath() const { return sUrlPath; } void Properties::setSUrlPath(const QString &value) { sUrlPath = value; } void Properties::on_checkBoxCropThumb_toggled(bool checked) { if (checked) { //ui->spinBoxThumbHeight->setReadOnly(false); ui->spinBoxThumbHeight->setEnabled(true); } else { //ui->spinBoxThumbHeight->setReadOnly(true); ui->spinBoxThumbHeight->setEnabled(false); } } QString Properties::getCsvSeparator() const { return csvSeparator; } void Properties::setCsvSeparator(const QString &value) { csvSeparator = value; } bool Properties::isDirtyProp() { return (this->isDirtyPropData); } bool Properties::unsetDirtyProp() { this->isDirtyPropData = false; return (this->isDirtyPropData); } void Properties::ResetProperties() { this->sUrlPath = ""; this->bCropThumb = true; this->thumbHeight = 500; this->thumbWidth = 300; this->sAuthor = ""; this->sProjectNotes = ""; this->csvSeparator = ","; this->sLastModificationDate = ""; this->on_buttonBox_rejected(); } // If Cancel/Rejected then reset the previous values in the GUI void Properties::on_buttonBox_rejected() { ui->lineEdit_URL->setText(this->sUrlPath); ui->checkBoxCropThumb->setChecked(this->bCropThumb); ui->spinBoxThumbHeight->setValue(this->thumbHeight); ui->spinBoxThumbWidth->setValue(this->thumbWidth); ui->lineEditAuthorName->setText(this->sAuthor); ui->plainTextEditUserNotes->setPlainText(this->sProjectNotes); ui->lineEditCSVSeparator->setText(this->csvSeparator); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |