void MainWindow::initialTree() { model = new XMLerModel( this ); tree = new QTreeView( this ); tree->setModel( model ); tree->setRootIsDecorated( false ); /* tree signals */ connect ( tree, SIGNAL(collapsed(QModelIndex)), this, SLOT(indexCollapsed(QModelIndex)) ); connect ( tree, SIGNAL(expanded(QModelIndex)), this, SLOT(indexExpanded(QModelIndex)) ); connect( model, SIGNAL(touchModel()), this, SLOT(modelTouched())); connect( model, SIGNAL(gotoBookmark(BaseXMLNode*)), this, SLOT(showFounded(BaseXMLNode*)) ); /* Loader signals */ connect( model->loader(), SIGNAL(beginProgress(QString,qint64)), this, SLOT(beginProgressModel(QString,qint64)) ); connect( model->loader(), SIGNAL(progress(qint64)), this, SLOT(progressModel(qint64)) ); connect( model->loader(), SIGNAL(endProgress()), this, SLOT(endProgressModel()) ); /* save signals */ connect( model->saver(), SIGNAL(beginProgress(QString,qint64)), this, SLOT(beginProgressModel(QString,qint64)) ); connect( model->saver(), SIGNAL(progress(qint64)), this, SLOT(progressModel(qint64)) ); connect( model->saver(), SIGNAL(endProgress()), this, SLOT(endProgressModel()) ); /* finder signals */ connect( model->finder(), SIGNAL(beginProgress(QString,qint64)), this, SLOT(beginProgressModel(QString,qint64)) ); connect( model->finder(), SIGNAL(progress(qint64)), this, SLOT(progressModel(qint64)) ); connect( model->finder(), SIGNAL(endProgress()), this, SLOT(endProgressModel()) ); /* error and warning model loader/saver signals */ connect ( model->loader(), SIGNAL( error(QString) ), this, SLOT( onError(QString) ) ); connect ( model->loader(), SIGNAL( warning(QString) ), this, SLOT( onWarning(QString) ) ); connect ( model->saver(), SIGNAL( error(QString) ), this, SLOT( onError(QString) ) ); connect ( model->saver(), SIGNAL( warning(QString) ), this, SLOT( onWarning(QString) ) ); connect ( model->finder(), SIGNAL( error(QString) ), this, SLOT( onError(QString) ) ); connect ( model->finder(), SIGNAL( warning(QString) ), this, SLOT( onWarning(QString) ) ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), m_pLhaLib(nullptr), m_pCurrentCodec(nullptr), m_szCurrentCodec(), m_szBaseTitle(), m_szCurrentArchive(), m_PathToItem() { ui->setupUi(this); m_szBaseTitle = windowTitle(); connect(this, SIGNAL(FileSelection(QString)), this, SLOT(onFileSelected(QString))); m_pCurrentCodec = QTextCodec::codecForLocale(); m_szCurrentCodec = QString(m_pCurrentCodec->name()); m_pLhaLib = new QLhALib(this); connect(m_pLhaLib, SIGNAL(message(QString)), this, SLOT(onMessage(QString))); connect(m_pLhaLib, SIGNAL(warning(QString)), this, SLOT(onWarning(QString))); connect(m_pLhaLib, SIGNAL(fatal_error(QString)), this, SLOT(onFatalError(QString))); QStringList treeHeaders; treeHeaders << "Name" << "Unpacked size" << "Packed size" << "Time" << "Date" << "Pack Mode" << "Comment" << "User" << "Group" << "UID" << "GID" //<< "Attributes" << "CRC (F)" //<< "CRC (H)" << "HLev" << "OST"; ui->treeWidget->setColumnCount(treeHeaders.size()); ui->treeWidget->setHeaderLabels(treeHeaders); // if file given in command line QStringList vCmdLine = QApplication::arguments(); if (vCmdLine.size() > 1) { emit FileSelection(vCmdLine[1]); } }