Beispiel #1
0
SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent)
    : QDialog(parent)
{
    ui.setupUi(this);
    _currentPage = page;
    page->setParent(this);

    // make it look more native under Mac OS X:
    setWindowFlags(Qt::Sheet);

    ui.pageTitle->setText(page->title());
    setWindowTitle(tr("Configure %1").arg(page->title()));
    setWindowIcon(SmallIcon("configure"));

    // make the scrollarea behave sanely
    ui.settingsFrame->setWidgetResizable(true);
    ui.settingsFrame->setWidget(page);

    updateGeometry();

    connect(page, SIGNAL(changed(bool)), this, SLOT(setButtonStates()));
    connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
    page->load();
    setButtonStates();
}
Beispiel #2
0
CoreConnectAuthDlg::CoreConnectAuthDlg(CoreAccount *account, QWidget *parent)
    : QDialog(parent),
    _account(account)
{
    ui.setupUi(this);

    connect(ui.user, SIGNAL(textChanged(QString)), SLOT(setButtonStates()));
    connect(ui.password, SIGNAL(textChanged(QString)), SLOT(setButtonStates()));

    ui.label->setText(tr("Please enter your credentials for %1:").arg(account->accountName()));
    ui.user->setText(account->user());
    ui.password->setText(account->password());
    ui.rememberPasswd->setChecked(account->storePassword());

    if (ui.user->text().isEmpty())
        ui.user->setFocus();
    else
        ui.password->setFocus();
}
Beispiel #3
0
SettingsDlg::SettingsDlg(QWidget *parent)
  : QDialog(parent),
    _currentPage(0)
{
  ui.setupUi(this);
  setModal(true);
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowIcon(SmallIcon("configure"));

  updateGeometry();

  ui.settingsTree->setRootIsDecorated(false);

  connect(ui.settingsTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelected()));
  connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));

  setButtonStates();
}
Beispiel #4
0
void SettingsDlg::selectPage(SettingsPage *sp)
{
    if (!sp) {
        _currentPage = 0;
        ui.settingsStack->setCurrentIndex(0);
        ui.pageTitle->setText(tr("Settings"));
        return;
    }

    if (!pageIsLoaded[sp]) {
        sp->load();
        pageIsLoaded[sp] = true;
    }

    if (sp != currentPage() && currentPage() != 0 && currentPage()->hasChanged()) {
        int ret = QMessageBox::warning(this, tr("Save changes"),
            tr("There are unsaved changes on the current configuration page. Would you like to apply your changes now?"),
            QMessageBox::Discard|QMessageBox::Save|QMessageBox::Cancel, QMessageBox::Cancel);
        if (ret == QMessageBox::Save) {
            if (!applyChanges()) sp = currentPage();
        }
        else if (ret == QMessageBox::Discard) {
            undoChanges();
        }
        else sp = currentPage();
    }

    if (sp != currentPage()) {
        if (sp->title().isEmpty()) {
            ui.pageTitle->setText(sp->category());
            setWindowTitle(tr("Configure %1").arg(sp->category()));
        }
        else {
            ui.pageTitle->setText(sp->title());
            setWindowTitle(tr("Configure %1").arg(sp->title()));
        }

        ui.settingsStack->setCurrentWidget(sp);
        _currentPage = sp;
    }
    setButtonStates();
}
void StitchLibraryUi::changeStitchSet(QString setName)
{

    StitchSet* set = StitchLibrary::inst()->findStitchSet(setName);
    if(!set)
        return;

    const QSortFilterProxyModel *model =  static_cast<const QSortFilterProxyModel*>(ui->listView->model());

    StitchSet* curSet = qobject_cast<StitchSet*>(model->sourceModel());
    if(curSet)
        curSet->clearSelection();

    mProxyModel->setSourceModel(set);

    ui->listView->update();

    ui->listView->resizeColumnsToContents();
    ui->listView->resizeRowsToContents();

    setupPropertiesBox();
    setButtonStates(set);

}
StitchLibraryUi::StitchLibraryUi(QWidget* parent)
    : QDialog(parent), ui(new Ui::StitchLibraryDialog)
{
    ui->setupUi(this);

    ui->stitchSource->addItems(StitchLibrary::inst()->stitchSetList());

    StitchSet* master = StitchLibrary::inst()->masterStitchSet();

    mProxyModel = new QSortFilterProxyModel(this);

    mProxyModel->setSourceModel(master);
    mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);

    ui->listView->setModel(mProxyModel);
    ui->listView->setSortingEnabled(true);

    StitchLibraryDelegate *delegate = new StitchLibraryDelegate(ui->listView);
    ui->listView->setItemDelegate(delegate);

    setDialogSize();
    ui->listView->horizontalHeader()->setClickable(true);
    ui->listView->horizontalHeader()->setSortIndicatorShown(true);

    //TODO: Wrong Side.
    ui->listView->hideColumn(4);

    ui->propertiesBox->setVisible(false);
    connect(ui->moreBttn, SIGNAL(clicked()), SLOT(hideProperties()));
    connect(ui->printSet, SIGNAL(clicked()), SLOT(printStitchSet()));

    connect(ui->addStitch, SIGNAL(clicked()), SLOT(addStitch()));
    connect(ui->removeStitch, SIGNAL(clicked()), SLOT(removeStitch()));
    connect(ui->addSelected, SIGNAL(clicked()), SLOT(addSelected()));

    connect(ui->createSet, SIGNAL(clicked()), SLOT(createSet()));
    connect(ui->removeSet, SIGNAL(clicked()), SLOT(removeSet()));

    connect(ui->importSet, SIGNAL(clicked()), SLOT(importSet()));
    connect(ui->exportSet, SIGNAL(clicked()), SLOT(exportSet()));

    connect(ui->setName, SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->author,  SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->email,   SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->org,     SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->url,     SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));

    setupPropertiesBox();
    
    connect(ui->stitchSource, SIGNAL(currentIndexChanged(QString)), SLOT(changeStitchSet(QString)));

    connect(ui->resetLibrary, SIGNAL(clicked()), SLOT(resetLibrary()));
    connect(ui->icons, SIGNAL(clicked()), SLOT(iconDialog()));

    connect(ui->listView->horizontalHeader(),
            SIGNAL(sectionClicked(int)), SLOT(updateRowSizes()));

    connect(ui->stitchFilter, SIGNAL(textChanged(QString)), SLOT(filterStitchList(QString)));
    connect(ui->clearBttn, SIGNAL(clicked()), SLOT(clearStitchFilter()));

    setButtonStates(master);
}