-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
41 lines (31 loc) · 2.77 KB
/
Copy pathmainwindow.cpp
File metadata and controls
41 lines (31 loc) · 2.77 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
#include "mainwindow.h"
#include "droplabel.h"
#include "tabwidget.h"
#include "tabwidget2.h"
//TODO:Resolution needs to throw an error in the status if the user doesn't follow de format n1xn2
MainWindow::MainWindow(){
setWindowTitle("File Tools");
sidebar = new QListWidget(this);
stack = new QStackedWidget(this);
sidebar->addItems({"PDF OCR", "Image -> Text", "Image -> ?", "Image resolution", "Image compression", "pdf -> image", "text -> text", "audio -> audio", "video -> video", "Compress pdf", "Text -> QR Code", "QR Code -> Text"});
stack->addWidget(new Tabwidget(this, {"pdf"}, "PDF OCR", ocrpdf,"ocrmypdf"));
stack->addWidget(new Tabwidget(this, {"png", "jpg", "tiff", "bmp", "webp"}, "Image -> Text", tesseract,"tesseract"));
stack->addWidget(new Tabwidget(this, {"png", "jpg", "tiff", "bmp", "webp"}, "Image -> Image/pdf", convert ,"convert", {"png", "jpg", "tiff", "bmp", "webp","pdf"}));
stack->addWidget(new Tabwidget(this, {"png", "jpg", "tiff", "bmp", "webp"}, "Image resolution", convert_resolution ,"convert", {"Keep aspect racio","Force resize"}, {}, "Resolution(n1xn2):"));
stack->addWidget(new Tabwidget(this, {"png", "jpg", "tiff", "bmp", "webp"}, "Image compression", convert_compression ,"convert", {"jpg","webp"}, {1,100}));
stack->addWidget(new Tabwidget(this, {"pdf"}, "pdf -> image", convert_pdf_to_image ,"pdftoppm", {"png", "jpeg", "tiff", "bmp", "webp"}));
stack->addWidget(new Tabwidget(this, {"txt", "md", "html", "docx", "odt", "epub"}, "text -> text", convert_text_text ,"pandoc", {"pdf","txt", "md", "html", "docx", "odt", "epub"}));
stack->addWidget(new Tabwidget(this, {"mp3", "ogg", "flac", "wav", "aac", "m4a", "opus"}, "audio -> audio", convert_audio_audio ,"ffmpeg", {"mp3", "ogg", "flac", "wav", "aac", "m4a", "opus"}));
stack->addWidget(new Tabwidget(this,{"mp4", "mkv", "avi", "mov", "webm", "flv", "wmv"} , "video -> video", convert_audio_audio ,"ffmpeg", {"mp4", "mkv", "avi", "mov", "webm", "flv", "wmv", "m4v"}));
stack->addWidget(new Tabwidget(this, {"pdf"}, "Compress pdf", compress_pdf ,"gs", {"Maximum compression","Maximum compression gray" ,"Balanced", "High quality", "Maximum quality"}));
stack->addWidget(new Tabwidget2("Type your text below, then click Run. The image will be saved in your home folder", "Text:", this, "Text -> QR Code" , qr_code_gen, "qrencode"));
stack->addWidget(new Tabwidget(this, {"png", "jpg", "tiff", "bmp", "webp"}, "QR Code -> Text", qr_code_read ,"zbarimg"));
connect(sidebar, &QListWidget::currentRowChanged, stack, &QStackedWidget::setCurrentIndex);
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(sidebar);
layout->addWidget(stack);
QWidget *test = new QWidget;
test->setLayout(layout);
setCentralWidget(test);
resize(800,400);
}