Beispiel #1
0
OrderDialog::OrderDialog(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::OrderDialog),
    m_format(PageOrderFormat)
{
    m_ui->setupUi(this);
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    m_ui->upButton->setIcon(createIconSet(QString::fromUtf8("up.png")));
    m_ui->downButton->setIcon(createIconSet(QString::fromUtf8("down.png")));
    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
    connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(slotReset()));
    // Catch the remove operation of a DnD operation in QAbstractItemView::InternalMove mode to enable buttons
    // Selection mode is 'contiguous' to enable DnD of groups
    connect(m_ui->pageList->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(slotEnableButtonsAfterDnD()));

    m_ui->upButton->setEnabled(false);
    m_ui->downButton->setEnabled(false);
}
Beispiel #2
0
Desktopwidget::Desktopwidget (QWidget *parent)
      : QSplitter (parent)
   {
   _model = new Dirmodel ();
//    _model->setLazyChildCount (true);
   _dir = new Dirview (this);
   _dir->setModel (_model);

   _contents = new Desktopmodel (this);

   QWidget *group = createToolbar();

   _view = new Desktopview (group);
   QVBoxLayout *lay = new QVBoxLayout (group);
   lay->setContentsMargins (0, 0, 0, 0);
   lay->setSpacing (2);
   lay->addWidget (_toolbar);
   lay->addWidget (_view);

   connect (_view, SIGNAL (itemPreview (const QModelIndex &, int, bool)),
         this, SLOT (slotItemPreview (const QModelIndex &, int, bool)));

#ifdef USE_PROXY
   _proxy = new Desktopproxy (this);
   _proxy->setSourceModel (_contents);
   _view->setModel (_proxy);
//    printf ("contents=%p, proxy=%p\n", _contents, _proxy);

   // set up the model converter
   _modelconv = new Desktopmodelconv (_contents, _proxy);

   // setup another one for Desktopmodel, which only allows assertions
   _modelconv_assert = new Desktopmodelconv (_contents, _proxy, false);
#else
   _proxy = 0;
   _view->setModel (_contents);
   _modelconv = new Desktopmodelconv (_contents);

   // setup another one for Desktopmodel, which only allows assertions
   _modelconv_assert = new Desktopmodelconv (_contents, false);
#endif

   _view->setModelConv (_modelconv);

   _contents->setModelConv (_modelconv_assert);

   _delegate = new Desktopdelegate (_modelconv, this);
   _view->setItemDelegate (_delegate);
   connect (_delegate, SIGNAL (itemClicked (const QModelIndex &, int)),
         this, SLOT (slotItemClicked (const QModelIndex &, int)));
   connect (_delegate, SIGNAL (itemPreview (const QModelIndex &, int, bool)),
         this, SLOT (slotItemPreview (const QModelIndex &, int, bool)));
   connect (_delegate, SIGNAL (itemDoubleClicked (const QModelIndex &)),
      this, SLOT (openStack (const QModelIndex &)));

   connect (_contents, SIGNAL (undoChanged ()),
      this, SIGNAL (undoChanged ()));
   connect (_contents, SIGNAL (dirChanged (QString&, QModelIndex&)),
      this, SLOT (slotDirChanged (QString&, QModelIndex&)));
   connect (_contents, SIGNAL (beginningScan (const QModelIndex &)),
      this, SLOT (slotBeginningScan (const QModelIndex &)));
   connect (_contents, SIGNAL (endingScan (bool)),
      this, SLOT (slotEndingScan (bool)));
   connect (_contents, SIGNAL(updateRepositoryList (QString &, bool)),
            this, SLOT(slotUpdateRepositoryList (QString &, bool)));

    // position the items when the model is reset, otherwise things
    // move and look ugly for a while
    connect (_contents, SIGNAL (modelReset ()), _view, SLOT (setPositions ()));

   createPage();

   // and when there are no selected items
   connect (_view, SIGNAL (pageLost()), _page, SLOT (slotReset ()));

   _parent = parent;
   _pendingMatch = QString::null;
   _updating = false;

   // setup the preview timer
   _timer = new QTimer ();
   _timer->setSingleShot (true);
   connect (_timer, SIGNAL(timeout()), this, SLOT(updatePreview()));

   connect (_dir, SIGNAL (clicked (const QModelIndex&)),
            this, SLOT (dirSelected (const QModelIndex&)));
   connect (_dir, SIGNAL (activated (const QModelIndex&)),
            this, SLOT (dirSelected (const QModelIndex&)));
   connect (_model, SIGNAL(droppedOnFolder(const QMimeData *, QString &)),
            this, SLOT(slotDroppedOnFolder(const QMimeData *, QString &)));

   /* notice when the current directory is fully displayed so we can handle
      any pending action */
   connect (_contents, SIGNAL (updateDone()), this, SLOT (slotUpdateDone()));

   // connect signals from the directory tree
   connect (_dir->_new, SIGNAL (triggered ()), this, SLOT (newDir ()));
   connect (_dir->_rename, SIGNAL (triggered ()), this, SLOT (renameDir ()));
   connect (_dir->_delete, SIGNAL (triggered ()), this, SLOT (deleteDir ()));
   connect (_dir->_refresh, SIGNAL (triggered ()), this, SLOT (refreshDir ()));
   connect (_dir->_add_recent, SIGNAL (triggered ()), this,
            SLOT (addToRecent ()));
   connect (_dir->_add_repository, SIGNAL (triggered ()), this,
            SLOT (slotAddRepository ()));
   connect (_dir->_remove_repository, SIGNAL (triggered ()), this,
            SLOT (slotRemoveRepository ()));

   setStretchFactor(indexOf(_dir), 0);

   QList<int> size;

   if (!getSettingsSizes ("desktopwidget/", size))
      {
      size.append (200);
      size.append (1000);
      size.append (400);
      }
   setSizes (size);

   connect (_view, SIGNAL (popupMenu (QModelIndex &)),
         this, SLOT (slotPopupMenu (QModelIndex &)));

   // allow top level to see our view messages
   connect (_view, SIGNAL (newContents (QString)), this, SIGNAL (newContents (QString)));

   addActions();

   /* unfortunately when we first run maxview it starts with the main window
      un-maximised. This means that scrollToLast() doesn't quite scroll far
      enough for the maximised view which appears soon afterwards. As a hack
      for the moment, we do another scroll 1 second after starting up */
   QTimer::singleShot(1000, _view, SLOT (scrollToLast()));
   }
Beispiel #3
0
void KPrPieProperty::setPieValues( const KPrPieValueCmd::PieValues &pieValues )
{
    m_pieValues = pieValues;
    slotReset();
}
Beispiel #4
0
void
ColumnEdit::createWidgets()
{
    setCaption("Column Edit");
    menuBar();

    QFrame* main = new QFrame(this);
    QVBox* body = new QVBox(main);
    QFrame* top = new QFrame(body);
    QFrame* mid = new QFrame(body);
    QVBox* right = new QVBox(main);

    QLabel* nameLabel = new QLabel("&Name:", top);
    _name = new LineEdit(top);
    nameLabel->setBuddy(_name);

    QLabel* descLabel = new QLabel("&Description:", top);
    _desc = new MultiLineEdit(top);
    descLabel->setBuddy(_desc);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setRowStretch(2, 1);
    topGrid->setColStretch(1, 1);
    topGrid->addWidget(nameLabel, 0, 0);
    topGrid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addMultiCellWidget(_desc, 1, 2, 1, 1);

    QLabel* typeLabel = new QLabel("&Type:", mid);
    _type = new ComboBox(mid);
    typeLabel->setBuddy(_type);

    QLabel* lengthLabel = new QLabel("&Length:", mid);
    _length = new LineEdit(mid);
    lengthLabel->setBuddy(_length);

    _manditory = new QCheckBox("Manditory?", mid);
    _unique = new QCheckBox("Unique?", mid);

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(2, 1);
    midGrid->addColSpacing(2, 20);
    midGrid->addWidget(typeLabel, 0, 0);
    midGrid->addWidget(_type, 0, 1, AlignLeft | AlignVCenter);
    midGrid->addWidget(lengthLabel, 1, 0);
    midGrid->addWidget(_length, 1, 1, AlignLeft | AlignVCenter);
    midGrid->addMultiCellWidget(_manditory, 2, 2, 0, 1,AlignLeft|AlignVCenter);
    midGrid->addMultiCellWidget(_unique, 3, 3, 0, 1,AlignLeft|AlignVCenter);

    QPushButton* ok = new QPushButton("&Ok", right);
    QPushButton* next = new QPushButton("&Next", right);
    QPushButton* reset = new QPushButton("&Reset", right);
    QPushButton* cancel = new QPushButton("&Cancel", right);

    QGridLayout* grid = new QGridLayout(main);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(0, 1);
    grid->addWidget(body, 0, 0);
    grid->addWidget(right, 0, 1, AlignTop | AlignLeft);

    connect(ok, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(next, SIGNAL(clicked()), this, SLOT(slotNext()));
    connect(reset, SIGNAL(clicked()), this, SLOT(slotReset()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
    connect(_type, SIGNAL(activated(int)), this, SLOT(slotTypeChanged()));

    for (int type = 0; type <= ColumnDefn::TYPE_QUANTITY; ++type)
	_type->insertItem(ColumnDefn::typeName(type));

    setCentralWidget(main);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Ok"), this, SLOT(slotOk()));
    file->insertItem(tr("&Next"), this, SLOT(slotNext()));
    file->insertItem(tr("&Reset"), this, SLOT(slotReset()));
    file->insertSeparator();
    file->insertItem(tr("&Cancel"), this, SLOT(slotCancel()), ALT+Key_Q);
    menuBar()->insertItem(tr("&File"), file);
}
Beispiel #5
0
void
ModelEdit::createWidgets()
{
    setCaption("Model Edit");
    menuBar();

    QFrame* main = new QFrame(this);
    QVBox* body = new QVBox(main);
    QFrame* top = new QFrame(body);
    QVBox* right = new QVBox(main);

    QLabel* versionLabel = new QLabel("&Version:", top);
    _version = new LineEdit(top);
    versionLabel->setBuddy(_version);

    QLabel* descLabel = new QLabel("&Description:", top);
    _desc = new MultiLineEdit(top);
    descLabel->setBuddy(_desc);

    QLabel* fromLabel = new QLabel("&From:", top);
    _from = new LineEdit(top);
    fromLabel->setBuddy(_from);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setRowStretch(2, 1);
    topGrid->setColStretch(1, 1);
    topGrid->addWidget(versionLabel, 0, 0);
    topGrid->addWidget(_version, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addMultiCellWidget(_desc, 1, 2, 1, 1);
    topGrid->addWidget(fromLabel, 3, 0);
    topGrid->addWidget(_from, 3, 1, AlignLeft | AlignVCenter);

    QTabWidget* tabs = new QTabWidget(body);
    QVBox* objects = new QVBox(tabs);
    QVBox* updates = new QVBox(tabs);
    tabs->addTab(objects, tr("Objects"));
    tabs->addTab(updates, tr("Updates"));

    _objects = new ListView(objects);
    _objects->setAllColumnsShowFocus(true);
    _objects->setShowSortIndicator(true);
    _objects->addTextColumn("Name", 20);
    _objects->addTextColumn("Number", 10);
    _objects->addTextColumn("Description", 40);

    QHBox* objectCmds = new QHBox(objects);
    QPushButton* addObject = new QPushButton("Add Object", objectCmds);
    QPushButton* editObject = new QPushButton("Edit Object", objectCmds);
    QPushButton* removeObject = new QPushButton("Remove Object", objectCmds);

    _updates = new ListView(updates);
    _updates->setAllColumnsShowFocus(true);
    _updates->setShowSortIndicator(true);
    _updates->addTextColumn("Number", 10);
    _updates->addTextColumn("Description", 60);

    QHBox* updateCmds = new QHBox(updates);
    QPushButton* addUpdate = new QPushButton("Add Update", updateCmds);
    QPushButton* editUpdate = new QPushButton("Edit Update", updateCmds);
    QPushButton* removeUpdate = new QPushButton("Remove Update", updateCmds);

    QPushButton* ok = new QPushButton("&Ok", right);
    QPushButton* reset = new QPushButton("&Reset", right);
    QPushButton* cancel = new QPushButton("&Cancel", right);

    QGridLayout* grid = new QGridLayout(main);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(0, 1);
    grid->addWidget(body, 0, 0);
    grid->addWidget(right, 0, 1, AlignTop | AlignLeft);

    connect(ok, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(reset, SIGNAL(clicked()), this, SLOT(slotReset()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
    connect(addObject, SIGNAL(clicked()), this, SLOT(slotAddObject()));
    connect(editObject, SIGNAL(clicked()), this, SLOT(slotEditObject()));
    connect(removeObject, SIGNAL(clicked()), this, SLOT(slotRemoveObject()));
    connect(_objects, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotEditObject()));
    connect(addUpdate, SIGNAL(clicked()), this, SLOT(slotAddObject()));
    connect(editUpdate, SIGNAL(clicked()), this, SLOT(slotEditObject()));
    connect(removeUpdate, SIGNAL(clicked()), this, SLOT(slotRemoveObject()));
    connect(_updates, SIGNAL(doubleClicked(QListViewItem*)), this,
	    SLOT(slotEditUpdate()));

    setCentralWidget(main);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Ok"), this, SLOT(slotOk()));
    file->insertItem(tr("&Reset"), this, SLOT(slotReset()));
    file->insertSeparator();
    file->insertItem(tr("&Cancel"), this, SLOT(slotCancel()), ALT+Key_Q);
    menuBar()->insertItem(tr("&File"), file);
}
Beispiel #6
0
BoardSetupDialog::BoardSetupDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f),
    m_wheelCurrentDelta(0), m_selectedPiece(Empty), inDrag(false)
{
    setObjectName("BoardSetupDialog");
    ui.setupUi(this);

    QPushButton *pasteButton = ui.buttonBox->addButton(tr("Paste FEN"), QDialogButtonBox::ActionRole);
    copyButton = ui.buttonBox->addButton(tr("Copy FEN"), QDialogButtonBox::ApplyRole);
    btCopyText = ui.buttonBox->addButton(tr("Copy Text"), QDialogButtonBox::ApplyRole);

    restoreLayout();

    ui.boardView->configure();
    ui.boardView->setFlags(BoardView::IgnoreSideToMove | BoardView::SuppressGuessMove | BoardView::AllowCopyPiece);
    ui.boardView->showMoveIndicator(false);
    ui.boardView->showCoordinates(true);

    m_minDeltaWheel = AppSettings->getValue("/Board/minWheelCount").toInt();

    for(int piece = Empty; piece <= BlackPawn; piece++)
    {
        BoardSetupToolButton* button = new BoardSetupToolButton(this);
        button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
        button->setMinimumSize(QSize(10, 10));
        button->m_piece = (Piece)piece;
        if(piece == Empty)
        {
            button->m_pixmap = QPixmap(0, 0);
            ui.buttonLayout->addWidget(button, 6, 0);
        }
        else
        {
            button->m_pixmap = ui.boardView->theme().piece(Piece(piece));
            ui.buttonLayout->addWidget(button, (piece - 1) % 6, piece >= BlackKing);
        }
        connect(button, SIGNAL(signalDragStarted(QWidget*, QMouseEvent*)), this, SLOT(startDrag(QWidget*, QMouseEvent*)));
        connect(button, SIGNAL(signalClicked(Piece)), this, SLOT(labelClicked(Piece)));
        connect(this, SIGNAL(signalClearBackground(Piece)), button, SLOT(slotClearBackground(Piece)));
    }

    emit signalClearBackground(Empty);

    ui.buttonBoxTools->button(QDialogButtonBox::RestoreDefaults)->setText(tr("Clear"));
    connect(ui.buttonBoxTools->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), SLOT(slotClear()));
    connect(ui.buttonBoxTools->button(QDialogButtonBox::Reset), SIGNAL(clicked()), SLOT(slotReset()));

    connect(ui.boardView, SIGNAL(clicked(Square, int, QPoint, Square)), SLOT(slotSelected(Square, int)));
    connect(ui.boardView, SIGNAL(moveMade(Square, Square, int)), SLOT(slotMovePiece(Square, Square)));
    connect(ui.boardView, SIGNAL(copyPiece(Square, Square)), SLOT(slotCopyPiece(Square, Square)));
    connect(ui.boardView, SIGNAL(invalidMove(Square)), SLOT(slotInvalidMove(Square)));
    connect(ui.boardView, SIGNAL(wheelScrolled(int)), SLOT(slotChangePiece(int)));
    connect(ui.boardView, SIGNAL(pieceDropped(Square, Piece)), SLOT(slotDroppedPiece(Square, Piece)));
    connect(ui.toMoveButton, SIGNAL(clicked()), SLOT(slotToggleSide()));
    connect(ui.wkCastleCheck, SIGNAL(stateChanged(int)), SLOT(slotCastlingRights()));
    connect(ui.wqCastleCheck, SIGNAL(stateChanged(int)), SLOT(slotCastlingRights()));
    connect(ui.bkCastleCheck, SIGNAL(stateChanged(int)), SLOT(slotCastlingRights()));
    connect(ui.bqCastleCheck, SIGNAL(stateChanged(int)), SLOT(slotCastlingRights()));
    connect(ui.epCombo, SIGNAL(currentIndexChanged(int)), SLOT(slotEnPassantSquare()));
    connect(ui.halfmoveSpin, SIGNAL(valueChanged(int)), SLOT(slotHalfmoveClock()));
    connect(ui.moveSpin, SIGNAL(valueChanged(int)), SLOT(slotMoveNumber()));
    connect(ui.btFlipBoard, SIGNAL(clicked()), ui.boardView, SLOT(flip()));
    ui.btFlipBoard->setCheckable(true);

    connect(copyButton, SIGNAL(clicked()), SLOT(slotCopyFen()));
    connect(pasteButton, SIGNAL(clicked()), SLOT(slotPasteFen()));
    connect(btCopyText, SIGNAL(clicked()), SLOT(slotCopyText()));

    connect(ui.btFlipVertical, SIGNAL(clicked()), SLOT(mirrorVertical()));
    connect(ui.btFlipHorizontal, SIGNAL(clicked()), SLOT(mirrorHorizontal()));
    connect(ui.btSwapColor, SIGNAL(clicked()), SLOT(swapColors()));

    ui.tabWidget->setCurrentIndex(0);
}
Beispiel #7
0
void KHistoryComboBox::reset()
{
  slotReset();
}
 void NewPromotedClassPanel::slotAdd() {
     bool ok = false;
     emit newPromotedClass(promotionParameters(), &ok);
     if (ok)
         slotReset();
 }
Beispiel #9
0
void KPrPenStyleWidget::setPen( const KoPenCmd::Pen &pen )
{
    m_pen = pen;
    slotReset();
}