Skip to content

Commit

Permalink
fix last commit and replace files
Browse files Browse the repository at this point in the history
  • Loading branch information
Artrix committed May 9, 2018
1 parent d9076a9 commit 84d17b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Source/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ void MainWindow::on_actionReplace_triggered()

OnexTreeItem* item = static_cast<OnexTreeItem*>(ui->treeWidget->currentItem());
if(item->hasParent()){

item->onReplace();
}else{
QMessageBox::information(NULL, tr("Info"), tr("Select correct file not *.NOS"));
}
Expand Down Expand Up @@ -209,7 +207,7 @@ void MainWindow::on_actionSave_as_triggered()
{
if(ui->treeWidget->currentItem()){

OnexTreeItem* item = static_cast<OnexTreeItem*>(ui->treeWidget->currentItem());
OnexTreeItem* item = static_cast<OnexTreeItem*>(ui->treeWidget->currentItem()->parent());
if(!item->hasParent()){
item->onExporAsOriginal();
}else{
Expand Down
2 changes: 1 addition & 1 deletion Source/Ui/OnexTreeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void OnexTreeItem::onExporAsOriginal()

void OnexTreeItem::onReplace()
{
QString fileName = getSaveDirectory(this->getName(), "All files (*.*)");
QString fileName = getOpenDirectory("All files (*.*)");
QFile file(fileName);
if (file.open(QIODevice::ReadOnly))
this->content = file.readAll();
Expand Down
4 changes: 2 additions & 2 deletions Source/Ui/OnexTreeText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ void OnexTreeText::onExportSingle()
QFile file(fileName);
if (file.open(QIODevice::WriteOnly))
{
QMessageBox::information(NULL, "Yeah", "Image exported");
QMessageBox::information(NULL, "Yeah", "Text file exported");
file.write(content);
file.close();
}
else
QMessageBox::critical(NULL, "Woops", "Couldn't export that image");
QMessageBox::critical(NULL, "Woops", "Couldn't export that text file");
}

void OnexTreeText::onExportAll()
Expand Down
2 changes: 2 additions & 0 deletions Source/Ui/SingleTextFilePreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ SingleTextFilePreview::SingleTextFilePreview(QByteArray &item, QWidget *parent)
ui(new Ui::SingleTextFilePreview)
{
ui->setupUi(this);

QTextCodec *codec = QTextCodec::codecForName("Windows-1250");
QString encodeContent = codec->toUnicode(item);

ui->plainTextEdit->appendPlainText(encodeContent);
}

Expand Down

0 comments on commit 84d17b7

Please sign in to comment.