예제 #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());
}