void addToLog(char *buffer){ if(round == 1){ log_gc = (char*)malloc(logSize); memset(log_gc,0,logSize); } if (notEnough(strlen(buffer)+strlen(log_gc))){ logSize*=2; log_gc = (char*)realloc(log_gc,logSize); } strcat(log_gc,buffer); return; }
//******************************************************************** // // Method: hide // Parameter: none, read input // create instance of Intermediary // // Purpose: use Intermediary to hide // //******************************************************************** void MainWindow::hide() { ui->saveLabel->clear(); //TODO plain to QString* //-> problem bei im->hide_1Bit QString plain; if(ui->textFromDocRadio->isChecked()) { QString plainPath = ui->textPathTextField->text(); QFile file(plainPath); file.open(QIODevice::ReadOnly | QIODevice::Text); QTextStream in(&file); plain = in.readAll(); file.close(); } else if(ui->textFromFieldRadio->isChecked()) plain = ui->textEdit->toPlainText(); //if(textFromFieldRadio) //encrypt if(ui->encryptCheckBox->isChecked()) { ui->saveLabel->setText("Encrypting..."); plain = *(encrypt(&plain)); ui->saveLabel->clear(); } QString oldPath = ui->picPathTextField->text(); im = new Intermediary(oldPath); if(ui->textFromDocRadio->isChecked() && ui->textPathTextField->text().endsWith(".png")) { im->setImage(ui->textPathTextField->text()); } else { im->setText(&plain,format); } QString savePath; ui->saveLabel->setText("Hiding..."); if(im->isReady_1Bit()) { savePath = QFileDialog::getSaveFileName(this, tr("Save File"), actDir.absolutePath(), tr("*.png *.jpg")); im->hide_1Bit(savePath); } else { int action = popupProblemDialog(); qDebug()<<action; while(action != CANCEL) { if( action == DENSITY) { int w = noiseWarningDialog(); if(im->isReady_3Bit() && w == 1) { savePath = QFileDialog::getSaveFileName(this, tr("Save File"), actDir.absolutePath(), tr("*.png *.jpg")); im->hide_3Bit(savePath); action = CANCEL; } else { action = popupProblemDialog(); if( action == DENSITY) { w = noiseWarningDialog(); if(im->isReady_3Bit() && w == 1) { savePath = QFileDialog::getSaveFileName(this, tr("Save File"), actDir.absolutePath(), tr("*.png *.jpg")); im->hide_6Bit(savePath); action = CANCEL; } else { notEnough(); action = CANCEL; } } } } else if(action == PICS) { apd = new AddPicDialog(im); apd->setActDir(actDir.absolutePath()); apd->exec(); action = CANCEL; } else if(action == NEWPIC) { im->images->remove(savePath); chosePicture(); im->addImage(ui->picPathTextField->text()); if(im->isReady_1Bit()) { savePath = QFileDialog::getSaveFileName(this, tr("Save File"), actDir.absolutePath(), tr("*.png *.jpg")); im->hide_1Bit(savePath); action = CANCEL; } else { action = popupProblemDialog(); } } else { action=CANCEL; } } } ui->saveLabel->clear(); ui->picPathTextField_2->clear(); if(!savePath.isEmpty()) { actDir.setPath(savePath); ui->picPathTextField_2->addItem(savePath); showSuccessfulHiding(savePath); } }