| 24 | } |
| 25 | |
| 26 | void PersistentHTTP::init(QByteArray thedata, QUrl url) |
| 27 | { |
| 28 | data = thedata; |
| 29 | ui->codeView->setPlainText(QString(thedata)); |
| 30 | ui->codeView->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); |
| 31 | int linecount = data.count('\n'); |
| 32 | if (linecount > 5) { |
| 33 | ui->codeView->setWordWrapMode(QTextOption::NoWrap); |
| 34 | } |
| 35 | ui->codeView->setReadOnly(true); |
| 36 | |
| 37 | setWindowTitle("HTTP "+url.toString()); |
| 38 | |
| 39 | |
| 40 | // holds temporary files until window closes |
| 41 | QString dl = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); |
| 42 | if(!QFile(dl).exists()) { |
| 43 | dl = QDir::homePath(); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | QDateTime now = QDateTime::currentDateTime(); |
| 48 | QString nowString = now.toString("yyyy-MM-dd_hh_mm_ss"); |
| 49 | ui->browserViewButton->setProperty("html-download", dl + "/" +nowString + "-packetsender-httpview.html"); |
| 50 | ui->browserViewButton->setText(nowString + "-packetsender.html"); |
| 51 | |
| 52 | } |
| 53 | |
| 54 | PersistentHTTP::~PersistentHTTP() |
| 55 | { |