Beispiel #1
0
PreferencesDialog::PreferencesDialog()
{
	setWindowTitle(tr("%1 - Preferences").arg(PROGRAM_NAME));
	setAttribute(Qt::WA_DeleteOnClose);

	sm_writer_state = new QSignalMapper(this);
	sm_writer_format = new QSignalMapper(this);
	sm_writer_postfix = new QSignalMapper(this);

	QVBoxLayout* vbox = new QVBoxLayout(this);
	vbox->setSizeConstraint(QLayout::SetFixedSize);

	QTabWidget *tabWidget = new QTabWidget;
	vbox->addWidget(tabWidget);

	tabWidget->addTab(createRecordingTab(tabWidget), tr("Au&tomatic Recording"));
	tabWidget->addTab(createPathTab(tabWidget), tr("&File paths"));
	tabWidget->addTab(createFormatTab(tabWidget), tr("W&riters"));
	tabWidget->addTab(createMiscTab(tabWidget), tr("&Misc"));
	tabWidget->setUsesScrollButtons(false);

	QHBoxLayout *hbox = new QHBoxLayout;
	QPushButton* button = new QPushButton(tr("&Close"));
	button->setDefault(true);
	connect(button, SIGNAL(clicked(bool)), this, SLOT(accept()));
	hbox->addStretch();
	hbox->addWidget(button);
	vbox->addLayout(hbox);

	show();
}
Beispiel #2
0
ConfigTabDialog::ConfigTabDialog(QWidget *parent_) :
    QDialog(parent_)
{
    QWidget *pStartupWidget = new QWidget;
    _startupForm.setupUi(pStartupWidget);

    QWidget *pHistoryWidget = new QWidget;
    _historyForm.setupUi(pHistoryWidget);

    QTabWidget *pTabWidget = new QTabWidget;
    pTabWidget->addTab(pStartupWidget, QIcon(":/res/fork.png"), "Start");
    pTabWidget->addTab(&_pathsWidget, QIcon(":/res/drive-harddisk.png"), QString::fromUtf8("Ścieżki"));
    pTabWidget->addTab(pHistoryWidget, QIcon(":/res/document-save.png"), "Historia");
    pTabWidget->setUsesScrollButtons(false);

    QDialogButtonBox *pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QVBoxLayout *pMainLayout = new QVBoxLayout;
    pMainLayout->addWidget(pTabWidget);
    pMainLayout->addWidget(pButtonBox);
    setLayout(pMainLayout);
    setWindowTitle("Konfiguracja");
    setWindowIcon(QIcon(":/res/configure.png"));

    foreach (int version, DictInstance::versionList())
    {
        const DictInst& instance = DictInstance::dictInst(version);
        _pathsWidget.addDictionary(instance.getForeignIconName(),
                                    instance.getDescription(), version);
        _startupForm.selectedComboBox->addItem(QIcon(instance.getForeignIconName()),
                                                instance.getDescription(),
                                                QVariant(version+YdpTypes::Foreign));
        _startupForm.selectedComboBox->addItem(QIcon(instance.getNativeIconName()),
                                                instance.getDescription(),
                                                QVariant(version+YdpTypes::Native));
    }
}
PreferencesDialog::PreferencesDialog(Preferences& preferences, QWidget* parent)
	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint),
	m_preferences(preferences)
{
	setWindowTitle(tr("Preferences"));

	QTabWidget* tabs = new QTabWidget(this);
	tabs->addTab(initGeneralTab(), tr("General"));
	tabs->addTab(initStatisticsTab(), tr("Statistics"));
	tabs->addTab(initToolbarTab(), tr("Toolbar"));
	tabs->addTab(initSpellingTab(), tr("Spell Checking"));
	tabs->setUsesScrollButtons(false);

	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));

	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->addWidget(tabs);
	layout->addWidget(buttons);

	// Load settings
	switch (m_preferences.goalType()) {
	case 1:
		m_option_time->setChecked(true);
		break;
	case 2:
		m_option_wordcount->setChecked(true);
		break;
	default:
		m_option_none->setChecked(true);
		break;
	}
	m_time->setValue(m_preferences.goalMinutes());
	m_wordcount->setValue(m_preferences.goalWords());

	m_show_characters->setChecked(m_preferences.showCharacters());
	m_show_pages->setChecked(m_preferences.showPages());
	m_show_paragraphs->setChecked(m_preferences.showParagraphs());
	m_show_words->setChecked(m_preferences.showWords());

	switch (m_preferences.pageType()) {
	case 1:
		m_option_paragraphs->setChecked(true);
		break;
	case 2:
		m_option_words->setChecked(true);
		break;
	default:
		m_option_characters->setChecked(true);
		break;
	}
	m_page_characters->setValue(m_preferences.pageCharacters());
	m_page_paragraphs->setValue(m_preferences.pageParagraphs());
	m_page_words->setValue(m_preferences.pageWords());

	if (m_preferences.accurateWordcount()) {
		m_option_accurate_wordcount->setChecked(true);
	} else {
		m_option_estimate_wordcount->setChecked(true);
	}

	m_always_center->setChecked(m_preferences.alwaysCenter());
	m_block_cursor->setChecked(m_preferences.blockCursor());
	m_rich_text->setChecked(m_preferences.richText());
	m_smooth_fonts->setChecked(m_preferences.smoothFonts());
	m_smart_quotes->setChecked(m_preferences.smartQuotes());
	m_double_quotes->setCurrentIndex(m_preferences.doubleQuotes());
	m_single_quotes->setCurrentIndex(m_preferences.singleQuotes());
	m_typewriter_sounds->setChecked(m_preferences.typewriterSounds());

	m_auto_save->setChecked(m_preferences.autoSave());
	m_save_positions->setChecked(m_preferences.savePositions());

	int style = m_toolbar_style->findData(m_preferences.toolbarStyle());
	if (style == -1) {
		style = m_toolbar_style->findData(Qt::ToolButtonTextUnderIcon);
	}
	m_toolbar_style->setCurrentIndex(style);
	QStringList actions = m_preferences.toolbarActions();
	int pos = 0;
	foreach (const QString& action, actions) {
		QString text = action;
		bool checked = !text.startsWith("^");
		if (!checked) {
			text.remove(0, 1);
		}

		QListWidgetItem* item = 0;
		if (text != "|") {
			int count = m_toolbar_actions->count();
			for (int i = pos; i < count; ++i) {
				if (m_toolbar_actions->item(i)->data(Qt::UserRole).toString() == text) {
					item = m_toolbar_actions->takeItem(i);
					break;
				}
			}
		} else if (checked) {
			item = new QListWidgetItem(QString(20, QChar('-')));
			item->setData(Qt::UserRole, "|");
		}

		if (item != 0) {
			item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
			m_toolbar_actions->insertItem(pos, item);
			pos++;
		}
	}
Beispiel #4
0
void ZObjsManagerWidget::createWidget()
{
  QTabWidget *tabs = new QTabWidget(this);
  tabs->setElideMode(Qt::ElideNone);
  tabs->setUsesScrollButtons(true);

  m_swcObjsTreeView = new QTreeView(this);
  m_swcObjsTreeView->setTextElideMode(Qt::ElideLeft);
  m_swcObjsTreeView->setExpandsOnDoubleClick(false);
  m_swcObjsTreeView->setModel(m_doc->swcObjsModel());
  m_swcObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
  m_swcObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
  connect(m_swcObjsTreeView, SIGNAL(doubleClicked(QModelIndex)),
          this, SLOT(swcItemDoubleClicked(QModelIndex)));
  connect(m_swcObjsTreeView->selectionModel(),
          SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
          this, SLOT(swcSelectionChangedFromTreeView(QItemSelection,QItemSelection)));
  tabs->addTab(m_swcObjsTreeView, "Neurons");

  if (NeutubeConfig::getInstance().getObjManagerConfig().isCategorizedSwcNodeOn()) {
    m_swcNodeObjsTreeView = new QTreeView(this);
    m_swcNodeObjsTreeView->setExpandsOnDoubleClick(false);
    m_swcNodeObjsTreeView->setModel(m_doc->swcNodeObjsModel());
    m_swcNodeObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_swcNodeObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_swcNodeObjsTreeView, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(processDoubleClickOnCategorizedSwcNode(QModelIndex)));
    connect(m_swcNodeObjsTreeView->selectionModel(),
            SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(updateSelectionFromCategorizedSwcNode(QItemSelection,QItemSelection)));
    tabs->addTab(m_swcNodeObjsTreeView, "Neuron Nodes");
  }

  if (NeutubeConfig::getInstance().getMainWindowConfig().isMarkPunctaOn()) {
    m_punctaObjsTreeView = new QTreeView(this);
    m_punctaObjsTreeView->setSortingEnabled(true);
    m_punctaObjsTreeView->setExpandsOnDoubleClick(false);
    m_punctaProxyModel = new QSortFilterProxyModel(this);
    m_punctaProxyModel->setSourceModel(m_doc->punctaObjsModel());
    //m_punctaObjsTreeView->setModel(m_doc->punctaObjsModel());
    m_punctaObjsTreeView->setModel(m_punctaProxyModel);
    m_punctaObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_punctaObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_punctaObjsTreeView, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(punctaItemDoubleClicked(QModelIndex)));
    connect(m_punctaObjsTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(punctaSelectionChangedFromTreeView(QItemSelection,QItemSelection)));
    m_punctaObjsTreeView->sortByColumn(0, Qt::AscendingOrder);
    tabs->addTab(m_punctaObjsTreeView, "Puncta");
  }

  if (GET_APPLICATION_NAME == "FlyEM") {
    m_seedObjsTreeView = new QTreeView(this);
    m_seedObjsTreeView->setSortingEnabled(false);
    m_seedObjsTreeView->setExpandsOnDoubleClick(false);
    m_seedObjsTreeView->setModel(m_doc->seedObjsModel());
    m_seedObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_seedObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
    tabs->addTab(m_seedObjsTreeView, "Seeds");
  }

  QHBoxLayout *layout = new QHBoxLayout;
  layout->addWidget(tabs);
  setLayout(layout);

  if (m_doc->hasSelectedPuncta()) {
    //std::set<ZPunctum*> *selectedPuncta = m_doc->selectedPuncta();
    QList<ZPunctum*> selected =
        m_doc->getSelectedObjectList<ZPunctum>(ZStackObject::TYPE_PUNCTUM);
    QList<ZPunctum*> deselected;
    //std::copy(selectedPuncta->begin(), selectedPuncta->end(), std::back_inserter(selected));
    punctaSelectionChanged(selected, deselected);
  }
  if (!m_doc->hasSelectedSwc()) {
    //std::set<ZSwcTree*> *selectedSwcs = m_doc->selectedSwcs();
    QList<ZSwcTree*> selected =
        m_doc->getSelectedObjectList<ZSwcTree>(ZStackObject::TYPE_SWC);
    QList<ZSwcTree*> deselected;
    //std::copy(selectedSwcs->begin(), selectedSwcs->end(), std::back_inserter(selected));
    swcSelectionChanged(selected, deselected);
  }
  if (m_doc->hasSelectedSwcNode()) {
    std::set<Swc_Tree_Node*> nodeSet = m_doc->getSelectedSwcNodeSet();
    QList<Swc_Tree_Node*> selected;
    QList<Swc_Tree_Node*> deselected;
    std::copy(nodeSet.begin(), nodeSet.end(),
              std::back_inserter(selected));
    swcTreeNodeSelectionChanged(selected, deselected);
  }

  connect(m_doc,
          SIGNAL(punctaSelectionChanged(QList<ZPunctum*>,QList<ZPunctum*>)),
          this, SLOT(punctaSelectionChanged(QList<ZPunctum*>,QList<ZPunctum*>)));
  connect(m_doc,
          SIGNAL(swcSelectionChanged(QList<ZSwcTree*>,QList<ZSwcTree*>)),
          this, SLOT(swcSelectionChanged(QList<ZSwcTree*>,QList<ZSwcTree*>)));
  connect(m_doc,
          SIGNAL(swcTreeNodeSelectionChanged(QList<Swc_Tree_Node*>,QList<Swc_Tree_Node*>)),
          this, SLOT(swcTreeNodeSelectionChanged(QList<Swc_Tree_Node*>,QList<Swc_Tree_Node*>)));
}
/**
 *         \fn qt4DiaFactoryRunTabs
 */
uint8_t qt4DiaFactoryRunTabs(const char *title,uint32_t nb,diaElemTabs **tabs)
{
    QDialog dialog(qtLastRegisteredDialog());

        qtRegisterDialog(&dialog);
  
  ADM_assert(title);
  ADM_assert(nb);
  ADM_assert(tabs);
  
  dialog.setWindowTitle(QString::fromUtf8(title));

  QVBoxLayout *vboxLayout = new QVBoxLayout();
  QGridLayout *layout = new QGridLayout();
  QSpacerItem *spacer = new QSpacerItem(20, 16, QSizePolicy::Minimum, QSizePolicy::Fixed);
  QTabWidget *wtabs = new QTabWidget();
  QDialogButtonBox *buttonBox = new QDialogButtonBox();

    buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);

     QObject::connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
     QObject::connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));

     for(int i=0;i<nb;i++)
     {
        ADM_assert(tabs[i]);
        insertTab(i,tabs[i],wtabs);
      }

         vboxLayout->addLayout(layout);
     vboxLayout->addWidget(wtabs,0,0);
         vboxLayout->addItem(spacer);
     vboxLayout->addWidget(buttonBox,1,0);

         dialog.setLayout(vboxLayout);

         // Expand to see all tabs but still allow the window to be resized smaller
         wtabs->setUsesScrollButtons(false);
         dialog.adjustSize();
         wtabs->setUsesScrollButtons(true);

  if(dialog.exec()==QDialog::Accepted)
  {
      // Read tabs
       for(int tab=0;tab<nb;tab++)
     {
        ADM_assert(tabs[tab]);
        diaElemTabs *myTab=tabs[tab];
        for(int i=0;i<myTab->nbElems;i++)
        {
          myTab->dias[i]->getMe();
        }
    
      }
           qtUnregisterDialog(&dialog);

      return 1;
  }

  qtUnregisterDialog(&dialog);

  return 0;
  
}
Beispiel #6
0
void QTabWidgetProto::setUsesScrollButtons(bool useButtons)
{
  QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
  if (item)
    item->setUsesScrollButtons(useButtons);
}
ExtendedAboutDialog::ExtendedAboutDialog(const KAboutData *aboutData, const OcsData *ocsData, QWidget *parent)
  : KDialog(parent)
  , d(new Private(this))
{
    DEBUG_BLOCK
    if (aboutData == 0)
        aboutData = KGlobal::mainComponent().aboutData();

    d->aboutData = aboutData;

    if (!aboutData) {
        QLabel *errorLabel = new QLabel(i18n("<qt>No information available.<br />"
                                             "The supplied KAboutData object does not exist.</qt>"), this);

        errorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
        setMainWidget(errorLabel);
        return;
    }
    if( !ocsData )
    {
        QLabel *errorLabel = new QLabel(i18n("<qt>No information available.<br />"
                                             "The supplied OcsData object does not exist.</qt>"), this);

        errorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
        setMainWidget(errorLabel);
        return;
    }
    m_ocsData = *ocsData;

    setPlainCaption(i18n("About %1", aboutData->programName()));
    setButtons(KDialog::Close);
    setDefaultButton(KDialog::Close);
    setModal(false);


    //Set up the title widget...
    KTitleWidget *titleWidget = new KTitleWidget(this);

    QIcon windowIcon;
    if (!aboutData->programIconName().isEmpty()) {
        windowIcon = KIcon(aboutData->programIconName());
    } else {
        windowIcon = qApp->windowIcon();
    }
    titleWidget->setPixmap(windowIcon.pixmap(64, 64), KTitleWidget::ImageLeft);
    if (aboutData->programLogo().canConvert<QPixmap>())
        titleWidget->setPixmap(aboutData->programLogo().value<QPixmap>(), KTitleWidget::ImageLeft);
    else if (aboutData->programLogo().canConvert<QImage>())
        titleWidget->setPixmap(QPixmap::fromImage(aboutData->programLogo().value<QImage>()), KTitleWidget::ImageLeft);

    titleWidget->setText(i18n("<html><font size=\"5\">%1</font><br /><b>Version %2</b><br />Using KDE %3</html>",
                         aboutData->programName(), aboutData->version(), KDE::versionString()));


    //Now let's add the tab bar...
    QTabWidget *tabWidget = new QTabWidget;
    tabWidget->setUsesScrollButtons(false);


    //Set up the first page...
    QString aboutPageText = aboutData->shortDescription() + '\n';

    if (!aboutData->otherText().isEmpty())
        aboutPageText += '\n' + aboutData->otherText() + '\n';

    if (!aboutData->copyrightStatement().isEmpty())
        aboutPageText += '\n' + aboutData->copyrightStatement() + '\n';

    if (!aboutData->homepage().isEmpty())
        aboutPageText += '\n' + QString("<a href=\"%1\">%1</a>").arg(aboutData->homepage()) + '\n';
    aboutPageText = aboutPageText.trimmed();

    QLabel *aboutLabel = new QLabel;
    aboutLabel->setWordWrap(true);
    aboutLabel->setOpenExternalLinks(true);
    aboutLabel->setText(aboutPageText.replace('\n', "<br />"));
    aboutLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);

    QVBoxLayout *aboutLayout = new QVBoxLayout;
    aboutLayout->addStretch();
    aboutLayout->addWidget(aboutLabel);

    const int licenseCount = aboutData->licenses().count();
    debug()<< "About to show license stuff";
    debug()<< "License count is"<<licenseCount;
    for (int i = 0; i < licenseCount; ++i) {
        const KAboutLicense &license = aboutData->licenses().at(i);

        QLabel *showLicenseLabel = new QLabel;
        showLicenseLabel->setText(QString("<a href=\"%1\">%2</a>").arg(QString::number(i),
                                                                       i18n("License: %1",
                                                                            license.name(KAboutData::FullName))));
        showLicenseLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
        connect(showLicenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(_k_showLicense(QString)));

        aboutLayout->addWidget(showLicenseLabel);
    }
    debug()<<"License widget added";

    aboutLayout->addStretch();

    QWidget *aboutWidget = new QWidget(this);
    aboutWidget->setLayout(aboutLayout);

    tabWidget->addTab(aboutWidget, i18n("&About"));


    //Stuff needed by both Authors and Credits pages:
    QPixmap openDesktopPixmap = QPixmap( KStandardDirs::locate( "data", "amarok/images/opendesktop-22.png" ) );
    QIcon openDesktopIcon = QIcon( openDesktopPixmap );


    //And now, the Authors page:
    const int authorCount = d->aboutData->authors().count();

    if (authorCount)
    {
        m_authorWidget = new QWidget( this );
        QVBoxLayout *authorLayout = new QVBoxLayout( m_authorWidget.data() );

        m_showOcsAuthorButton = new AnimatedBarWidget( openDesktopIcon,
                                     i18n( "Get data from openDesktop.org to learn more about the team" ),
                                     "process-working", m_authorWidget.data() );
        connect( m_showOcsAuthorButton.data(), SIGNAL(clicked()), this, SLOT(switchToOcsWidgets()) );
        authorLayout->addWidget( m_showOcsAuthorButton.data() );

        if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty())
        {
            QLabel *bugsLabel = new QLabel( m_authorWidget.data() );
            bugsLabel->setContentsMargins( 4, 2, 0, 4 );
            if (!aboutData->customAuthorTextEnabled())
            {
                if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "*****@*****.**")
                    bugsLabel->setText( i18n("Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs.\n") );
                else
                {
                    if(aboutData->authors().count() == 1 && (aboutData->authors().first().emailAddress() == aboutData->bugAddress()))
                    {
                        bugsLabel->setText( i18n("Please report bugs to <a href=\"mailto:%1\">%2</a>.\n",
                                              aboutData->authors().first().emailAddress(),
                                              aboutData->authors().first().emailAddress()));
                    }
                    else
                    {
                        bugsLabel->setText( i18n("Please report bugs to <a href=\"mailto:%1\">%2</a>.\n",
                                              aboutData->bugAddress(), aboutData->bugAddress()));
                    }
                }
            }
            else
                bugsLabel->setText( aboutData->customAuthorRichText() );
            authorLayout->addWidget( bugsLabel );
        }

        m_authorListWidget = new OcsPersonListWidget( d->aboutData->authors(), m_ocsData.authors(), OcsPersonItem::Author, m_authorWidget.data() );
        connect( m_authorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsAuthorButton.data(), SLOT(stop()) );
        connect( m_authorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsAuthorButton.data(), SLOT(fold()) );

        authorLayout->addWidget( m_authorListWidget.data() );
        authorLayout->setMargin( 0 );
        authorLayout->setSpacing( 2 );
        m_authorWidget.data()->setLayout( authorLayout );

        m_authorPageTitle = ( authorCount == 1 ) ? i18n("A&uthor") : i18n("A&uthors");
        tabWidget->addTab(m_authorWidget.data(), m_authorPageTitle);
        m_isOfflineAuthorWidget = true; //is this still used?
    }

    //Then the Credits page:
    const int creditCount = aboutData->credits().count();

    if (creditCount)
    {
        m_creditWidget = new QWidget( this );
        QVBoxLayout *creditLayout = new QVBoxLayout( m_creditWidget.data() );

        m_showOcsCreditButton = new AnimatedBarWidget( openDesktopIcon,
                                     i18n( "Get data from openDesktop.org to learn more about contributors" ),
                                     "process-working", m_creditWidget.data() );
        connect( m_showOcsCreditButton.data(), SIGNAL(clicked()), this, SLOT(switchToOcsWidgets()) );
        creditLayout->addWidget( m_showOcsCreditButton.data() );

        m_creditListWidget = new OcsPersonListWidget( d->aboutData->credits(), m_ocsData.credits(), OcsPersonItem::Contributor, m_creditWidget.data() );
        connect( m_creditListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsCreditButton.data(), SLOT(stop()) );
        connect( m_creditListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsCreditButton.data(), SLOT(fold()) );

        creditLayout->addWidget( m_creditListWidget.data() );
        creditLayout->setMargin( 0 );
        creditLayout->setSpacing( 2 );
        m_creditWidget.data()->setLayout( creditLayout );

        tabWidget->addTab( m_creditWidget.data(), i18n("&Contributors"));
        m_isOfflineCreditWidget = true; //is this still used?
    }

    //Finally, the Donors page:
    const int donorCount = ocsData->donors()->count();

    if (donorCount)
    {
        m_donorWidget = new QWidget( this );
        QVBoxLayout *donorLayout = new QVBoxLayout( m_donorWidget.data() );

        m_showOcsDonorButton = new AnimatedBarWidget( openDesktopIcon,
                                     i18n( "Get data from openDesktop.org to learn more about our generous donors" ),
                                     "process-working", m_donorWidget.data() );
        connect( m_showOcsDonorButton.data(), SIGNAL(clicked()), this, SLOT(switchToOcsWidgets()) );
        donorLayout->addWidget( m_showOcsDonorButton.data() );

        QList< KAboutPerson > donors;
        for( QList< QPair< QString, KAboutPerson > >::const_iterator it = m_ocsData.donors()->constBegin();
             it != m_ocsData.donors()->constEnd(); ++it )
        {
            donors << ( *it ).second;
        }
        m_donorListWidget = new OcsPersonListWidget( donors , m_ocsData.donors(), OcsPersonItem::Contributor, m_donorWidget.data() );
        connect( m_donorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsDonorButton.data(), SLOT(stop()) );
        connect( m_donorListWidget.data(), SIGNAL(switchedToOcs()), m_showOcsDonorButton.data(), SLOT(fold()) );

        donorLayout->addWidget( m_donorListWidget.data() );
        donorLayout->setMargin( 0 );
        donorLayout->setSpacing( 2 );
        QLabel *roktoberLabel =
            new QLabel(i18n("<p>Each year in October the Amarok team organizes a funding "
                            "drive called <b>Roktober</b>.</p>"
                            "<p>If you want your name mentioned on this list "
                            "<a href=\"http://amarok.kde.org/donations\"> donate "
                            "during Roktober</a> and opt-in.</p>"));
        roktoberLabel->setOpenExternalLinks(true);
        donorLayout->addWidget(roktoberLabel);
        m_donorWidget.data()->setLayout( donorLayout );

        tabWidget->addTab( m_donorWidget.data(), i18n("&Donors"));
        m_isOfflineDonorWidget = true;
    }


    //And the translators:
    QPalette transparentBackgroundPalette;
    transparentBackgroundPalette.setColor( QPalette::Base, Qt::transparent );
    transparentBackgroundPalette.setColor( QPalette::Text, transparentBackgroundPalette.color( QPalette::WindowText ) );


    const QList<KAboutPerson> translatorList = aboutData->translators();

    if(translatorList.count() > 0) {
        QString translatorPageText;

        QList<KAboutPerson>::ConstIterator it;
        for(it = translatorList.begin(); it != translatorList.end(); ++it) {
            translatorPageText += QString("<p style=\"margin: 0px;\">%1</p>").arg((*it).name());
            if (!(*it).emailAddress().isEmpty())
                translatorPageText += QString("<p style=\"margin: 0px; margin-left: 15px;\"><a href=\"mailto:%1\">%1</a></p>").arg((*it).emailAddress());
            translatorPageText += "<p style=\"margin: 0px;\">&nbsp;</p>";
        }

        translatorPageText += KAboutData::aboutTranslationTeam();

        KTextBrowser *translatorTextBrowser = new KTextBrowser;
        translatorTextBrowser->setFrameStyle(QFrame::NoFrame);
        translatorTextBrowser->setPalette(transparentBackgroundPalette);
        translatorTextBrowser->setHtml(translatorPageText);
        tabWidget->addTab(translatorTextBrowser, i18n("T&ranslation"));
    }

    //Jam everything together in a layout:
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(titleWidget);
    mainLayout->addWidget(tabWidget);
    mainLayout->setMargin(0);

    QWidget *mainWidget = new QWidget;
    mainWidget->setLayout(mainLayout);
    setMainWidget(mainWidget);
    setInitialSize( QSize( 480, 460 ) );
}
Beispiel #8
0
int TabWidget::setUsesScrollButtons ( lua_State * L ) //( bool useButtons )void
 {
 	QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
	obj->setUsesScrollButtons( Util::toBool( L, 2 ) );
	return 0;
 }