Beispiel #1
0
frmNapiProjektUpload::frmNapiProjektUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
    ui.setupUi(this);

    setAttribute(Qt::WA_QuitOnClose, false);

    connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory()));
    connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged()));
    connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked()));
    connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool)));
    connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString)));
    connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked()));
    connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished()));
    connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int)));
    connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString)));
    connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass()));
    connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));

    if(QFileInfo(GlobalConfig().previousDialogPath()).isDir())
        ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath());

    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());
}
Beispiel #2
0
void frmNapiProjektUpload::closeEvent(QCloseEvent *event)
{
    if(scanThread.isRunning())
    {
        if( QMessageBox::question(this, tr("QNapi"), tr("Czy chcesz przerwać skanowanie katalogów?"),
            QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes )
        {
            scanThread.requestAbort();
            ui.lbAction->setText(tr("Kończenie zadań..."));
            qApp->processEvents();
            scanThread.wait();
            event->accept();
        }
        else
        {
            event->ignore();
        }
        return;
    }
    else if(uploadThread.isRunning())
    {
        if( QMessageBox::question(this, tr("QNapi"), tr("Czy chcesz przerwać wysyłanie napisów?"),
            QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes )
        {
            pbUploadClicked();
        }
        event->ignore();
    }
    else
        event->accept();
}
Beispiel #3
0
frmUpload::frmUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
    ui.setupUi(this);

    setAttribute(Qt::WA_QuitOnClose, false);

    connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory()));
    connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged()));
    connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked()));
    connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool)));
    connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString)));
    connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked()));
    connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished()));
    connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int)));
    connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString)));
    connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass()));
    connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));

    if(QFileInfo(GlobalConfig().previousDialogPath()).isDir())
        ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath());

    // workaround dla compiza?
    move((QApplication::desktop()->width() - width()) / 2, 
        (QApplication::desktop()->height() - height()) / 2);
}