コード例 #1
0
VoiceDialog::VoiceDialog
	(NMainFrameWidget *mainWidget, int staffNr, QPtrList<NStaff> *staffList) :
	KDialogBase
		(Tabbed,                               //  dialogFace
		 kapp->makeStdCaption(i18n("Voices")), //  caption
		 Help | User1 | Ok | Apply | Cancel,   //  buttonMask
		 Close,                                //  defaultButton
		 mainWidget,                           //  parent
		 "VoiceDialog",                        //  name (for internal use only)
		 true,                                 //  modal
		 true,                                 //  separator
		 i18n("C&reate voice")                 //  user1
		),
		mainWidget_(mainWidget),
		staffList_(staffList)
{
	unsigned int i = 1;
	QHBox * firstHBox = 0;
	for
		(QListIterator<NStaff> staffIterator(*staffList);
		 staffIterator.current();
		 ++staffIterator, ++i
		) {
		pageList_.append(new QPtrList<VoiceBox>());
		QHBox *currentPage = addHBoxPage
			(staffIterator.current()->staffName_.isEmpty() ?
			 i18n("Staff %1").arg(i) :
			 staffIterator.current()->staffName_,
			 QString::null
			);
		if (firstHBox == 0) firstHBox = currentPage;
		QListIterator<NVoice> voiceIterator(staffIterator.current()->voicelist_);
		unsigned int j = 1;
		for
			(QListIterator<NVoice>
				voiceIterator(staffIterator.current()->voicelist_);
			 voiceIterator.current();
			 ++voiceIterator, ++j
			) {
			pageList_.current()->append
				(new VoiceBox(currentPage, this, 0, j, voiceIterator.current()));
		}
	}
	firstPageIdx_ = pageIndex(firstHBox); /* there seems to be a bug in activePageIndex() it does not start with 0 */
	showPage(staffNr);
}
コード例 #2
0
void MythWizard::back()
{
    int i = 0;

    while( i < (int)d->pages.size() && d->pages[i] &&
            d->current && d->pages[i]->w != d->current->w )
        i++;

    i--;
    while( i >= 0 &&
            ( !d->pages[i] || !appropriate( d->pages[i]->w ) ) )
        i--;

    if ( i >= 0 )
        if ( d->pages[i] )
            showPage( d->pages[i]->w );
}
コード例 #3
0
void EditCalendarsPage::deleteClicked()
{
    if (!m_calendarList->currentItem())
        return;

    QMessageBox msgBox;
    msgBox.setText("Are you sure you want to delete this calendar?");
    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
    msgBox.setDefaultButton(QMessageBox::No);
    int ret = msgBox.exec();

    if (ret == QMessageBox::Yes) {
        m_collection = m_calendarList->currentItem()->data(ORGANIZER_CALENDAR_ROLE).value<QOrganizerCollection>();
        if(!m_manager->removeCollection(m_collection.id()))
            QMessageBox::information(this, "Failed!", QString("Failed to remove calendar!\n(error code %1)").arg(m_manager->error()));
        showPage(m_manager);
    }
}
コード例 #4
0
//-----------------------------------------------------------------------------
HighscoresDialog::HighscoresDialog(int rank, QWidget *parent)
    : KDialogBase(internal->nbGameTypes()>1 ? TreeList : Plain,
                  i18n("Highscores"), Close|User1|User2, Close,
                  parent, "show_highscores", true, true,
                  KGuiItem(i18n("Configure..."), "configure"),
                  KGuiItem(i18n("Export..."))), _rank(rank), _tab(0)
{
    _widgets.resize(internal->nbGameTypes(), 0);

    if ( internal->nbGameTypes()>1 ) {
        for (uint i=0; i<internal->nbGameTypes(); i++) {
            QString title = internal->manager.gameTypeLabel(i, Manager::I18N);
            QString icon = internal->manager.gameTypeLabel(i, Manager::Icon);
            QWidget *w = addVBoxPage(title, QString::null,
                                     BarIcon(icon, KIcon::SizeLarge));
            if ( i==internal->gameType() ) createPage(w);
        }

        connect(this, SIGNAL(aboutToShowPage(QWidget *)),
                SLOT(createPage(QWidget *)));
        showPage(internal->gameType());
    } else {
コード例 #5
0
ファイル: qwizard.cpp プロジェクト: aroraujjwal/qt3
void QWizard::removePage( QWidget * page )
{
    if ( !page )
	return;

    int i = d->pages.count();
    QWidget* cp = currentPage();
    while( --i >= 0 && d->pages.at( i ) && d->pages.at( i )->w != page ) { }
    if ( i < 0 )
	return;
    QWizardPrivate::Page * p = d->pages.at( i );
    d->pages.removeRef( p );
    d->ws->removeWidget( page );

    if( cp == page ) {
	i--;
	if( i < 0 )
	    i = 0;
	if ( pageCount() > 0 )
	    showPage( QWizard::page( i ) );
    }
}
コード例 #6
0
void NewProtocol::pageChanged(const QString&)
{
    if (currentPage() == m_connectWnd){
        emit apply();
        m_bConnect = true;
        unsigned status = CorePlugin::m_plugin->getManualStatus();
        if (status == STATUS_OFFLINE)
            status = STATUS_ONLINE;
        m_client->setStatus(status, false);
        m_connectWnd->setConnecting(true);
        setBackEnabled(m_connectWnd, false);
        setNextEnabled(currentPage(), false);
        setFinishEnabled(m_connectWnd, false);
    }
    if (m_last && (currentPage() == m_last)){
        setFinishEnabled(m_connectWnd, false);
        cancelButton()->show();
        backButton()->show();
        finishButton()->hide();
        showPage(protocolPage);
        protocolChanged(0);
    }
}
コード例 #7
0
void KMoneyThingMainWidget::activatePage(KMoneyThingMainWidget::Page page)
{
  switch(page)
  {
    case homePage:
      showPage(pageIndex(homeFrame));
      break;
    case accountsPage:
      showPage(pageIndex(accountsFrame));
      break;
    case calendarPage:
      showPage(pageIndex(calendarFrame));
      break;
    case categoriesPage:
      showPage(pageIndex(categoriesFrame));
      break;
    case findPage:
      showPage(pageIndex(findFrame));
      break;
    case transactionsPage:
      showPage(pageIndex(transactionsFrame));
      break;
  }
}
コード例 #8
0
ファイル: psitabwidget.cpp プロジェクト: ChowZenki/psi
void PsiTabWidget::setCurrentPage(int index) {
	if (index >= 0 && index < count()) {
		showPage(widgets_[index]);
	}
}
コード例 #9
0
ファイル: label.cpp プロジェクト: anarexia/bacula
/*
 * An overload of the constructor to have a default storage show in the
 * combobox on start.  Used from context sensitive in storage class.
 */
labelPage::labelPage(QString &defString) : Pages()
{
   showPage(defString);
}
コード例 #10
0
ファイル: label.cpp プロジェクト: anarexia/bacula
labelPage::labelPage() : Pages()
{
   QString deflt("");
   m_closeable = false;
   showPage(deflt);
}
コード例 #11
0
void OutputWindow::showDebugTab()
{
    showPage( debugView );
}
コード例 #12
0
ファイル: mpdf.cpp プロジェクト: qihao/Lookshare-GUI
void Mpdf::numberClicked(int number)
{
    currentPage = (currentPage - 1) / 9 * 9 + number + 1;
    showPage();
}
コード例 #13
0
ファイル: app_window.cpp プロジェクト: sanami/qt-music-player
void AppWindow::showPageForAction(QAction *action)
{
	qDebug() << Q_FUNC_INFO << action->isChecked();
	showPage(m_pages[action]);
//	action->setChecked(true);
}
コード例 #14
0
DumpRenderTree::DumpRenderTree()
    : m_dumpPixels(false)
    , m_stdin(0)
    , m_enableTextOutput(false)
    , m_standAloneMode(false)
    , m_graphicsBased(false)
    , m_persistentStoragePath(QString(getenv("DUMPRENDERTREE_TEMP")))
{

    QByteArray viewMode = getenv("QT_DRT_WEBVIEW_MODE");
    if (viewMode == "graphics")
        setGraphicsBased(true);

    DumpRenderTreeSupportQt::overwritePluginDirectories();
    DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(true);
    QWebSettings::enablePersistentStorage(m_persistentStoragePath);

    m_networkAccessManager = new NetworkAccessManager(this);
    // create our primary testing page/view.
    if (isGraphicsBased()) {
        WebViewGraphicsBased* view = new WebViewGraphicsBased(0);
        m_page = new WebPage(view, this);
        view->setPage(m_page);
        m_mainView = view;
    } else {
        QWebView* view = new QWebView(0);
        m_page = new WebPage(view, this);
        view->setPage(m_page);
        m_mainView = view;
    }
    // Use a frame group name for all pages created by DumpRenderTree to allow
    // testing of cross-page frame lookup.
    DumpRenderTreeSupportQt::webPageSetGroupName(m_page, "org.webkit.qt.DumpRenderTree");

    m_mainView->setContextMenuPolicy(Qt::NoContextMenu);
    m_mainView->resize(QSize(LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight));

    // clean up cache by resetting quota.
    qint64 quota = webPage()->settings()->offlineWebApplicationCacheQuota();
    webPage()->settings()->setOfflineWebApplicationCacheQuota(quota);

    // create our controllers. This has to be done before connectFrame,
    // as it exports there to the JavaScript DOM window.
    m_controller = new LayoutTestController(this);
    connect(m_controller, SIGNAL(showPage()), this, SLOT(showPage()));
    connect(m_controller, SIGNAL(hidePage()), this, SLOT(hidePage()));

    // async geolocation permission set by controller
    connect(m_controller, SIGNAL(geolocationPermissionSet()), this, SLOT(geolocationPermissionSet()));

    connect(m_controller, SIGNAL(done()), this, SLOT(dump()));
    m_eventSender = new EventSender(m_page);
    m_textInputController = new TextInputController(m_page);
    m_plainTextController = new PlainTextController(m_page);
    m_gcController = new GCController(m_page);

    // now connect our different signals
    connect(m_page, SIGNAL(frameCreated(QWebFrame *)),
            this, SLOT(connectFrame(QWebFrame *)));
    connectFrame(m_page->mainFrame());

    connect(m_page, SIGNAL(loadFinished(bool)),
            m_controller, SLOT(maybeDump(bool)));
    // We need to connect to loadStarted() because notifyDone should only
    // dump results itself when the last page loaded in the test has finished loading.
    connect(m_page, SIGNAL(loadStarted()),
            m_controller, SLOT(resetLoadFinished()));
    connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
    connect(m_page, SIGNAL(printRequested(QWebFrame*)), this, SLOT(dryRunPrint(QWebFrame*)));

    connect(m_page->mainFrame(), SIGNAL(titleChanged(const QString&)),
            SLOT(titleChanged(const QString&)));
    connect(m_page, SIGNAL(databaseQuotaExceeded(QWebFrame*,QString)),
            this, SLOT(dumpDatabaseQuota(QWebFrame*,QString)));
    connect(m_page, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin *, quint64)),
            this, SLOT(dumpApplicationCacheQuota(QWebSecurityOrigin *, quint64)));
    connect(m_page, SIGNAL(statusBarMessage(const QString&)),
            this, SLOT(statusBarMessage(const QString&)));

    QObject::connect(this, SIGNAL(quit()), qApp, SLOT(quit()), Qt::QueuedConnection);

    DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true);
    QFocusEvent event(QEvent::FocusIn, Qt::ActiveWindowFocusReason);
    QApplication::sendEvent(m_mainView, &event);
}
コード例 #15
0
ファイル: kjanuswidget.cpp プロジェクト: Fat-Zer/tdelibs
void KJanusWidget::addPageWidget( TQFrame *page, const TQStringList &items,
				  const TQString &header,const TQPixmap &pixmap )
{
  connect(page, TQT_SIGNAL(destroyed(TQObject*)), TQT_SLOT(pageGone(TQObject*)));

  if( mFace == Tabbed )
  {
    mTabControl->addTab (page, items.last());
    d->mIntToPage[d->mNextPageIndex] = static_cast<TQWidget*>(page);
    d->mPageToInt[static_cast<TQWidget*>(page)] = d->mNextPageIndex;
    d->mNextPageIndex++;
  }
  else if( mFace == TreeList || mFace == IconList )
  {
    d->mIntToPage[d->mNextPageIndex] = static_cast<TQWidget*>(page);
    d->mPageToInt[static_cast<TQWidget*>(page)] = d->mNextPageIndex;
    mPageStack->addWidget( page, 0 );

    if (items.isEmpty()) {
      kdDebug() << "Invalid TQStringList, with zero items" << endl;
      return;
    }

    if( mFace == TreeList )
    {
      InsertTreeListItem(items, pixmap, page);
    }
    else // mFace == IconList
    {
      TQString itemName = items.last();
      IconListItem *item = new IconListItem( mIconList, pixmap, itemName );
      mIconListToPageStack.insert(item, page);
      mIconList->invalidateHeight();
      mIconList->invalidateWidth();

      if (mIconList->isVisible())
        mIconList->updateWidth();
    }

    //
    // Make sure the title label is sufficiently wide
    //
    TQString lastName = items.last();
    const TQString &title = (!header.isNull() ? header : lastName);
    TQRect r = mTitleLabel->fontMetrics().boundingRect( title );
    if( mTitleLabel->minimumWidth() < r.width() )
    {
      mTitleLabel->setMinimumWidth( r.width() );
    }
    d->mIntToTitle[d->mNextPageIndex] = title;
    if( d->mIntToTitle.count() == 1 )
    {
      showPage(0);
    }
    d->mNextPageIndex++;
  }
  else
  {
    kdDebug() << "KJanusWidget::addPageWidget: can only add a page in Tabbed, TreeList or IconList modes" << endl;
  }

}
コード例 #16
0
void KLFirstDialog::showFinish()
{
	showPage(m_finish);
}
コード例 #17
0
ファイル: WebPageProxy.cpp プロジェクト: UIKit0/WebkitAIR
void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder& arguments)
{
    if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
        m_drawingArea->didReceiveMessage(connection, messageID, arguments);
        return;
    }

    switch (messageID.get<WebPageProxyMessage::Kind>()) {
        case WebPageProxyMessage::DidCreateMainFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didCreateMainFrame(frameID);
            break;
        }
        case WebPageProxyMessage::DidCreateSubFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didCreateSubFrame(frameID);
            break;
        }
        case WebPageProxyMessage::DidStartProvisionalLoadForFrame: {
            uint64_t frameID;
            String url;
            if (!arguments.decode(CoreIPC::Out(frameID, url)))
                return;
            didStartProvisionalLoadForFrame(webFrame(frameID), url);
            break;
        }
        case WebPageProxyMessage::DidReceiveServerRedirectForProvisionalLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didReceiveServerRedirectForProvisionalLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFailProvisionalLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFailProvisionalLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidCommitLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didCommitLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFinishLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFinishLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFailLoadForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFailLoadForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidReceiveTitleForFrame: {
            uint64_t frameID;
            String title;
            if (!arguments.decode(CoreIPC::Out(frameID, title)))
                return;
            didReceiveTitleForFrame(webFrame(frameID), title);
            break;
        }
        case WebPageProxyMessage::DidFirstLayoutForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFirstLayoutForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidFirstVisuallyNonEmptyLayoutForFrame: {
            uint64_t frameID;
            if (!arguments.decode(frameID))
                return;
            didFirstVisuallyNonEmptyLayoutForFrame(webFrame(frameID));
            break;
        }
        case WebPageProxyMessage::DidStartProgress:
            didStartProgress();
            break;
        case WebPageProxyMessage::DidChangeProgress: {
            double value;
            if (!arguments.decode(value))
                return;
            didChangeProgress(value);
            break;
        }
        case WebPageProxyMessage::DidFinishProgress:
            didFinishProgress();
            break;
        case WebPageProxyMessage::DidReceiveEvent: {
            uint32_t type;
            if (!arguments.decode(type))
                return;
            didReceiveEvent((WebEvent::Type)type);
            break;
        }
        case WebPageProxyMessage::TakeFocus: {
            // FIXME: Use enum here.
            bool direction;
            if (!arguments.decode(direction))
                return;
            takeFocus(direction);
            break;
        }
        case WebPageProxyMessage::DidChangeCanGoBack: {
            bool canGoBack;
            if (!arguments.decode(canGoBack))
                return;
            m_canGoBack = canGoBack;
            break;
        }
        case WebPageProxyMessage::DidChangeCanGoForward: {
            bool canGoForward;
            if (!arguments.decode(canGoForward))
                return;
            m_canGoForward = canGoForward;
            break;
        }
        case WebPageProxyMessage::DecidePolicyForNavigationAction: {
            uint64_t frameID;
            uint32_t navigationType;
            String url;
            uint64_t listenerID;
            if (!arguments.decode(CoreIPC::Out(frameID, navigationType, url, listenerID)))
                return;
            decidePolicyForNavigationAction(webFrame(frameID), navigationType, url, listenerID);
            break;
        }
        case WebPageProxyMessage::DecidePolicyForNewWindowAction: {
            uint64_t frameID;
            uint32_t navigationType;
            String url;
            uint64_t listenerID;
            if (!arguments.decode(CoreIPC::Out(frameID, navigationType, url, listenerID)))
                return;
            decidePolicyForNewWindowAction(webFrame(frameID), navigationType, url, listenerID);
            break;
        }
        case WebPageProxyMessage::DecidePolicyForMIMEType: {
            uint64_t frameID;
            String MIMEType;
            String url;
            uint64_t listenerID;
            if (!arguments.decode(CoreIPC::Out(frameID, MIMEType, url, listenerID)))
                return;
            decidePolicyForMIMEType(webFrame(frameID), MIMEType, url, listenerID);
            break;
        }
        case WebPageProxyMessage::DidRunJavaScriptInMainFrame: {
            String resultString;
            uint64_t callbackID;
            if (!arguments.decode(CoreIPC::Out(resultString, callbackID)))
                return;
            didRunJavaScriptInMainFrame(resultString, callbackID);
            break;
        }
        case WebPageProxyMessage::DidGetRenderTreeExternalRepresentation: {
            String resultString;
            uint64_t callbackID;
            if (!arguments.decode(CoreIPC::Out(resultString, callbackID)))
                return;
            didGetRenderTreeExternalRepresentation(resultString, callbackID);
            break;
        }
        case WebPageProxyMessage::SetToolTip: {
            String toolTip;
            if (!arguments.decode(toolTip))
                return;
            setToolTip(toolTip);
            break;
        }
        case WebPageProxyMessage::ShowPage: {
            showPage();
            break;
        }
        case WebPageProxyMessage::ClosePage: {
            closePage();
            break;
        }
        case WebPageProxyMessage::DidNavigateWithNavigationData: {
            WebNavigationDataStore store;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(store, frameID)))
                return;
            didNavigateWithNavigationData(webFrame(frameID), store);
            break;
        }
        case WebPageProxyMessage::DidPerformClientRedirect: {
            String sourceURLString;
            String destinationURLString;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))
                return;
            didPerformClientRedirect(webFrame(frameID), sourceURLString, destinationURLString);
            break;
        }
        case WebPageProxyMessage::DidPerformServerRedirect: {
            String sourceURLString;
            String destinationURLString;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(sourceURLString, destinationURLString, frameID)))
                return;
            didPerformServerRedirect(webFrame(frameID), sourceURLString, destinationURLString);
            break;
        }
        case WebPageProxyMessage::DidUpdateHistoryTitle: {
            String title;
            String url;
            uint64_t frameID;
            if (!arguments.decode(CoreIPC::Out(title, url, frameID)))
                return;
            didUpdateHistoryTitle(webFrame(frameID), title, url);
            break;
        }
        default:
            ASSERT_NOT_REACHED();
            break;
    }
}
コード例 #18
0
/** this session is restarted, so we want to start with ospage */
void KPersonalizer::restarted(){
	showPage(ospage);
}
コード例 #19
0
ファイル: PageContainer.cpp プロジェクト: Glought/MultiMC5
void PageContainer::currentChanged(const QModelIndex &current)
{
	showPage(current.isValid() ? m_proxyModel->mapToSource(current).row() : -1);
}
コード例 #20
0
// auto resize handle
void FastViewWidget::resizeEvent(QResizeEvent *e)
{
   showPage(currentPage+1);
   QScrollArea::resizeEvent(e);
}
コード例 #21
0
// functuion to set a page
void FastViewWidget::setPage(int page)
{
    if (page != currentPage + 1) {
       showPage(page);
    }
}
コード例 #22
0
void SetupWizardDialog::onBtnPrev(wxCommandEvent& e)
{
	showPage(current_page - 1);
}
コード例 #23
0
void LayoutTestController::display()
{
    emit showPage();
}
コード例 #24
0
void TestRunner::display()
{
    DumpRenderTreeSupportQt::setTrackRepaintRects(m_topLoadingFrame->handle(), true);
    emit showPage();
}
コード例 #25
0
ファイル: mpdf.cpp プロジェクト: qihao/Lookshare-GUI
void Mpdf::zoominClicked()
{
    currentZoom = currentZoom + 10;
    showPage();
}
コード例 #26
0
ファイル: viewport.cpp プロジェクト: sobiron236/cupsfilter
void ViewPort::setPixMapList(PixmapList pList)
{
    m_pixmap_list = pList;
    showPage(0); // Рисуем первую страницу
}
コード例 #27
0
void EditFunction::accept()
{
  QString f_str( editfunctionpage->equation->text() );
        
        if ( m_id!=-1 )
                m_parser->fixFunctionName(f_str, XParser::Function, m_id);
        else
                m_parser->fixFunctionName(f_str, XParser::Function);
	if ( f_str.at(0)== 'x' || f_str.at(0)== 'y' || f_str.at(0)== 'r')
	{
		KMessageBox::error( this, i18n("You can only define plot functions in this dialog"));
		return;
	}
	
	Ufkt tmp_ufkt; //all settings are saved here until we know that no errors have appeared
	if( editfunctionpage->customMinRange->isChecked() )
	{
	  tmp_ufkt.usecustomxmin = true;
	  tmp_ufkt.str_dmin = editfunctionpage->min->text();
	  tmp_ufkt.dmin = m_parser->eval( editfunctionpage->min->text() );
	  if (m_parser->parserError() != 0)
	  {
	    showPage(0);
	    editfunctionpage->min->setFocus();
	    editfunctionpage->min->selectAll();
	    return;
	  }
	}
	else
	  tmp_ufkt.usecustomxmin = false;
	if( editfunctionpage->customMaxRange->isChecked() )
	{
	  tmp_ufkt.usecustomxmax = true;
	  tmp_ufkt.str_dmax= editfunctionpage->max->text();
	  tmp_ufkt.dmax = m_parser->eval( editfunctionpage->max->text() );
	  if (m_parser->parserError() != 0)
	  {
	    showPage(0);
	    editfunctionpage->max->setFocus();
	    editfunctionpage->max->selectAll();
	    return;
	  }
	}
	else
	  tmp_ufkt.usecustomxmax = false;
	
	if( tmp_ufkt.usecustomxmin && tmp_ufkt.usecustomxmax )
	{
		if ( tmp_ufkt.dmin >=  tmp_ufkt.dmax)
		{
			KMessageBox::error(this,i18n("The minimum range value must be lower than the maximum range value"));
			showPage(0);
			editfunctionpage->min->setFocus();
			editfunctionpage->min->selectAll();
			return;
		}
		
		if (  tmp_ufkt.dmin<View::xmin || tmp_ufkt.dmax>View::xmax )
		{
			KMessageBox::error(this,i18n("Please insert a minimum and maximum range between %1 and %2").arg(View::xmin).arg(View::xmax) );
			showPage(0);
			editfunctionpage->min->setFocus();
			editfunctionpage->min->selectAll();
			return;
		}
	}

	tmp_ufkt.linewidth = editfunctionpage->lineWidth->value();
	tmp_ufkt.color = editfunctionpage->color->color().rgb();
	
	if (editintegralpage->showIntegral->isChecked() )
	{
		double initx = m_parser->eval(editintegralpage->txtInitX->text());
		tmp_ufkt.startx = initx;
		tmp_ufkt.str_startx = editintegralpage->txtInitX->text();
		if (m_parser->parserError(false) != 0)
		{
			KMessageBox::error(this,i18n("Please insert a valid x-value"));
			showPage(2);
			editintegralpage->txtInitX->setFocus();
                        editintegralpage->txtInitX->selectAll();
			return;
		}
		
		double inity = m_parser->eval(editintegralpage->txtInitY->text());
		tmp_ufkt.starty = inity;
		tmp_ufkt.str_starty = editintegralpage->txtInitY->text();
		if (m_parser->parserError(false) != 0)
		{
			KMessageBox::error(this,i18n("Please insert a valid y-value"));
			showPage(2);
			editintegralpage->txtInitY->setFocus();
			editintegralpage->txtInitY->selectAll();
			return;
		}
		tmp_ufkt.integral_mode = 1;
	}
	else
		tmp_ufkt.integral_mode = 0;

	tmp_ufkt.integral_color = editintegralpage->color->color().rgb();
	tmp_ufkt.integral_use_precision = editintegralpage->customPrecision->isChecked();
	tmp_ufkt.integral_precision = editintegralpage->precision->value();
	tmp_ufkt.integral_linewidth = editintegralpage->lineWidth->value();

        tmp_ufkt.f_mode = !editfunctionpage->hide->isChecked();
	
	if( editfunctionpage->useSlider->isChecked() )
		tmp_ufkt.use_slider = editfunctionpage->listOfSliders->currentItem(); //specify which slider that will be used
	else
	{
		tmp_ufkt.use_slider = -1;
		if ( editfunctionpage->useNoParameter->isChecked() || m_parameter.isEmpty() )
			m_parameter.clear();
		else
		{
			tmp_ufkt.parameters = m_parameter;
		}
			
	}

	tmp_ufkt.f1_mode =  editderivativespage->showDerivative1->isChecked();
	tmp_ufkt.f1_linewidth = editderivativespage->lineWidthDerivative1->value();
	tmp_ufkt.f1_color = editderivativespage->colorDerivative1->color().rgb();
	
	tmp_ufkt.f2_mode =  editderivativespage->showDerivative2->isChecked();
	tmp_ufkt.f2_linewidth = editderivativespage->lineWidthDerivative2->value();
	tmp_ufkt.f2_color = editderivativespage->colorDerivative2->color().rgb();
	
	if ( f_str.contains('y') != 0 && ( tmp_ufkt.f_mode || tmp_ufkt.f1_mode || tmp_ufkt.f2_mode) )
	{
		KMessageBox::error( this, i18n( "Recursive function is only allowed when drawing integral graphs") );
		return;
        }
        
        Ufkt *added_ufkt;
        if( m_id != -1 )  //when editing a function: 
        {
                int const ix = m_parser->ixValue(m_id);
                if ( ix == -1) //The function could have been deleted
                {
                        KMessageBox::error(this,i18n("Function could not be found"));
                        return;
                }
                added_ufkt =  &m_parser->ufkt[ix];
                QString const old_fstr = added_ufkt->fstr;
                if((  (!m_parameter.isEmpty() && editfunctionpage->useList->isChecked() ) || editfunctionpage->useSlider->isChecked() ) && !functionHas2Arguments() )
                        fixFunctionArguments(f_str); //adding an extra argument for the parameter value
                added_ufkt->fstr = f_str;
                m_parser->reparse(added_ufkt); //reparse the funcion
                if ( m_parser->parserError() != 0)
                {
                        added_ufkt->fstr = old_fstr;
                        m_parser->reparse(added_ufkt); 
                        raise();
                        showPage(0);
                        editfunctionpage->equation->setFocus();
                        editfunctionpage->equation->selectAll();
                        return;
                }
        }
        else //creating a new function
        {
                if((  (!m_parameter.isEmpty() && editfunctionpage->useList->isChecked() ) || editfunctionpage->useSlider->isChecked() ) && !functionHas2Arguments() )
                        fixFunctionArguments(f_str); //adding an extra argument for the parameter value
                int const id = m_parser->addfkt( f_str ); //create a new function otherwise
                if( id == -1)
                {
                        m_parser->parserError();
                        raise();
                        showPage(0);
                        editfunctionpage->equation->setFocus();
                        editfunctionpage->equation->selectAll();
                        return;
                }
                added_ufkt =  &m_parser->ufkt.last();
        }
        //save all settings in the function now when we know no errors have appeared
	added_ufkt->f_mode = tmp_ufkt.f_mode;
	added_ufkt->f1_mode = tmp_ufkt.f1_mode;
	added_ufkt->f2_mode = tmp_ufkt.f2_mode;
	added_ufkt->integral_mode = tmp_ufkt.integral_mode;
	added_ufkt->integral_use_precision = tmp_ufkt.integral_use_precision;
	added_ufkt->linewidth = tmp_ufkt.linewidth;
	added_ufkt->f1_linewidth = tmp_ufkt.f1_linewidth;
	added_ufkt->f2_linewidth = tmp_ufkt.f2_linewidth;
	added_ufkt->integral_linewidth = tmp_ufkt.integral_linewidth;
	added_ufkt->str_dmin = tmp_ufkt.str_dmin;
	added_ufkt->str_dmax = tmp_ufkt.str_dmax;
	added_ufkt->dmin = tmp_ufkt.dmin;
	added_ufkt->dmax = tmp_ufkt.dmax;
	added_ufkt->str_startx = tmp_ufkt.str_startx;
	added_ufkt->str_starty = tmp_ufkt.str_starty;
	added_ufkt->oldx = tmp_ufkt.oldx;
	added_ufkt->starty = tmp_ufkt.starty;
	added_ufkt->startx = tmp_ufkt.startx;
	added_ufkt->integral_precision = tmp_ufkt.integral_precision;
	added_ufkt->color = tmp_ufkt.color;
	added_ufkt->f1_color = tmp_ufkt.f1_color;
	added_ufkt->f2_color = tmp_ufkt.f2_color;
	added_ufkt->integral_color = tmp_ufkt.integral_color;
	added_ufkt->parameters = tmp_ufkt.parameters;
	added_ufkt->use_slider = tmp_ufkt.use_slider;
	added_ufkt->usecustomxmin = tmp_ufkt.usecustomxmin;
	added_ufkt->usecustomxmax = tmp_ufkt.usecustomxmax;
        
    m_updatedfunction = added_ufkt;
	
	// call inherited method
	KDialogBase::accept();
}
コード例 #28
0
/*!
  Setup our basic widget layout, ready for the pages
*/
void VkOptionsDialog::setupLayout()
{
   // ------------------------------------------------------------
   // top layout
   QVBoxLayout* vLayout = new QVBoxLayout( this );
   vLayout->setObjectName( QString::fromUtf8( "vlayout" ) );
   
   // ------------------------------------------------------------
   // parent widget for the contents + pages
   QWidget* hLayoutWidget = new QWidget( this );
   hLayoutWidget->setObjectName( QString::fromUtf8( "hLayoutWidget" ) );
   vLayout->addWidget( hLayoutWidget );
   
   // ------------------------------------------------------------
   // contents + pages layout
   QHBoxLayout* hLayout = new QHBoxLayout( hLayoutWidget );
   hLayout->setObjectName( QString::fromUtf8( "hLayout" ) );
   hLayout->setContentsMargins( 0, 0, 0, 0 );
   
   // ------------------------------------------------------------
   // The contents list
   // Note: give this its maximum width once filled with items
   contentsListWidget = new QListWidget( hLayoutWidget );
   contentsListWidget->setObjectName( QString::fromUtf8( "contentsListWidget" ) );
   contentsListWidget->setEditTriggers( QAbstractItemView::NoEditTriggers );
   contentsListWidget->setSortingEnabled( false );
   QSizePolicy sizePolicyContents( QSizePolicy::Maximum, QSizePolicy::Expanding );
   contentsListWidget->setSizePolicy( sizePolicyContents );
   contentsListWidget->setSelectionMode( QAbstractItemView::SingleSelection );
   hLayout->addWidget( contentsListWidget );
   
   optionPages = new QStackedWidget( hLayoutWidget );
   optionPages->setObjectName( QString::fromUtf8( "optionPages" ) );
   optionPages->setFrameShape( QFrame::StyledPanel );
   optionPages->setFrameShadow( QFrame::Raised );
   hLayout->addWidget( optionPages );
   
   
   // ------------------------------------------------------------
   // parent widget for the buttons
   QWidget* hButtonWidget = new QWidget( this );
   hButtonWidget->setObjectName( QString::fromUtf8( "hButtonWidget" ) );
   vLayout->addWidget( hButtonWidget );
   
   // ------------------------------------------------------------
   // options button box
   QHBoxLayout* hLayoutButtons = new QHBoxLayout( hButtonWidget );
   hLayoutButtons->setObjectName( QString::fromUtf8( "hLayoutButtons" ) );
   hLayoutButtons->setMargin(0);
   
   updateDefaultsButton = new QPushButton( QPixmap( ":/vk_icons/icons/filesave.png" ),
                                     "Save As Project Default" );
   hLayoutButtons->addWidget( updateDefaultsButton );
   hLayoutButtons->addStretch( 1 );
   
   optionsButtonBox = new QDialogButtonBox( hButtonWidget );
   optionsButtonBox->setObjectName( QString::fromUtf8( "optionsButtonBox" ) );
   optionsButtonBox->setOrientation( Qt::Horizontal );
   optionsButtonBox->setStandardButtons( QDialogButtonBox::Apply |
                                         QDialogButtonBox::Cancel |
                                         QDialogButtonBox::Ok );
   hLayoutButtons->addWidget( optionsButtonBox );
   
   // ------------------------------------------------------------
   // signals / slots
   connect( contentsListWidget, SIGNAL( itemSelectionChanged() ),
            this,                 SLOT( showPage() ) );

   QPushButton* applyButton  = optionsButtonBox->button( QDialogButtonBox::Apply );
   QPushButton* cancelButton = optionsButtonBox->button( QDialogButtonBox::Cancel );
   QPushButton* okButton     = optionsButtonBox->button( QDialogButtonBox::Ok );
   connect( applyButton,      SIGNAL( released() ), this, SLOT( apply()  ) ); // Apply
   connect( optionsButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); // Cancel
   connect( optionsButtonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); // Ok
   connect( updateDefaultsButton, SIGNAL( released() ), this, SLOT( overwriteDefaultConfig() ) );

   // ------------------------------------------------------------
   // setup default state
   applyButton->setEnabled( false );
   cancelButton->setEnabled( true );
   okButton->setDefault( true );
}
コード例 #29
0
void JabberWizard::search()
{
    showPage(m_result);
}
コード例 #30
0
ファイル: desktopwidget.cpp プロジェクト: sglass68/paperman
void Desktopwidget::openStack (const QModelIndex &index)
   {
   emit showPage (index);
   }