Exemple #1
0
int main(int argc, char* argv[])
{
  QApplication qtapplication( argc, argv );

  if(argc<2)
  {
    fprintf( stderr, "Usage:   %s [filename1] [filename2] ...\n\n", itksys::SystemTools::GetFilenameName(argv[0]).c_str() );
    return 1;
  }

  // Register Qmitk-dependent global instances
  QmitkRegisterClasses();

  Step6 mainWidget(argc, argv, nullptr);
  mainWidget.Initialize();
  mainWidget.show();

  // for testing
  #include "QtTesting.h"
  if(strcmp(argv[argc-1], "-testing")!=0)
    return qtapplication.exec();
  else
    return QtTesting();

}
// private
void kpTransformPreviewDialog::createDimensionsGroupBox ()
{
    m_dimensionsGroupBox = new QGroupBox (i18n ("Dimensions"), mainWidget ());

    QLabel *originalLabel = new QLabel (i18n ("Original:"), m_dimensionsGroupBox);
    QString originalDimensions;
    if (document ())
    {
         originalDimensions = i18n ("%1 x %2",
                                    m_oldWidth,
                                    m_oldHeight);

         // Stop the Dimensions Group Box from resizing so often
         const QString minimumLengthString ("100000 x 100000");
         const int padLength = minimumLengthString.length ();
         for (int i = originalDimensions.length (); i < padLength; i++)
             originalDimensions += ' ';
    }
    QLabel *originalDimensionsLabel = new QLabel (originalDimensions, m_dimensionsGroupBox);

    QLabel *afterTransformLabel = new QLabel (m_afterActionText, m_dimensionsGroupBox);
    m_afterTransformDimensionsLabel = new QLabel (m_dimensionsGroupBox);


    QGridLayout *dimensionsLayout = new QGridLayout (m_dimensionsGroupBox );
    dimensionsLayout->addWidget (originalLabel, 0, 0, Qt::AlignBottom);
    dimensionsLayout->addWidget (originalDimensionsLabel, 0, 1, Qt::AlignBottom);
    dimensionsLayout->addWidget (afterTransformLabel, 1, 0, Qt::AlignTop);
    dimensionsLayout->addWidget (m_afterTransformDimensionsLabel, 1, 1, Qt::AlignTop);
}
Exemple #3
0
  /*!
   * \author Anders Fernström and Ingemar Axelsson
   * \date 2005-10-28 (update)
   *
   * \brief Creates the QTextEdit for the output part of the
   * inputcell
   *
   * Large part of this function was changes due to porting
   * to QT4 (changes from Q3TextEdit to QTextEdit).
   */
  void InputCell::createOutputCell()
  {
    output_ = new MyTextEdit( mainWidget() );
    layout_->addWidget( output_, 2, 1 );

    output_->setReadOnly( true );
    //output_->setFrameShape( QFrame::Panel );
    output_->setFrameShape( QFrame::Box );
    output_->setAutoFormatting( QTextEdit::AutoNone );

    output_->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    output_->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
//    output_->setContextMenuPolicy( Qt::NoContextMenu );

    connect( output_, SIGNAL( textChanged() ),
      this, SLOT(contentChanged()));
    connect( output_, SIGNAL( clickOnCell() ),
      this, SLOT( clickEventOutput() ));
    connect( output_, SIGNAL( wheelMove(QWheelEvent*) ),
      this, SLOT( wheelEvent(QWheelEvent*) ));

    connect(output_, SIGNAL(forwardAction(int)), this, SIGNAL(forwardAction(int)));

    setOutputStyle();


    output_->hide();
  }
Exemple #4
0
  /*!
   * \author Ingemar Axelsson and Anders Fernström
   * \date 2005-11-23 (update)
   *
   * \brief The class constructor
   *
   * 2005-10-27 AF, updated the method due to porting from Q3Support
   * to pure QT4 classes.
   * 2005-11-23 AF, added document to the constructor, because need
   * the document to insert images to the output part if ploting.
   */
  InputCell::InputCell(Document *doc, QWidget *parent)
    : Cell(parent),
    evaluated_(false),
    closed_(true),
    delegate_(0),
    oldHeight_( 0 ),
    document_(doc)
  {
    QWidget *main = new QWidget(this);
    setMainWidget(main);

    layout_ = new QGridLayout(mainWidget());
    layout_->setMargin(0);
    layout_->setSpacing(0);

    setTreeWidget(new InputTreeView(this));

    //2005-10-07 AF, Porting, change from 'QWidget::' to 'Qt::'
    setFocusPolicy(Qt::NoFocus);

    createInputCell();
    createOutputCell();

    //setBackgroundColor(QColor(200,200,255));
  }
IsotopeTableDialog::IsotopeTableDialog(QWidget* parent) : KDialog(parent)
{
    setCaption(i18n("Isotope Table"));
    setButtons(Close);
    setDefaultButton(Close);
    ui.setupUi(mainWidget());
    ui.guide->setGuidedView(ui.gv);

    connect(ui.gv->scene(), SIGNAL(itemSelected(IsotopeItem*)),
            this, SLOT(updateDockWidget(IsotopeItem*)));
    connect(ui.gv, SIGNAL(zoomLevelChanged(double)),
            this, SLOT(slotZoomLevelChanged(double)));
    connect(ui.Slider, SIGNAL(valueChanged(int)),
            this, SLOT(zoom(int)));

    //Here comes the legend part
    QList< QPair<QString, QColor> > items;

    items << qMakePair(i18nc("alpha ray emission", "alpha"), QColor(Qt::red));
    items << qMakePair(i18nc("Electron capture method", "EC"), QColor(Qt::blue));
    items << qMakePair(i18nc("Many ways", "Multiple"), QColor(Qt::green));
    items << qMakePair(i18nc("Beta plus ray emission", "Beta +"), QColor(Qt::yellow));
    items << qMakePair(i18nc("Beta minus ray emission", "Beta -"), QColor(Qt::white));
    items << qMakePair(i18nc("Stable isotope", "Stable"), QColor(Qt::lightGray));
    items << qMakePair(i18nc("Default colour", "default"), QColor(Qt::darkGray));

    foreach (const legendPair &pair, items) {
        LegendItem *item = new LegendItem(pair);
        ui.infoWidget->layout()->addWidget(item);
    }
KWInsertPageDialog::KWInsertPageDialog(KWDocument *document, KWView *parent)
    : KDialog(parent),
    m_document(document),
    m_currentPageNumber(parent->currentPage().pageNumber())
{
    m_widget.setupUi(mainWidget());
    setCaption(i18n("Insert Page"));
    setButtons(KDialog::Ok | KDialog::Cancel);
    setModal(true);
    m_widget.afterCurrent->setChecked(true);
    if (m_currentPageNumber < 1) {
        m_widget.beforeCurrent->setEnabled(false);
        m_widget.afterCurrent->setEnabled(false);
        m_widget.afterLast->setChecked(true);
    } else if (parent->currentPage() == m_document->pageManager()->begin()) {
        m_widget.beforeCurrent->setEnabled(false);
    }
    QHash<QString, KWPageStyle> styles = m_document->pageManager()->pageStyles();
    foreach (const QString &style, styles.keys()) {
        m_widget.pageStyle->addItem(style);
    }
    // TODO can we select the page style a bit smarter?

    connect(this, SIGNAL(okClicked()), this, SLOT(doIt()));
}
Exemple #7
0
K3bVideoDVDRippingDialog::K3bVideoDVDRippingDialog( const K3bVideoDVD::VideoDVD& dvd,
						    const QValueList<int>& titles,
						    QWidget* parent, const char* name )
  : K3bInteractionDialog( parent, name,
			  i18n("Video DVD Ripping"),
			  QString::null,
			  START_BUTTON|CANCEL_BUTTON,
			  START_BUTTON,
			  "VideoDVD Ripping" ), // config group
    m_dvd( dvd )
{
  d = new Private;

  QWidget* frame = mainWidget();
  QHBoxLayout* frameLayout = new QHBoxLayout( frame );
  frameLayout->setMargin( 0 );
  frameLayout->setAutoAdd( true );
  m_w = new K3bVideoDVDRippingWidget( frame );

  connect( m_w, SIGNAL(changed()),
	   this, SLOT(slotUpdateFilesizes()) );
  connect( m_w, SIGNAL(changed()),
	   this, SLOT(slotUpdateFilenames()) );
  connect( m_w, SIGNAL(changed()),
	   this, SLOT(slotUpdateVideoSizes()) );

  setTitle( i18n("Video DVD Ripping"),
	    i18n("1 title from %1", "%n titles from %1", titles.count())
	    .arg( k3bappcore->mediaCache()->medium(m_dvd.device()).beautifiedVolumeId() ) );

  // populate list map
  populateTitleView( titles );
}
Exemple #8
0
    PropertiesDlg::PropertiesDlg(bt::TorrentInterface* tc, QWidget* parent)
        : KDialog(parent),
          tc(tc)
    {
        setupUi(mainWidget());
        setWindowTitle(i18n("Torrent Settings"));

        QString folder = tc->getMoveWhenCompletedDir();
        if (QFile::exists(folder))
        {
            move_on_completion_enabled->setChecked(true);
            move_on_completion_url->setUrl(QUrl::fromLocalFile(folder));
            move_on_completion_url->setEnabled(true);
        }
        else
        {
            move_on_completion_enabled->setChecked(false);
            move_on_completion_url->setEnabled(false);
        }

        // disable DHT and PEX if they are globally disabled
        const bt::TorrentStats& s = tc->getStats();
        dht->setEnabled(!s.priv_torrent);
        pex->setEnabled(!s.priv_torrent);
        dht->setChecked(!s.priv_torrent && tc->isFeatureEnabled(bt::DHT_FEATURE));
        pex->setChecked(!s.priv_torrent && tc->isFeatureEnabled(bt::UT_PEX_FEATURE));

        superseeding->setChecked(s.superseeding);
        connect(move_on_completion_enabled, &QCheckBox::toggled, this, &PropertiesDlg::moveOnCompletionEnabled);
    }
Exemple #9
0
RawCameraDlg::RawCameraDlg(QWidget* const parent)
    : InfoDlg(parent),
      d(new Private)
{
    setWindowTitle(i18n("List of supported RAW cameras"));

    QStringList list = RawEngine::DRawDecoder::supportedCamera();

    // --------------------------------------------------------

    d->header    = new QLabel(this);
    d->searchBar = new SearchTextBar(this, QLatin1String("RawCameraDlgSearchBar"));
    updateHeader();

    listView()->setColumnCount(1);
    listView()->setHeaderLabels(QStringList() << QLatin1String("Camera Model")); // Header is hidden. No i18n here.
    listView()->header()->hide();

    for (QStringList::const_iterator it = list.constBegin() ; it != list.constEnd() ; ++it)
    {
        new QTreeWidgetItem(listView(), QStringList() << *it);
    }

    // --------------------------------------------------------

    QGridLayout* const  grid = dynamic_cast<QGridLayout*>(mainWidget()->layout());
    grid->addWidget(d->header,    1, 0, 1, -1);
    grid->addWidget(d->searchBar, 3, 0, 1, -1);

    // --------------------------------------------------------

    connect(d->searchBar, SIGNAL(signalSearchTextSettings(SearchTextSettings)),
            this, SLOT(slotSearchTextChanged(SearchTextSettings)));
}
Exemple #10
0
    PropertiesDlg::PropertiesDlg(bt::TorrentInterface* tc, QWidget* parent)
        : KDialog(parent),
          tc(tc)
    {
        setupUi(mainWidget());
        setWindowTitle(i18n("Torrent Settings"));

        KUrl url = tc->getMoveWhenCompletedDir();
        if (url.isValid())
        {
            move_on_completion_enabled->setChecked(true);
            move_on_completion_url->setUrl(url);
            move_on_completion_url->setEnabled(true);
        }
        else
        {
            move_on_completion_enabled->setChecked(false);
            move_on_completion_url->setEnabled(false);
        }

        // disable DHT and PEX if they are globally disabled
        const bt::TorrentStats& s = tc->getStats();
        dht->setEnabled(!s.priv_torrent);
        pex->setEnabled(!s.priv_torrent);
        dht->setChecked(!s.priv_torrent && tc->isFeatureEnabled(bt::DHT_FEATURE));
        pex->setChecked(!s.priv_torrent && tc->isFeatureEnabled(bt::UT_PEX_FEATURE));

        superseeding->setChecked(s.superseeding);
        connect(move_on_completion_enabled, SIGNAL(toggled(bool)), this, SLOT(moveOnCompletionEnabled(bool)));
    }
Exemple #11
0
ExportDialog::ExportDialog(QWidget * parent)
        : KDialog(parent),m_outputStream(0)
{
    kDebug() << "ExportDialog::ExportDialog";
    setButtons(Help | User1 | Cancel);
    kDebug() << "ExportDialog: setButtons";
    ui.setupUi(mainWidget());
    kDebug() << "ExportDialog: ui.setupUi(mainWidget());";
    setButtonGuiItem(User1, KGuiItem(i18n("OK")));
    kDebug() << "ExportDialog: setButtonGuiItem(User1, KGuiItem(i18n(\"OK\")));";
    ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    setCaption(i18n("Export Chemical Data"));
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    populateElementList();
    kDebug() << "ui.targetFile->setMode(KFile::File | KFile::Directory | KFile::LocalOnly);";

    ui.formatList->addItem(".html (formatted html document)", "html");
    ui.formatList->addItem(".xml (raw element data)", "xml");
    ui.formatList->addItem(".csv (comma-separated data)", "csv");
    kDebug() << "ui.formatList->addItem(...);";

    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotOkClicked()));
    kDebug() << "connect(this, SIGNAL(user1Clicked()), this, SLOT(slotOkClicked()));";
    setHelp(QString(),"kalzium");
    kDebug() << "setHelp(QString(),\"kalzium\");";
}
Exemple #12
0
void KraftView::setupDocHeaderView()
{
    KraftDocHeaderEdit *edit = new KraftDocHeaderEdit( mainWidget() );

    mHeaderId = mViewStack->addWidget( edit ); // , KraftDoc::Header );

    m_headerEdit = edit->docHeaderEdit();

    m_headerEdit->m_cbType->clear();
    // m_headerEdit->m_cbType->insertStringList( DefaultProvider::self()->docTypes() );
    m_headerEdit->m_cbType->insertItems(-1, DocType::allLocalised() );

    if ( KraftSettings::self()->showDocumentLocale() ) {
      m_headerEdit->mButtLang->show();
    } else {
      m_headerEdit->mButtLang->hide();
    }

    connect( m_headerEdit->m_cbType,  SIGNAL( activated( const QString& ) ),
             this, SLOT( slotDocTypeChanged( const QString& ) ) );

    connect( m_headerEdit->mButtLang, SIGNAL( clicked() ),
             this, SLOT( slotLanguageSettings() ) );
    connect( edit, SIGNAL( modified() ),
              this, SLOT( slotModifiedHeader() ) );
    connect( edit, SIGNAL(pickAddressee()), this, SLOT(slotPickAddressee()) );
}
Exemple #13
0
void OSAppBase::updateMyMeasures()
{
  std::shared_ptr<OSDocument> document = currentDocument();

  if (document)
  {
    boost::optional<analysisdriver::SimpleProject> project = document->project();
    if (project)
    {
      mainWidget()->setEnabled(false);
      measureManager().updateMyMeasures(*project);
      mainWidget()->setEnabled(true);
    } else {
      LOG(Error, "Unable to update measures, there is no project set...");
    }
  } 
}
KexiNameDialog::KexiNameDialog(const QString& message, QWidget * parent)
        : KDialog(parent)
        , d(new Private)
{
    setMainWidget(new QWidget(this));
    d->widget = new KexiNameWidget(message, mainWidget());
    init();
}
K3bExternalEncoderEditDialog::K3bExternalEncoderEditDialog( QWidget* parent )
    : KDialog( parent )
{
    setModal( true );
    setCaption( i18n("Editing external audio encoder") );
    setButtons( Ok | Cancel );
    setupUi( mainWidget() );
}
Exemple #16
0
void InterfacePlotterDialog::resizeEvent( QResizeEvent* )
{
    bool showLabels = true;;

    if( mainWidget()->height() <= mLabelsWidget->sizeHint().height() + mPlotter->minimumHeight() )
        showLabels = false;
    mLabelsWidget->setVisible(showLabels);
}
Exemple #17
0
void ListView::moveIssue()
{
    if ( isEnabled() && m_isAdmin ) {
        MoveIssueDialog dialog( m_selectedIssueId, mainWidget() );
        dialog.setUpdateFolder( true );
        dialog.exec();
    }
}
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    shareFrameData threadShareData(640, 480);
    NetWorkHandle netWorkThread;
    MainWindow w;
    QWidget mainWidget(&w);
    QHBoxLayout mainLayout;
    QVBoxLayout leftLayout;
    QVBoxLayout rightLayout;
    QHBoxLayout controlLayout;
    QVBoxLayout statuLayout;

    MyVideoView videoView(&w);
    MyButton flyControl(&w);
    MyButton otherSet(&w);
    MyButton balanceStatu(&w);
    MyButton paramStatu(&w);
    w.setMinimumSize(QSize(800, 480));

    flyControl.setText(QString("flycontrol"));
    otherSet.setText(QString("otherset"));
    balanceStatu.setText(QString("balance param"));
    paramStatu.setText(QString("net & other statu"));
    //w.setCentralWidget(&button);

    leftLayout.addWidget(&videoView);
    leftLayout.setStretch(0, 7);
    controlLayout.addWidget(&flyControl);
    controlLayout.addWidget(&otherSet);
    leftLayout.addLayout(&controlLayout);
    leftLayout.setStretch(1, 3);

    mainLayout.addLayout(&leftLayout);
    mainLayout.setStretch(0, 7);

    rightLayout.addWidget(&balanceStatu);
    rightLayout.addWidget(&paramStatu);
    //mainLayout.setStretchFactor(&leftLayout, 5);
    //mainLayout.setStretchFactor(&rightLayout, 15);
    mainLayout.addLayout(&rightLayout);
    mainLayout.setStretch(1, 3);

    mainWidget.setLayout(&mainLayout);

    w.setCentralWidget(&mainWidget);

    QObject::connect(&netWorkThread, SIGNAL(recvData()), &videoView, SLOT(flushScreen()));
    netWorkThread.setShareBuff(&threadShareData);
    videoView.setShareBuff(&threadShareData);
    //start net work thread
    netWorkThread.start();


    w.show();

    return a.exec();
}
Exemple #19
0
    ShutdownDlg::ShutdownDlg(ShutdownRuleSet* rules, CoreInterface* core, QWidget* parent) : KDialog(parent), rules(rules)
    {
        setupUi(mainWidget());
        setWindowTitle(i18nc("@title:window", "Configure Shutdown"));
        model = new ShutdownTorrentModel(core, this);

        m_action->addItem(KIcon("system-shutdown"), i18n("Shutdown"));
        m_action->addItem(KIcon("system-lock-screen"), i18n("Lock"));
#if KDE_IS_VERSION(4,5,82)
        QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates();
        if (spdMethods.contains(Solid::PowerManagement::StandbyState))
            m_action->addItem(KIcon("system-suspend"), i18n("Standby"));

        if (spdMethods.contains(Solid::PowerManagement::SuspendState))
            m_action->addItem(KIcon("system-suspend"), i18n("Sleep (suspend to RAM)"));

        if (spdMethods.contains(Solid::PowerManagement::HibernateState))
            m_action->addItem(KIcon("system-suspend-hibernate"), i18n("Hibernate (suspend to disk)"));
#else
        Solid::Control::PowerManager::SuspendMethods spdMethods = Solid::Control::PowerManager::supportedSuspendMethods();
        if (spdMethods & Solid::Control::PowerManager::Standby)
            m_action->addItem(KIcon("system-suspend"), i18n("Standby"));

        if (spdMethods & Solid::Control::PowerManager::ToRam)
            m_action->addItem(KIcon("system-suspend"), i18n("Sleep (suspend to RAM)"));

        if (spdMethods & Solid::Control::PowerManager::ToDisk)
            m_action->addItem(KIcon("system-suspend-hibernate"), i18n("Hibernate (suspend to disk)"));
#endif
        m_time_to_execute->addItem(i18n("When all torrents finish downloading"));
        m_time_to_execute->addItem(i18n("When all torrents finish seeding"));
        m_time_to_execute->addItem(i18n("When the events below happen"));
        m_all_rules_must_be_hit->setChecked(rules->allRulesMustBeHit());

        connect(m_time_to_execute, SIGNAL(currentIndexChanged(int)), this, SLOT(timeToExecuteChanged(int)));
        m_torrent_list->setEnabled(false);
        m_torrent_list->setModel(model);
        m_torrent_list->setRootIsDecorated(false);
        m_torrent_list->setItemDelegateForColumn(1, new ShutdownTorrentDelegate(this));

        for (int i = 0; i < rules->count(); i++)
        {
            const ShutdownRule& r = rules->rule(i);
            if (r.target == ALL_TORRENTS)
            {
                m_action->setCurrentIndex(actionToIndex(r.action));
                m_time_to_execute->setCurrentIndex(r.trigger == DOWNLOADING_COMPLETED ? 0 : 1);
            }
            else
            {
                m_action->setCurrentIndex(actionToIndex(r.action));
                m_time_to_execute->setCurrentIndex(2);
                model->addRule(r);
            }
        }

        m_all_rules_must_be_hit->setEnabled(m_time_to_execute->currentIndex() == 2);
    }
Exemple #20
0
void ListView::cloneView()
{
    CloneViewDialog dialog( m_currentViewId, false, mainWidget() );
    if ( dialog.exec() == QDialog::Accepted ) {
        m_currentViewId = dialog.viewId();
        updateViews();
        loadCurrentView( true );
    }
}
Exemple #21
0
int KSVApplication::newInstance ()
{
  QWidget* main = mainWidget();

  if (main)
    KWin::activateWindow (main->winId());

  return getpid();
}
void QLayout::freeze( int w, int h )
{
    if ( w <= 0 || h <= 0 ) {
	setResizeMode( Fixed );
    } else {
	setResizeMode( FreeResize ); // layout will not change min/max size
	mainWidget()->setFixedSize( w, h );
    }
}
bool GraphicalUi::eventFilter(QObject *obj, QEvent *event)
{
#ifdef Q_OS_WIN
    if (obj == mainWidget() && event->type() == QEvent::ActivationChange) {
        _dwTickCount = GetTickCount();
    }
#endif
    return AbstractUi::eventFilter(obj, event);
}
K3b::DeviceSelectionDialog::DeviceSelectionDialog( QWidget* parent,
						    const QString& text )
    : KDialog( parent ),
      d( new Private() )
{
    setCaption( i18n("Device Selection") );
    setButtons( Ok|Cancel );
    setDefaultButton( Ok );

    QGridLayout* lay = new QGridLayout( mainWidget() );

    QLabel* label = new QLabel( text.isEmpty() ? i18n("Please select a device:") : text, mainWidget() );
    d->comboDevices = new K3b::DeviceComboBox( mainWidget() );

    lay->addWidget( label, 0, 0 );
    lay->addWidget( d->comboDevices, 1, 0 );
    lay->setRowStretch( 2, 1 );
}
Exemple #25
0
void KraftView::setupFooter()
{
  m_footerEdit = new KraftDocFooterEdit( mainWidget() );

  mViewStack->addWidget( m_footerEdit ); //  KraftDoc::Footer );

  // ATTENTION: If you change the following inserts, make sure to check the code
  //            in method currentPositionList!
  m_footerEdit->ui()->mTaxCombo->insertItem( NO_TAX,   KIcon("kraft_notax"), i18n( "Display no tax at all" ));
  m_footerEdit->ui()->mTaxCombo->insertItem( RED_TAX,  KIcon("kraft_redtax"), i18n( "Calculate reduced tax for all items" ));
  m_footerEdit->ui()->mTaxCombo->insertItem( FULL_TAX, KIcon("kraft_fulltax"), i18n( "Calculate full tax for all items" ));
  m_footerEdit->ui()->mTaxCombo->insertItem( INDI_TAX, i18n( "Calculate individual tax for each item"));

  // set the tax type combo correctly: If all items have the same tax type, take it.
  // If items have different, its the individual thing.
  DocPositionList list = m_doc->positions();

  int tt = -1;
  DocPositionBase *dp = 0;

  DocPositionListIterator it( list );
  int taxIndex = 0;

  while( it.hasNext()) {
    dp = it.next();
    if ( tt == -1 )
      tt = dp->taxTypeNumeric(); // store the first entry.
    else {
      if ( tt != dp->taxTypeNumeric() ) {
        taxIndex = INDI_TAX;
      } else {
        // old and new taxtype are the same.
      }
    }
  }
  if ( tt == -1 ) {
    // means that there is no item yet, the default tax type needs to be used.
    int deflt = KraftSettings::self()->defaultTaxType();
    if ( deflt > 0 ) {
      deflt -= 1;
    }
    taxIndex = deflt;
  } else {
    if ( taxIndex == 0 ) {
      taxIndex = tt-1;
    }
  }

  connect( m_footerEdit->ui()->mTaxCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(slotTaxComboChanged(int)));

  m_footerEdit->ui()->mTaxCombo->setCurrentIndex( taxIndex );
  slotTaxComboChanged( taxIndex );

  mTaxBefore = taxIndex;

  connect(m_footerEdit,SIGNAL(modified()),this,SLOT(slotModifiedFooter()));
}
Exemple #26
0
  /*!
   * \author Anders Fernström and Ingemar Axelsson
   * \date 2006-03-02 (update)
   *
   * \brief Creates the QTextEdit for the input part of the
   * inputcell
   *
   * 2005-10-27 AF, Large part of this function was changes due to
   * porting to QT4 (changes from Q3TextEdit to QTextEdit).
   * 2005-12-15 AF, Added more connections to the editor, mostly for
   * commandcompletion, but also for eval. invoking eval have moved
   * from the eventfilter on this cell to the reimplemented key event
   * handler in the editor
   * 2006-03-02 AF, Added call to createChapterCounter();
   */
  void InputCell::createInputCell()
  {
    input_ = new MyTextEdit( mainWidget() );
    mpModelicaTextHighlighter = new ModelicaTextHighlighter(input_->document());
    layout_->addWidget( input_, 1, 1 );

    // 2006-03-02 AF, Add a chapter counter
    createChapterCounter();

    //input_->setReadOnly( false );
    input_->setReadOnly( true );
    input_->setUndoRedoEnabled( true );
    //input_->setFrameStyle( QFrame::NoFrame );
    input_->setFrameShape( QFrame::Box );
    input_->setAutoFormatting( QTextEdit::AutoNone );

    input_->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    input_->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
//    input_->setContextMenuPolicy( Qt::NoContextMenu );

    QPalette palette;
    palette.setColor(input_->backgroundRole(), QColor(200,200,255));
    input_->setPalette(palette);

    // is this needed, don't know /AF
    input_->installEventFilter(this);


    connect( input_, SIGNAL( textChanged() ),
      this, SLOT( contentChanged() ));

      connect( input_, SIGNAL( clickOnCell() ),
      this, SLOT( clickEvent() ));
    connect( input_, SIGNAL( wheelMove(QWheelEvent*) ),
      this, SLOT( wheelEvent(QWheelEvent*) ));
    // 2005-12-15 AF, new connections
    connect( input_, SIGNAL( eval() ),
      this, SLOT( eval() ));
    connect( input_, SIGNAL( command() ),
      this, SLOT( command() ));
    connect( input_, SIGNAL( nextCommand() ),
      this, SLOT( nextCommand() ));
    connect( input_, SIGNAL( nextField() ),
      this, SLOT( nextField() ));
    //2005-12-29 AF
    connect( input_, SIGNAL( textChanged() ),
      this, SLOT( addToHighlighter() ));
    // 2006-01-17 AF, new...
    connect( input_, SIGNAL( currentCharFormatChanged(const QTextCharFormat &) ),
      this, SLOT( charFormatChanged(const QTextCharFormat &) ));
    // 2006-04-27 AF,
    connect( input_, SIGNAL( forwardAction(int) ),
      this, SIGNAL( forwardAction(int) ));

    contentChanged();
  }
Exemple #27
0
void ListView::executeReport( int mode )
{
    ReportDialog dialog( ReportDialog::FolderSource, (ReportDialog::ReportMode)mode, mainWidget() );

    initializeReport( &dialog );
    dialog.setIssues( visibleIssues() );
    dialog.setCurrentColumns( visibleColumns() );

    dialog.exec();
}
Exemple #28
0
AddAlternatives::AddAlternatives(Item* item, QWidget *parent)
	: KDialog(parent), m_item(item), m_alternative(0)
{
	setupUi(mainWidget());
	mainWidget()->layout()->setMargin(0);
	
	setButtons(Ok | Cancel);
	setCaption(i18n("Add Alternative"));
	showButtonSeparator(true);
	
	m_Path->setWindowTitle( i18n( "Choose Alternative" ) );
	m_Path->setFilter( i18n( "*|All Files" ) );
	m_Path->setMode( KFile::File | KFile::LocalOnly );
	
	const int slaveCount = item->getSlaves()->count();
	if (slaveCount > 0)
	{
		SlaveList *slaves = item->getSlaves();
		
		QWidget *w = new QWidget;
		QVBoxLayout *lay = new QVBoxLayout(w);
		for (int i = 0; i < slaveCount; ++i)
		{
			if (i > 0)
				lay->addWidget(new KSeparator(Qt::Horizontal, w));
			SlaveWidget *sw = new SlaveWidget(slaves->at(i), w);
			lay->addWidget(sw);
			m_slaveWidgets.append(sw);
			connect(sw, SIGNAL(slaveChanged(QString)), this, SLOT(slotCheckSlaves()));
		}
		w->show();
		m_slavesArea->setWidget(w);
	}
	else
	{
		m_slavesGroup->hide();
	}
	
	enableButtonOk(false);
	connect(m_Path, SIGNAL(textChanged(QString)), this, SLOT(slotCheckSlaves()));
	connect(this, SIGNAL(okClicked()), this, SLOT(slotOkClicked()));
}
Exemple #29
0
void KPasswordDialog::setPixmap(const QPixmap &pixmap)
{
    if ( !d->pixmapLabel )
    {
        d->pixmapLabel = new QLabel( mainWidget() );
        d->pixmapLabel->setAlignment( Qt::AlignLeft | Qt::AlignTop );
        d->ui.hboxLayout->insertWidget( 0, d->pixmapLabel );
    }

    d->pixmapLabel->setPixmap( pixmap );
}
Exemple #30
0
 void commitData(QSessionManager &sm)
 {
     if(mainWidget()->isHidden())
     {
         sm.setRestartHint(QSessionManager::RestartNever);
         return;
     }
     closed_by_sm = true;
     KUniqueApplication::commitData(sm);
     closed_by_sm = false;
 }