Beispiel #1
0
FileDialog::FileDialog(QWidget* parent, const QString& caption, const QString& directory, const QString& nameFilter, const QStringList& filter)
{
    Q_UNUSED(nameFilter);
    Q_UNUSED(parent);

    m_Model = new QFileSystemModel(this);
    m_View = new FileListView(this);

    setWindowTitle(caption);
    setWindowFlags(Qt::Dialog);

    m_Model->setFilter(QDir::Files);
    m_Model->setNameFilters(filter);
    m_Model->setRootPath(directory);

    m_View->setIconSize(QSize(0, 0)); //todo check this hides the icons everywhere

    m_Model->setNameFilterDisables(false);

    m_View->setModel(m_Model);

    QVBoxLayout* layout = new QVBoxLayout;
    layout->addWidget(m_View);
    setLayout(layout);
    setWindowFlags(Qt::WindowSystemMenuHint | Qt::WindowTitleHint);

    m_View->setRootIndex(m_Model->index(directory));
    m_View->setFocus();
    m_View->setMinimumWidth(640);
    m_View->setMinimumHeight(480);

    connect(m_View, SIGNAL(selectedItemChanged(QModelIndex, QModelIndex)), this, SLOT(updateCurrent(QModelIndex, QModelIndex)));
    connect(m_View, SIGNAL(activated(QModelIndex)), this, SLOT(onFileSelected(QModelIndex)));
    connect(m_View, SIGNAL(clicked(QModelIndex)), this, SLOT(onSelectionChanged(QModelIndex)));
}
Beispiel #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_szBaseTitle()
{
    ui->setupUi(this);
	m_szBaseTitle = windowTitle();
	connect(this, SIGNAL(FileSelection(QString)), this, SLOT(onFileSelected(QString)));
	
	QStringList treeHeaders;
	treeHeaders << "Chunk"
	            //<< "Type" 
	            << "Offset" 
	            << "Size" ;
	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]);
	}
}
Beispiel #3
0
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]);
	}
}
Beispiel #4
0
QNWindow::QNWindow(QWidget *parent) :
    QWidget(parent)
{
    //row 1
    fileNameLabel = new QLabel("File");
    fileNameLabel->setFixedWidth(35);
    fileNameEdit = new QLineEdit;
    browseFileBtn = new QPushButton("...");

    QHBoxLayout *layout1=new QHBoxLayout;
    layout1->addWidget(fileNameLabel);
    layout1->addWidget(fileNameEdit);
    layout1->addWidget(browseFileBtn);

    //row 2
    fileETagLabel = new QLabel("ETag");
    fileETagLabel->setFixedWidth(35);
    fileEtagEdit = new QLineEdit;

    QHBoxLayout *layout2=new QHBoxLayout;
    layout2->addWidget(fileETagLabel);
    layout2->addWidget(fileEtagEdit);

    //row 3
    calcETagBtn = new QPushButton("Calculate");
    QHBoxLayout *layout3=new QHBoxLayout;
    layout3->addStretch();
    layout3->addWidget(calcETagBtn);

    QVBoxLayout *mainLayout=new QVBoxLayout;
    mainLayout->addLayout(layout1);
    mainLayout->addLayout(layout2);
    mainLayout->addLayout(layout3);

    setLayout(mainLayout);
    QSize size(450,160);
    setMinimumSize(size);
    setMaximumSize(size);

    openFileDialog=new QFileDialog(this);
    QObject::connect(openFileDialog,SIGNAL(fileSelected(QString)),this,SLOT(onFileSelected(QString)));

    QObject::connect(calcETagBtn,SIGNAL(clicked()),this,SLOT(calBtnClicked()));
    QObject::connect(browseFileBtn,SIGNAL(clicked()),this,SLOT(browseBtnClicked()));

}
Beispiel #5
0
void Widget::onSelectSong()
{
    QString strPath = QDir::currentPath();
    QStringList nameFilters("*.mp3");
    nameFilters << "*.wma" << "*.ape" << "*.ogg"
                << "*.aac" << "*.wav" << "*.mid"
                << "*.amr" << "*.3gp" << "*.mp4";

    m_fileSelector = new OpenFileWidget(strPath, nameFilters);
    m_layout->addWidget(m_fileSelector);
    m_layout->setCurrentWidget(m_fileSelector);

    m_fileSelector->setAttribute(Qt::WA_DeleteOnClose);
    connect(m_fileSelector, SIGNAL(selected(QString))
            , this, SLOT(onFileSelected(QString)));
    connect(m_fileSelector, SIGNAL(canceled())
            , this, SLOT(onFileSelectCanceled()));

    m_fileSelector->setStyleSheet("QListWidget{ background: #303030; border: 1px solid white}");
}
Beispiel #6
0
void MainWindow::onTextCodec(QString szCodec)
{
	if (m_szCurrentCodec == szCodec)
	{
		return;
	}
	
	if (m_pCurrentCodec != nullptr)
	{
		m_pCurrentCodec = nullptr;
	}
	
	m_szCurrentCodec = szCodec;
	
	if (m_szCurrentCodec.isEmpty() == true)
	{
		return;
	}

	m_pCurrentCodec = QTextCodec::codecForName(m_szCurrentCodec.toAscii());
	onFileSelected(m_szCurrentArchive);
}
Beispiel #7
0
void IsoDepTag::onApduReceived(const IsoApdu* apdu) {
#if DBG
        LOGD("C-APDU Received from Reader");
#endif
	uint16_t readresult = 0;
	switch (apdu->ins) {
	case APDU_CMD_SELECT_FILE:
	    #if DBG
		LOGD("TYPE : Select File");
		#endif
	    if (onFileSelected(apdu)) {
			sendAckApduWithData(NULL, 0);
		}
		break;
	case APDU_CMD_READ_BINARY:
	    #if DBG
		LOGD("TYPE : Read Binary");
		#endif
		// read Binary command
		readresult = onReadAccess(apdu->p1 << 8 | apdu->p2, apdu->elen, txBuf);
		if (!IS_ERROR(readresult)) {
#if DBG
			LOGD("Binary Read request is handled successfully");
#endif
			sendAckApduWithData(txBuf, GET_VALUE(readresult));
		}
		break;
	case APDU_CMD_UPDATE_BINARY:
		// update Binary command
		#if DBG
		LOGD("TYPE :  Binary Update ");
		#endif
		if (onWriteAccess(apdu)) {
			sendAckApduWithData(NULL, 0);
		}
		break;

	}
}
Beispiel #8
0
void ScreenGame::Impl::showSaveDialog()
{
  SaveDialog* dialog = new SaveDialog( gui->getRootWidget(), "./saves/", ".oc3save", -1 );
  CONNECT( dialog, onFileSelected(), this, Impl::resolveGameSave );
}
ISOSelectView::ISOSelectView(QWidget *parent) : QFrame(parent)
{
    setObjectName("ISOSelectView");
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0, 9, 0, 0);

    QLabel *m_title = new QLabel(tr("Select an ISO image file"));
    m_title->setFixedHeight(38);
    m_title->setStyleSheet("font-size: 26px;");

    QLabel *isoIcon = new QLabel(this);
    isoIcon->setObjectName("ISOIcon");
    isoIcon->setFixedSize(96, 96);
    isoIcon->setPixmap(WidgetUtil::getDpiPixmap(":/theme/light/image/media-optical-96px.svg", this));

    QLabel *growIcon = new QLabel(this);
    growIcon->setObjectName("GrowIcon");
    growIcon->setPixmap(WidgetUtil::getDpiPixmap(":/theme/light/image/glow.svg", this));
    growIcon->setFixedSize(220, 220);
    growIcon->hide();

    DropFrame *isoPanel = new DropFrame;
    isoPanel->setObjectName("IosPanel");
    isoPanel->setFixedSize(412, 322);

    QVBoxLayout *isoPanelLayout = new QVBoxLayout(isoPanel);
    isoPanelLayout->setMargin(0);

    m_fileLabel = new QLabel(tr("Drag an ISO image file and drop it here"));
    m_fileLabel->setObjectName("IsoFileName");
//    m_fileLabel->setFixedHeight(18);

    m_hits = new QLabel(tr("OR"));
    m_hits->setObjectName("IsoHits");
    m_hits->setFixedHeight(18);

    QLabel *spliter = new QLabel;
    spliter->setObjectName("IsoSpliter");
    spliter->setFixedSize(230, 1);

    m_fileSelect = new QLabel();
    m_fileSelect->setObjectName("IsoFileSelect");
//    m_fileSelect->setFixedHeight(15);
    m_fileSelect->setOpenExternalLinks(false);
    QString selectText = tr("Select an ISO image file");
    QString linkText = QString(s_linkTemplate).arg(selectText).arg(selectText);
    m_fileSelect->setText(linkText);

    isoPanelLayout->addSpacing(62);
    isoPanelLayout->addWidget(isoIcon, 0, Qt::AlignCenter);
    isoPanelLayout->addSpacing(5);
    isoPanelLayout->addWidget(m_fileLabel, 0, Qt::AlignCenter);
    isoPanelLayout->addSpacing(4);
    isoPanelLayout->addWidget(m_hits, 0, Qt::AlignCenter);
    isoPanelLayout->addSpacing(7);
    isoPanelLayout->addWidget(spliter, 0, Qt::AlignCenter);
    isoPanelLayout->addSpacing(12);
    isoPanelLayout->addWidget(m_fileSelect, 0, Qt::AlignCenter);
    isoPanelLayout->addStretch();

    m_nextSetp = new SuggestButton();
    m_nextSetp->setObjectName("NextStepButton");
    m_nextSetp->setText(tr("Next"));
    m_nextSetp->setDisabled(true);

    mainLayout->addWidget(m_title, 0, Qt::AlignCenter);
    mainLayout->addSpacing(24);
    mainLayout->addWidget(isoPanel, 0, Qt::AlignCenter);
    mainLayout->addStretch();
    mainLayout->addWidget(m_nextSetp, 0, Qt::AlignCenter);

    this->setStyleSheet(WidgetUtil::getQss(":/theme/light/ISOSelectView.theme"));

#ifdef Q_OS_WIN
    m_fileLabel->hide();
    spliter->hide();
    m_hits->hide();
#endif
    connect(isoPanel, &DropFrame::fileAboutAccept, this, [ = ]() {
        growIcon->show();
        auto center = isoIcon->geometry().center();
        growIcon->move(center);
        auto topleft = growIcon->mapFromGlobal(isoIcon->mapToGlobal(center));
        auto offset = 220 - 96;
        topleft.setX(topleft.x() - offset / 2);
        topleft.setY(topleft.y() - offset / 2);
        growIcon->move(topleft);
        isoPanel->setProperty("active", true);
        this->style()->unpolish(isoPanel);
        this->style()->polish(isoPanel);
    });
    connect(isoPanel, &DropFrame::fileCancel, this, [ = ]() {
        growIcon->hide();
        isoPanel->setProperty("active", false);
        this->style()->unpolish(isoPanel);
        this->style()->polish(isoPanel);
    });

    connect(m_fileSelect, &QLabel::linkActivated, this, [ = ](const QString & /*link*/) {
        QFileDialog fileDlg(this);
        fileDlg.setViewMode(QFileDialog::Detail);
        fileDlg.setFileMode(QFileDialog::ExistingFile);
        fileDlg.setDirectory(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first());
        fileDlg.setNameFilter("ISO (*.iso)");
        fileDlg.selectNameFilter("ISO (*.iso)");
        if (QFileDialog::Accepted == fileDlg.exec()) {
            QString text = fileDlg.selectedFiles().first();
            onFileSelected(text);
        }
    });

    connect(m_nextSetp, &SuggestButton::clicked, this, &ISOSelectView::isoFileSelected);
    connect(isoPanel, &DropFrame::fileDrop, this, &ISOSelectView::onFileSelected);

}