Ejemplo n.º 1
0
void RemapDialog::reflowLayout() {
	Dialog::reflowLayout();

	int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
	int scrollbarWidth = g_gui.xmlEval()->getVar("Globals.Scrollbar.Width", 0);

	int16 areaX, areaY;
	uint16 areaW, areaH;
	int spacing = g_gui.xmlEval()->getVar("Globals.KeyMapper.Spacing");
	int labelWidth =  g_gui.xmlEval()->getVar("Globals.KeyMapper.LabelWidth");
	int buttonWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.ButtonWidth");
	int colWidth = labelWidth + buttonWidth + spacing;

	g_gui.xmlEval()->getWidgetData((const String&)String("KeyMapper.KeymapArea"), areaX, areaY, areaW, areaH);

	_colCount = (areaW - scrollbarWidth) / colWidth;
	_rowCount = (areaH + spacing) / (buttonHeight + spacing);
	if (_colCount <= 0 || _rowCount <= 0)
		error("Remap dialog too small to display any keymaps");

	_scrollBar->resize(areaX + areaW - scrollbarWidth, areaY, scrollbarWidth, areaH);
	_scrollBar->_entriesPerPage = _rowCount;
	_scrollBar->_numEntries = 1;
	_scrollBar->recalc();

	uint textYOff = (buttonHeight - kLineHeight) / 2;
	uint oldSize = _keymapWidgets.size();
	uint newSize = _rowCount * _colCount;

	_keymapWidgets.reserve(newSize);

	for (uint i = 0; i < newSize; i++) {
		ActionWidgets widg;

		if (i >= _keymapWidgets.size()) {
			widg.actionText =
				new GUI::StaticTextWidget(this, 0, 0, 0, 0, "", Graphics::kTextAlignRight);
			widg.keyButton =
				new GUI::ButtonWidget(this, 0, 0, 0, 0, "", 0, kRemapCmd + i);
			_keymapWidgets.push_back(widg);
		} else {
			widg = _keymapWidgets[i];
		}

		uint x = areaX + (i % _colCount) * colWidth;
		uint y = areaY + (i / _colCount) * (buttonHeight + spacing);

		widg.actionText->resize(x, y + textYOff, labelWidth, kLineHeight);
		widg.keyButton->resize(x + labelWidth, y, buttonWidth, buttonHeight);
	}
	while (oldSize > newSize) {
		ActionWidgets widg = _keymapWidgets.remove_at(--oldSize);

		removeWidget(widg.actionText);
		delete widg.actionText;

		removeWidget(widg.keyButton);
		delete widg.keyButton;
	}
}
void CellmlAnnotationViewMetadataViewDetailsWidget::updateGui(iface::cellml_api::CellMLElement *pElement)
{
    if (pElement == nullptr) {
        return;
    }

    // Decide on which view to use and update it, if needed

    switch (mCellmlFile->rdfTriples(pElement).type()) {
    case CellMLSupport::CellmlFileRdfTriple::Type::Unknown:
        removeWidget(mNormalView);
        addWidget(mRawView);

        mRawView->updateGui(pElement);

        break;
    case CellMLSupport::CellmlFileRdfTriple::Type::BioModelsDotNetQualifier:
    case CellMLSupport::CellmlFileRdfTriple::Type::Empty:
        removeWidget(mRawView);
        addWidget(mNormalView);

        mNormalView->updateGui(pElement);

        break;
    }
}
Ejemplo n.º 3
0
 void kClipHolder::removeSubView(){
     if(subView) {
         view->addDelete(subView);
         removeWidget(subView);
         subView.reset();
     }
 }
Ejemplo n.º 4
0
 void kSampleView::clearSamples(){
     for (int j=0; j<samples.size(); j++) {
         removeWidget( samples[j] );
         samples[j].reset();
     }
     samples.clear();
 }
Ejemplo n.º 5
0
DataWidget* WidgetArea::loadOneWidget(DataFileParser *file, bool skip)
{
    // type
    if(!file->seekToNextBlock("widgetType", BLOCK_WIDGET))
        return NULL;

    quint8 type = 0;
    file->read((char*)&type, sizeof(quint8));

    // pos and size
    if(!file->seekToNextBlock("widgetPosSize", BLOCK_WIDGET))
        return NULL;

    int val[4];
    file->read((char*)&val, sizeof(val));

    DataWidget *w = addWidget(QPoint(val[0], val[1]), type, !skip);
    if(!w)
        return NULL;

    w->resize(val[2], val[3]);
    w->loadWidgetInfo(file);

    if(skip)
        removeWidget(w->getId());
    else
        updateMarker(w);
    return w;
}
Ejemplo n.º 6
0
void WalletStack::removeAllWallets()
{
    QMap<QString, WalletView*>::const_iterator i;
    for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i)
        removeWidget(i.value());
    mapWalletViews.clear();
}
bool SdlManager::removeWidget(WidgetReference widget)
{
	for(int layer = 0; layer < WL_COUNT; layer++)
		if(removeWidget(widget, layer))
			return true;
	return false;
}
Ejemplo n.º 8
0
void WContainerWidget::removeFromLayout(WWidget *widget)
{
#ifndef WT_NO_LAYOUT
  if (layout_)
    removeWidget(widget);
#endif // WT_NO_LAYOUT
}
Ejemplo n.º 9
0
void QTodoList::removeTodo(QTodoItem* item)
{
	QTUM::get()->addChange(new QTodoChangeDelete(this,findWidget(item),new QTodoItem(*item)));
	removeWidget(item);
	delete item;
	setModified();
}
Ejemplo n.º 10
0
void PluginFactory::unload( const PluginInfoPair& pair )
{
    PTRACE( 6, "PluginFactory::unload" );
    PluginInfo *pluginInfo = pair.first;
    if( !pluginInfo ) return;

    int id = pluginInfo->id;
    onStartupMap[id] = NotLoad;

    if( !loaded(pair) ) return;

    //do not unload the plugin if P_CAN_UNLOAD flag is not set and
    //forceUnload is false
    if( !(pluginInfo->flags & P_CAN_UNLOAD) && !d->forceUnload ) {
        PTRACE(3, "Plugin " << pluginInfo->name << " can't be unloaded.");
        return;
    }

    PTRACE(6, "Unloading plugin " << pluginInfo->name );

    if( pluginInfo->flags & P_HAS_GUI ) {
        emit removeWidget( insertedWidgets[id] );
        insertedWidgets.remove(id);
    }

    destroyPlugin(pair);
}
Ejemplo n.º 11
0
void PagesWidget::removePage(const QString& userId)
{
    ChatPageWidget* chatPage = widget(userId);
    removeWidget(chatPage);
    delete chatPage;
    qDebug() << "page" << userId << "removed" << count();
}
Ejemplo n.º 12
0
void DMainWindow::removeAll()
{
	for (QValueList<QWidget*>::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it)
	{
		removeWidget(*it);
	}
}
Ejemplo n.º 13
0
CustomToolbarCreator::CustomToolbarCreator(QWidget* parent,
                                           QMap<QString, QAction*>& action_map)
    : QFrame(parent)
    , ui(new Ui::CustomToolbarCreator)
    , a_map(action_map)
{
    ui->setupUi(this);

    ui->chosen_actions->setDragDropMode(QAbstractItemView::InternalMove);

    ui->offered_actions->setSortingEnabled(true);

    ui->offered_actions->fromActionMap(a_map);

    connect(ui->add_button, SIGNAL(released()), this, SLOT(addChosenAction()));
    connect(ui->remove_button, SIGNAL(released()), this, SLOT(removeChosenAction()));

    connect(ui->offered_actions, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(addChosenAction(QListWidgetItem*)));
    connect(ui->chosen_actions, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(removeChosenAction(QListWidgetItem*)));

    connect(ui->add_widget_button, SIGNAL(released()), this, SLOT(addWidget()));
    connect(ui->remove_widget_button, SIGNAL(released()), this, SLOT(removeWidget()));

    connect(ui->combo, SIGNAL(activated(QString)), this, SLOT(setLists(QString)));

    connect(ui->save_button, SIGNAL(released()), parent, SLOT(accept()));
}
Ejemplo n.º 14
0
void PagesWidget::removePage(int friendId)
{
    ChatPageWidget* chatPage = widget(friendId);
    removeWidget(chatPage);
    delete chatPage;
    qDebug() << "page" << friendId << "removed" << count();
}
Ejemplo n.º 15
0
void DnDWidget::moveVerticalToNewPos(const QPoint &pos)
{
    int dest = pos.y();
    int y = oldPos.y();
    int sign = (dest > y)?1:-1;
    int h = height();

    auto vl = qobject_cast<QVBoxLayout*>(getParentLayout());
    if (vl)
    {
        if (std::abs(dest - y ) > h)
        {
            int index = vl->indexOf(this);
            while (true)
            {
                if (y >= dest && y <= dest + h)
                    break;

                index += sign;
                y     += sign * h;

                if (index < 0 || index >= vl->count())
                    break;

                vl->removeWidget(this);
                vl->insertWidget(index , this);
            }
        }
        vl->update();
    }
}
Ejemplo n.º 16
0
Decorator::~Decorator()
{
  if (container) {
    removeWidget(container);
    delete container;
  }
}
Ejemplo n.º 17
0
bool WalletStack::removeWallet(const QString& name)
{
    if (mapWalletViews.count(name) == 0) return false;
    WalletView *walletView = mapWalletViews.take(name);
    removeWidget(walletView);
    return true;
}
Ejemplo n.º 18
0
DataWidget *WidgetArea::addWidget(QPoint pos, quint8 type, bool show)
{
    DataWidget *w = sWidgetFactory.getWidget(type, this);
    if(!w)
        return NULL;

    quint32 id = getNewId();
    w->setId(id);

    w->setUp(m_storage);

    w->move(pos);
    if(show)
        w->show();

    m_widgets.insert(id, w);

    connect(w,          SIGNAL(removeWidget(quint32)),              SLOT(removeWidget(quint32)));
    connect(w,          SIGNAL(updateMarker(DataWidget*)),          SLOT(updateMarker(DataWidget*)));
    connect(w,          SIGNAL(clearPlacementLines()),              SLOT(clearPlacementLines()));
    connect(w,          SIGNAL(updateData()),                       SIGNAL(updateData()));
    connect(w,   SIGNAL(mouseStatus(bool,data_widget_info,qint32)), SIGNAL(mouseStatus(bool,data_widget_info,qint32)));
    connect(w,          SIGNAL(SendData(QByteArray)),   m_analyzer, SIGNAL(SendData(QByteArray)));
    connect(w,          SIGNAL(toggleSelection(bool)),              SLOT(toggleSelection(bool)));
    connect(this,       SIGNAL(setTitleVisibility(bool)),        w, SLOT(setTitleVisibility(bool)));
    connect(w,  SIGNAL(addChildTab(ChildTab*,QString)), m_analyzer, SLOT(addChildTab(ChildTab*,QString)));
    connect(w,  SIGNAL(removeChildTab(ChildTab*)),      m_analyzer, SLOT(removeChildTab(ChildTab*)));
    connect(w,          SIGNAL(addUndoAct(UndoAction*)),&m_undoStack,SLOT(addAction(UndoAction*)));
    connect(m_analyzer, SIGNAL(rawData(QByteArray)),             w, SIGNAL(rawData(QByteArray)));
    connect(this,       SIGNAL(setLocked(bool)),                 w, SLOT(setLocked(bool)));

    //events
    connect(this,       SIGNAL(onWidgetAdd(DataWidget*)),        w, SLOT(onWidgetAdd(DataWidget*)));
    connect(this,       SIGNAL(onWidgetRemove(DataWidget*)),     w, SLOT(onWidgetRemove(DataWidget*)));
    connect(this,       SIGNAL(onScriptEvent(QString)),          w, SLOT(onScriptEvent(QString)));
    connect(this,       SIGNAL(onScriptEvent(QString,QVariantList)), w, SLOT(onScriptEvent(QString, QVariantList)));
    connect(w,          SIGNAL(scriptEvent(QString)),         this, SIGNAL(onScriptEvent(QString)));
    connect(w,          SIGNAL(scriptEvent(QString, QVariantList)),this, SIGNAL(onScriptEvent(QString, QVariantList)));

    emit onWidgetAdd(w);

    m_analyzer->setDataChanged();

    w->setTitleVisibility(m_actTitleVisibility->isChecked());
    return w;
}
Ejemplo n.º 19
0
    void kThreadClipView::clearClips(){
        for (int j=0; j<clips.size(); j++) {

            removeWidget( clips[j] );
            clips[j].reset();
        }
        clips.clear();
    }
Ejemplo n.º 20
0
void QTodoList::takeTodo(QTodoItem* item)
{
	item->hide();
	QTUM::get()->addChange(new QTodoChangeDelete(this,findWidget(item),new QTodoItem(*item)));
	dynamic_cast<QBoxLayout*>(vbox->layout())->remove(item);
	removeWidget(item);
	setModified();
}
Ejemplo n.º 21
0
void MainMenuDialog::reflowLayout() {
	if (_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime))
		_loadButton->setEnabled(_engine->canLoadGameStateCurrently());
	if (_engine->hasFeature(Engine::kSupportsSavingDuringRuntime))
		_saveButton->setEnabled(_engine->canSaveGameStateCurrently());

	// Overlay size might have changed since the construction of the dialog.
	// Update labels when it might be needed
	// FIXME: it might be better to declare GUI::StaticTextWidget::setLabel() virtual
	// and to reimplement it in GUI::ButtonWidget to handle the hotkey.
	if (g_system->getOverlayWidth() > 320)
		_rtlButton->setLabel(_rtlButton->cleanupHotkey(_("~R~eturn to Launcher")));
	else
		_rtlButton->setLabel(_rtlButton->cleanupHotkey(_c("~R~eturn to Launcher", "lowres")));

#ifndef DISABLE_FANCY_THEMES
	if (g_gui.xmlEval()->getVar("Globals.ShowGlobalMenuLogo", 0) == 1 && g_gui.theme()->supportsImages()) {
		if (!_logo)
			_logo = new GUI::GraphicsWidget(this, "GlobalMenu.Logo");
		_logo->useThemeTransparency(true);
		_logo->setGfx(g_gui.theme()->getImageSurface(GUI::ThemeEngine::kImageLogoSmall));

		GUI::StaticTextWidget *title = (GUI::StaticTextWidget *)findWidget("GlobalMenu.Title");
		if (title) {
			removeWidget(title);
			title->setNext(0);
			delete title;
		}
	} else {
		GUI::StaticTextWidget *title = (GUI::StaticTextWidget *)findWidget("GlobalMenu.Title");
		if (!title) {
			title = new GUI::StaticTextWidget(this, "GlobalMenu.Title", "ScummVM");
			title->setAlign(Graphics::kTextAlignCenter);
		}

		if (_logo) {
			removeWidget(_logo);
			_logo->setNext(0);
			delete _logo;
			_logo = 0;
		}
	}
#endif

	Dialog::reflowLayout();
}
Ejemplo n.º 22
0
void BakeWidget::cancelButtonClicked() {
    // the user wants to go back to the mode selection screen
    // remove ourselves from the stacked widget and call delete later so we'll be cleaned up
    auto stackedWidget = qobject_cast<QStackedWidget*>(parentWidget());
    stackedWidget->removeWidget(this);

    deleteLater();
}
Ejemplo n.º 23
0
void container_widget_t::clear_contents()
{
    if( contents_)
    {
		removeWidget( contents_);
		contents_ = 0;
    }
}
Ejemplo n.º 24
0
    void onNetwork() override {
        // If the app is shutting down, don't service network connections
        if (isNull(m_server)) {
            return;
        }

        // See if there are any new clients
        for (NetConnectionIterator& client = m_server->newConnectionIterator(); client.isValid(); ++client) {
            m_conversationArray.append(shared_ptr<Conversation>(new Conversation(this, client.connection())));

            // Tell this client who I am
            sendMyName(client.connection());
        }

        for (int c = 0; c < m_conversationArray.size(); ++c) {
            shared_ptr<Conversation> conversation = m_conversationArray[c];

            switch (conversation->connection->status()) {
            case NetConnection::WAITING_TO_CONNECT:
                // Still waiting for the server to accept us.
                break;

            case NetConnection::JUST_CONNECTED:
                // We've just connected to the server but never invoked send() or incomingMessageIterator().
                // Tell the server our name.
                sendMyName(conversation->connection);

                // Intentionally fall through

            case NetConnection::CONNECTED:
                // Read all incoming messages from all connections, regardless of who created them
                for (NetMessageIterator& msg = conversation->connection->incomingMessageIterator(); msg.isValid(); ++msg) {

                    BinaryInput& bi = msg.binaryInput();

                    switch (msg.type()) {
                    case TEXT:
                        conversation->lastTextReceived->setCaption(bi.readString32());
                        break;

                    case CHANGE_NAME:
                        conversation->name = bi.readString32();
                        conversation->window->setCaption(conversation->name);
                        break;
                    } // Dispatch on message type

                } // For each message
                break;

            case NetConnection::DISCONNECTED:
                // Remove this conversation from my list
                removeWidget(m_conversationArray[c]->window);
                m_conversationArray.fastRemove(c);
                --c;
                break;
            } // Switch status
        } // For each conversation
    }
/*!
	Displays the to-do viewer and populates the to-do entry attributes.

	\param entry Agenda entry from which attributes have to be read.
 */
void AgendaEventView::execute(AgendaEntry entry,
											AgendaEventViewer::Actions action)
{
    OstTraceFunctionEntry0( AGENDAEVENTVIEW_EXECUTE_ENTRY );

	mOriginalAgendaEntry = entry;
	mAgendaEntry = entry;
	
	// For later reference
	mParentId = mOwner->mAgendaUtil->parentEntry(mAgendaEntry).id();
	
	// Add the viewer data reading from the agenda entry.
	addViewerData();
	
	// Remove unnecessary widget from event viewer.
	removeWidget();
	
	// Add the menu items to event viewer.
	addMenuItem();
	
	// Add the toolbar items to event viewer
	addToolBarItem(action);

	// Connect for the entry updation and addtion signal to refresh the view
	// when the same is edited in editor.
	connect(mOwner->mAgendaUtil, SIGNAL(entryUpdated(ulong)),
				this, SLOT(handleEntryUpdation(ulong)));
	
	connect(mOwner->mAgendaUtil, SIGNAL(entryAdded(ulong)),
				this, SLOT(handleEntryUpdation(ulong)));

	// Connect for entry deletion signal to close the event viewer.
	connect(mOwner->mAgendaUtil, SIGNAL(entryDeleted(ulong)), this,
	        SLOT(handleEntryDeletion(ulong)));

	// Add the view to the main window.
	HbMainWindow *window = hbInstance->allMainWindows().first();
	if (!window) {
		// Might be some non-ui based app called us
		// so create mainwindow now
		mMainWindow = new HbMainWindow();
		mMainWindow->addView(mViewer);
		mMainWindow->setCurrentView(mViewer);
	    connect(mMainWindow,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation)));
	} else {
		window->addView(mViewer);
		window->setCurrentView(mViewer);
		connect(window,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation)));
	}
	
	// Add softkey after adding view on window
	mBackAction = new HbAction(Hb::BackNaviAction);
	mViewer->setNavigationAction(mBackAction);
		
	connect(mBackAction, SIGNAL(triggered()), this, SLOT(close()));

	OstTraceFunctionExit0( AGENDAEVENTVIEW_EXECUTE_EXIT );
}
Ejemplo n.º 26
0
void LabelLayout::ClearLabels()
{
    for(quint32 i = 0; i < m_labels.size(); ++i)
    {
        removeWidget(m_labels[i]);
        setLabelFreed(m_labels[i]);
    }
    m_labels.clear();
}
Ejemplo n.º 27
0
void GUIManager::destroyWidget(Widget* widget)
{
	if (!widget) {
		S_LOG_WARNING("Trying to destroy null widget.");
		return;
	}
	removeWidget(widget);
	delete widget;
}
Ejemplo n.º 28
0
void StackedWidgetView::removeRows(const QModelIndex &parent, int start, int end)
{
    for (int i = start; i <= end; ++i) {
        QWidget *w = m_model->index(i, 0, parent).data(m_widgetRole).value<QWidget *>();
        if (w) {
            removeWidget(w);
        }
    }
}
/**
 * Close the current tab.
 */
void DTabbedMainWindow::closeCurrentTab()
{
    int index = m_tabWidget->currentIndex();

    if ( index >= 0 )
    {
        removeWidget(m_tabWidget->widget(index));
    }
}
Ejemplo n.º 30
0
void ToolBar::updated ( ArenaWidget *awgt ) {
    if (!awgt)
        return;
    
    if ( awgt->state() & ArenaWidget::Hidden ) {
        removeWidget ( awgt );
    } else if ( !map.contains(awgt)) {
        insertWidget ( awgt );
    }
}