Exemplo n.º 1
0
/**
 * Lay out the widgets (portrait mode).
 */
void TitleScreen::setupUI()
{

	// Get the handle to the main layout and the screen.
	mMainLayout = getMainLayout();
	mScreen = getScreen();
	mLabel = getTopLabel();
	mBackButton = getTopButtonLeft();
	mNextButton = getTopButtonRight();

	// Set the text for the widget in the top layout: the label and the buttons.
	setButtonText(mNextButton, " NEXT ");
	setButtonText(mBackButton, " BACK ");

	// The creation of the main layout is already done in the base class
	// constructor, called at derived object creation.
	// So, we can use  a handle for the main layout at any point.

	// Add an empty list view.
	// Each line will have a check box, and the related label with article title
	// List is populated when search is performed, and showScreen() is called.
	// The height is ScreenHeight - the size of the top layout.
	mListView = createListView(mScreenWidth, 7*mScreenHeight/8);
	maWidgetAddChild(mMainLayout, mListView);
}
Exemplo n.º 2
0
void AdvancedWidget<BaseClass>::updateHeaderState()
{
	QBoxLayout* bl = getMainLayout();

	if(!bl) {
		return;
	}

	if(isUseBorder()) {
		WindowHeader *wh = getWindowHeader();
		if (wh) {
			bl->removeWidget(wh);
			wh->deleteLater();
		}

		setMousetTrackingForWidgetWithChildren(this, false);

	}
	else {
		WindowHeader* wh = new WindowHeader(this);
		wh->setCaption(BaseClass::windowTitle());
		bl->insertWidget(0, wh);

		setMousetTrackingForWidgetWithChildren(this, true);
	}
}
Exemplo n.º 3
0
WindowHeader *AdvancedWidget<BaseClass>::getWindowHeader() const
{
	WindowHeader *wh = nullptr;

	QBoxLayout* bl = getMainLayout();
	if(bl) {
		wh = qobject_cast<WindowHeader*>(bl->itemAt(0)->widget());
	}

	return wh;
}
Exemplo n.º 4
0
    void AbstractNumberFilter::createWidget()
    {
      QFont greaterThanLessThanFont("SansSerif", 9);

      QRadioButton * lessThanButton = new QRadioButton("<=");
      lessThanButton->setFont(greaterThanLessThanFont);
      QRadioButton * greaterThanButton = new QRadioButton(">=");
      greaterThanButton->setFont(greaterThanLessThanFont);

      greaterThanLessThan = new QButtonGroup;
      connect(greaterThanLessThan, SIGNAL(buttonClicked(int)),
              this, SIGNAL(filterChanged()));
      greaterThanLessThan->addButton(lessThanButton, 0);
      greaterThanLessThan->addButton(greaterThanButton, 1);

      // hide inclusive and exclusive buttons, and add greater than and less than
      // in the inclusiveExclusiveLayout.
      getInclusiveExclusiveLayout()->itemAt(0)->widget()->setVisible(false);
      getInclusiveExclusiveLayout()->itemAt(1)->widget()->setVisible(false);
      getInclusiveExclusiveLayout()->addWidget(lessThanButton);
      getInclusiveExclusiveLayout()->addWidget(greaterThanButton);

      lineEditText = new QString;

      lineEdit = new QLineEdit;
      lineEdit->setMinimumWidth(75);
      connect(lineEdit, SIGNAL(textChanged(QString)),
              this, SLOT(updateLineEditText(QString)));
      connect(lineEdit, SIGNAL(textChanged(QString)),
              this, SIGNAL(filterChanged()));


      QHBoxLayout * layout = new QHBoxLayout;
      QMargins margins = layout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      layout->setContentsMargins(margins);
      layout->addWidget(lineEdit);
      layout->addStretch();

      getMainLayout()->addLayout(layout);

      // FIXME: QSettings should handle this
      lessThanButton->click();
    }
Exemplo n.º 5
0
/**
 * Lay out the widgets (portrait mode).
 */
void WebScreen::setupUI()
{

	// Get the handle to the main layout and the screen.
	mMainLayout = getMainLayout();
	mScreen = getScreen();
	mLabel = getTopLabel();
	mBackButton = getTopButtonLeft();
	mNewSearchButton = getTopButtonRight();

	setButtonText(mBackButton, " BACK ");
	setButtonText(mNewSearchButton, "New Search");

	// Add the web view that contains the article.
	// It will be filled when this screen is displayed,
	// based on the checked titles from TitlesScreen.
	mWebView = createWebView(
		MAW_CONSTANT_FILL_AVAILABLE_SPACE, MAW_CONSTANT_FILL_AVAILABLE_SPACE);

	maWidgetAddChild(mMainLayout, mWebView);
}
Exemplo n.º 6
0
/**
 * Lay out the widgets (portrait mode).
 */
void SummaryScreen::setupUI()
{

	// Get the handle to the main layout and the screen.
	mMainLayout = getMainLayout();
	mScreen = getScreen();
	mLabel = getTopLabel();
	mHomeButton = getTopButtonRight();
	mBackButton = getTopButtonLeft();

	// Set the text for the widget in the top layout: the label and button.
	setButtonText(mBackButton, " BACK ");
	setButtonText(mHomeButton, " New Search ");

	// Add the list view that will contain the snippets.
	// It will be filled when this screen is displayed, based on the checked
	// titles from TitlesScreen.
	// The height is ScreenHeight - the size of the top layout.
	mListView = createListView(mScreenWidth, 7*mScreenHeight/8);
	maWidgetAddChild(mMainLayout, mListView);
}
Exemplo n.º 7
0
    void AbstractStringFilter::createWidget()
    {
      lineEditText = new QString;

      lineEdit = new QLineEdit;
      lineEdit->setMinimumWidth(250);
      connect(lineEdit, SIGNAL(textChanged(QString)),
          this, SLOT(updateLineEditText(QString)));
      connect(lineEdit, SIGNAL(textChanged(QString)),
          this, SIGNAL(filterChanged()));

      QHBoxLayout * layout = new QHBoxLayout;
      QMargins margins = layout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      layout->setContentsMargins(margins);
      layout->addWidget(lineEdit);
      layout->addStretch();

      getMainLayout()->addLayout(layout);
    }
Exemplo n.º 8
0
    void AbstractMultipleChoiceFilter::createWidget(QStringList options) {
      m_combo = new QComboBox;
      foreach (QString option, options)
        m_combo->addItem(option);

      m_combo->setCurrentIndex(0);

      *m_curChoice = m_combo->currentText();

      connect(m_combo, SIGNAL(currentIndexChanged(QString)),
          this, SLOT(updateCurChoice(QString)));

      QHBoxLayout *layout = new QHBoxLayout;
      QMargins margins = layout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      layout->setContentsMargins(margins);
      layout->addWidget(m_combo);
      layout->addStretch();

      getMainLayout()->addLayout(layout);
    }
Exemplo n.º 9
0
/**
 * Lay out the widgets (portrait mode).
 */
void HomeScreen::setupUI()
{
	// Get the handle to the main layout and the screen.
	mMainLayout = getMainLayout();
	mScreen = getScreen();
	mLabel = getTopLabel();
	mSearchButton = getTopButtonRight();
	// We do not need a Back button in this screen,
	// so we can dismiss it.
	MAWidgetHandle backBtn = getTopButtonLeft();
	maWidgetDestroy(backBtn);

	// The creation of the main layout is already done in the base class
	// constructor, called at derived object creation.
	// So, we can use  a handle for the main layout at any point.

	// Set the text for the button widget in the top layout.
	setButtonText(mSearchButton, " NEXT ");

	// Add a label before the Progress bar.
	mProgressLabel = createLabel(
			mScreenWidth,
			" Please wait...",
			DARK_GREY,
			mFontSize );
	// Show it only after Search is pressed.
	maWidgetSetProperty(mProgressLabel,MAW_WIDGET_VISIBLE, "false");
	maWidgetAddChild(mMainLayout, mProgressLabel);

	// Create a progress bar for the Search action.
	mProgressBar = createProgressBar();

	// Set the range of the progress bar from 0..100
	setWidgetProperty(
		mProgressBar, MAW_PROGRESS_BAR_MAX, PROGRESS_BAR_MAX_VALUE);
	// Set the progress value to 0.
	setWidgetProperty(
		mProgressBar, MAW_PROGRESS_BAR_PROGRESS, 0);
	// Hide the widget at first, and display it when a Search is being performed.
	maWidgetSetProperty(
		mProgressBar, MAW_WIDGET_VISIBLE, "false");

	maWidgetAddChild(mMainLayout, mProgressBar);

	// Next, fill the remaining space with an edit box and
	// some check boxes for the categories.
	MAWidgetHandle hintLabel = createLabel(
			mScreenWidth,
			MESSAGE_EDITBOX_HINT.c_str(),
			BLUE,
			mFontSize);
	maWidgetSetProperty(
		hintLabel,MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT,MAW_ALIGNMENT_LEFT);
	maWidgetAddChild(mMainLayout, hintLabel);

	// Add only one edit box.
	mEditBox = createEditBox(mScreenWidth, MAW_CONSTANT_WRAP_CONTENT);
	maWidgetAddChild(mMainLayout, mEditBox);

	// Add a small spacer before the categories.
	maWidgetAddChild(mMainLayout, createSpacer(mScreenWidth, mPaddingSize));

	// Add the layout with checkable categories.
	maWidgetAddChild( mMainLayout, createCategoriesLayout());

	// Add a label for the slider.
	MAWidgetHandle sliderLabel = createLabel(
			mScreenWidth,
			" Please select the results limit. ",
			BLUE,mFontSize);
	maWidgetAddChild(mMainLayout, sliderLabel);

	// Create a slider control for selecting the desired number of results.
	mSlider = createSlider();
	setWidgetProperty(mSlider, MAW_SLIDER_MAX, SLIDER_MAX_VALUE);
	// Set the current slider value to 10.
	setWidgetProperty(mSlider, MAW_SLIDER_VALUE, 10);
	maWidgetAddChild(mMainLayout, mSlider);

	// Add two labels with minimum and maximum value of the slider.
	MAWidgetHandle valuesLayout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT);
	MAWidgetHandle minValue = createLabel(
			mScreenWidth / 2,
			 " 0 ",
			 DARK_GREY,
			 mFontSize);
	maWidgetSetProperty(minValue, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT,
			MAW_ALIGNMENT_LEFT);
	maWidgetAddChild(valuesLayout, minValue);

	MAWidgetHandle maxValue = createLabel(
			mScreenWidth / 2,
			"", DARK_GREY,
			mFontSize);
	setWidgetProperty(maxValue, MAW_LABEL_TEXT, SLIDER_MAX_VALUE);
	maWidgetSetProperty(maxValue, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT,
			MAW_ALIGNMENT_RIGHT);
	maWidgetAddChild(valuesLayout, maxValue);

	// Add this layout to the main one.
	maWidgetAddChild(mMainLayout, valuesLayout);
}