Пример #1
0
ZFileDialog::ZFileDialog(QWidget* p,const QString& dir,const QString& nameFilter,int filter,int sort)
	:UTIL_Dialog(UTIL_Dialog::DTLargeSize,true,p,"OpenFile Dialog",1,0)
{
	setHasTitle(true);
	setDlgTitle(tr("Select a file plz"));
   //QVBox *cw = new QVBox(this);
   //setDlgContent(cw);
	browser=new FileView(nameFilter,filter, this/*getDlgContent()*/,sort, "browser");
	setDlgContent(browser);
	browser->setDir(dir);

	QHBox *hb = new QHBox(this);
	setDlgCst(hb);

	ZPushButton *okBtn = new ZPushButton(hb, 0, -1, -1);
	okBtn->setText(tr("OK"));	
	connect(okBtn,SIGNAL(clicked()),this,SLOT(accept()));
	
	ZPushButton *cancelBtn=new ZPushButton(hb, 0, -1, -1);
	cancelBtn->setText(tr("Cancel"));	
	connect(cancelBtn,SIGNAL(clicked()),this,SLOT(reject()));
	
	ZPushButton *backBtn=new ZPushButton(hb, 0, -1, -1);
	backBtn->setText(tr("Back"));
	connect(browser,SIGNAL(rootDir(bool)),backBtn,SLOT(setDisabled(bool)));
	connect(backBtn,SIGNAL(clicked()),this,SLOT(dirUp()));
}
Пример #2
0
//---------------------------------------------------------------------------
//  CardboxForm
//
//! Constructor.
//
//! @param parent the parent widget
//! @param f widget flags
//---------------------------------------------------------------------------
CardboxForm::CardboxForm(WordEngine* e, QWidget* parent, Qt::WFlags f)
    : ActionForm(CardboxFormType, parent, f), wordEngine(e)
    //cardboxCountModel(0), cardboxDaysModel(0), cardboxContentsModel(0)
{
    QVBoxLayout* mainVlay = new QVBoxLayout(this);
    mainVlay->setMargin(MARGIN);
    mainVlay->setSpacing(SPACING);

    lexiconWidget = new LexiconSelectWidget;
    connect(lexiconWidget->getComboBox(), SIGNAL(activated(const QString&)),
        SLOT(lexiconActivated(const QString&)));
    mainVlay->addWidget(lexiconWidget);

    QHBoxLayout* quizTypeHlay = new QHBoxLayout;
    quizTypeHlay->setSpacing(SPACING);
    mainVlay->addLayout(quizTypeHlay);

    QLabel* quizTypeLabel = new QLabel;
    quizTypeLabel->setText("Quiz Type:");
    quizTypeHlay->addWidget(quizTypeLabel);

    quizTypeCombo = new QComboBox;
    quizTypeCombo->addItem(Auxil::quizTypeToString(QuizSpec::QuizAnagrams));
    quizTypeCombo->addItem(
        Auxil::quizTypeToString(QuizSpec::QuizAnagramsWithHooks));
    quizTypeCombo->addItem(Auxil::quizTypeToString(QuizSpec::QuizHooks));
    quizTypeHlay->addWidget(quizTypeCombo);

    QFrame* topSepFrame = new QFrame;
    topSepFrame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    mainVlay->addWidget(topSepFrame);

    QGridLayout* cardboxGlay = new QGridLayout;
    cardboxGlay->setSpacing(SPACING);
    mainVlay->addLayout(cardboxGlay);

    QLabel* cardboxCountLabel = new QLabel;
    cardboxCountLabel->setText("Questions in each cardbox:");
    cardboxGlay->addWidget(cardboxCountLabel, 0, 0);

    cardboxCountTree = new QTreeWidget;
    QStringList cardboxCountTreeHeaders;
    cardboxCountTreeHeaders.append("Cardbox");
    cardboxCountTreeHeaders.append("Count");
    cardboxCountTree->setHeaderLabels(cardboxCountTreeHeaders);
    cardboxGlay->addWidget(cardboxCountTree, 1, 0);

    QLabel* cardboxDaysLabel = new QLabel;
    cardboxDaysLabel->setText("Questions due in days from today:");
    cardboxGlay->addWidget(cardboxDaysLabel, 0, 1);

    cardboxDaysTree = new QTreeWidget;
    QStringList cardboxDaysTreeHeaders;
    cardboxDaysTreeHeaders.append("Days");
    cardboxDaysTreeHeaders.append("Count");
    cardboxDaysTree->setHeaderLabels(cardboxDaysTreeHeaders);
    cardboxGlay->addWidget(cardboxDaysTree, 1, 1);

    //cardboxContentsView = new QTreeView;
    //mainVlay->addWidget(cardboxContentsView);

    ZPushButton* refreshButton = new ZPushButton;
    refreshButton->setText("&Refresh");
    refreshButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(refreshButton, SIGNAL(clicked()), SLOT(refreshClicked()));
    mainVlay->addWidget(refreshButton);

    QFrame* bottomSepFrame = new QFrame;
    bottomSepFrame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
    mainVlay->addWidget(bottomSepFrame);

    QHBoxLayout* questionHlay = new QHBoxLayout;
    questionHlay->setMargin(0);
    questionHlay->setSpacing(SPACING);
    mainVlay->addLayout(questionHlay);

    QLabel* questionLabel = new QLabel;
    questionLabel->setText("Get data for question:");
    questionHlay->addWidget(questionLabel);

    questionLine = new QLineEdit;
    WordValidator* validator = new WordValidator(questionLine);
    validator->setOptions(WordValidator::AllowQuestionMarks);
    questionLine->setValidator(validator);
    connect(questionLine, SIGNAL(returnPressed()), SLOT(questionDataClicked()));
    questionHlay->addWidget(questionLine);

    QPushButton* questionButton = new QPushButton;
    questionButton->setText("Get Info");
    questionButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(questionButton, SIGNAL(clicked()), SLOT(questionDataClicked()));
    questionHlay->addWidget(questionButton);

    questionDataLabel = new QLabel;
    questionDataLabel->setAlignment(Qt::AlignTop);
    mainVlay->addWidget(questionDataLabel, 1);

    //mainVlay->addStretch(0);

    //connect(&refreshTimer, SIGNAL(timeout()), SLOT(refreshClicked()));
    //refreshTimer.start(REFRESH_MSECS);

    lexiconActivated(lexiconWidget->getCurrentLexicon());
}
//---------------------------------------------------------------------------
//  CardboxRescheduleDialog
//
//! Constructor.
//
//! @param parent the parent widget
//! @param f widget flags
//---------------------------------------------------------------------------
CardboxRescheduleDialog::CardboxRescheduleDialog(QWidget* parent, Qt::WFlags f)
    : QDialog(parent, f)
{
    QVBoxLayout* mainVlay = new QVBoxLayout(this);
    mainVlay->setMargin(MARGIN);
    mainVlay->setSpacing(SPACING);

    lexiconWidget = new LexiconSelectWidget;
    mainVlay->addWidget(lexiconWidget);

    QHBoxLayout* quizTypeHlay = new QHBoxLayout;
    mainVlay->addLayout(quizTypeHlay);

    QLabel* quizTypeLabel = new QLabel;
    quizTypeLabel->setText("Reschedule words for quiz type:");
    quizTypeHlay->addWidget(quizTypeLabel);

    quizTypeCombo = new QComboBox;
    quizTypeCombo->addItem(Auxil::quizTypeToString(QuizSpec::QuizAnagrams));
    quizTypeCombo->addItem(
        Auxil::quizTypeToString(QuizSpec::QuizAnagramsWithHooks));
    quizTypeCombo->addItem(Auxil::quizTypeToString(QuizSpec::QuizHooks));
    quizTypeHlay->addWidget(quizTypeCombo);

    QButtonGroup* methodGroup = new QButtonGroup(this);

    QHBoxLayout* backlogHlay = new QHBoxLayout;
    mainVlay->addLayout(backlogHlay);

    shiftQuestionsButton = new QRadioButton;
    shiftQuestionsButton->setText("Shift words so this many are ready now:");
    connect(shiftQuestionsButton, SIGNAL(toggled(bool)),
            SLOT(shiftQuestionsButtonToggled(bool)));
    methodGroup->addButton(shiftQuestionsButton);
    backlogHlay->addWidget(shiftQuestionsButton);

    backlogSbox = new QSpinBox;
    backlogSbox->setMinimum(1);
    backlogSbox->setMaximum(999999);
    backlogHlay->addWidget(backlogSbox);

    rescheduleQuestionsButton = new QRadioButton;
    rescheduleQuestionsButton->setText("Reschedule words according to "
                                       "their cardbox");
    methodGroup->addButton(rescheduleQuestionsButton);
    mainVlay->addWidget(rescheduleQuestionsButton);

    QFrame* hline = new QFrame;
    hline->setFrameShape(QFrame::HLine);
    mainVlay->addWidget(hline);

    QButtonGroup* selectGroup = new QButtonGroup(this);

    selectAllButton = new QRadioButton;
    selectAllButton->setText("Reschedule all words");
    selectGroup->addButton(selectAllButton);
    mainVlay->addWidget(selectAllButton);

    selectSearchButton = new QRadioButton;
    connect(selectSearchButton, SIGNAL(toggled(bool)),
            SLOT(useSearchButtonToggled(bool)));
    selectSearchButton->setText("Reschedule only words matching search "
                                "specification");
    selectGroup->addButton(selectSearchButton);
    mainVlay->addWidget(selectSearchButton);

    searchSpecGbox = new QGroupBox("Search Specification");
    mainVlay->addWidget(searchSpecGbox);

    QHBoxLayout* specHlay = new QHBoxLayout(searchSpecGbox);

    searchSpecForm = new SearchSpecForm;
    specHlay->addWidget(searchSpecForm);

    QHBoxLayout* buttonHlay = new QHBoxLayout;
    buttonHlay->setSpacing(SPACING);
    mainVlay->addLayout(buttonHlay);

    ZPushButton* okButton = new ZPushButton("&OK");
    okButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    okButton->setDefault(true);
    connect(okButton, SIGNAL(clicked()), SLOT(accept()));
    buttonHlay->addWidget(okButton);

    ZPushButton* cancelButton = new ZPushButton("Cancel");
    cancelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(cancelButton, SIGNAL(clicked()), SLOT(reject()));
    buttonHlay->addWidget(cancelButton);

    setWindowTitle(DIALOG_CAPTION);
    shiftQuestionsButton->setChecked(true);
    selectAllButton->setChecked(true);
    searchSpecGbox->setEnabled(false);
}