void SludgeProjectManager::postNew()
{
	GtkWidget *dialog;
	GtkFileFilter *filter;
	gboolean success = FALSE;

	dialog = gtk_file_chooser_dialog_new("New SLUDGE Project",
				      NULL,
				      GTK_FILE_CHOOSER_ACTION_SAVE,
				      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
				      GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
				      NULL);
	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER (dialog), TRUE);

	filter = gtk_file_filter_new();
	gtk_file_filter_set_name(filter, getFilterName());
	gtk_file_filter_add_pattern(filter, getFilterPattern());
	gtk_file_chooser_set_filter(GTK_FILE_CHOOSER (dialog), filter);

	gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), getUntitledFilename());

	if (currentFolder[0] != 0)
	{
		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), currentFolder);
	}

	if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
	{
		char *filename;
		filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
		flipBackslashes(&filename);

		doNewProject(filename, fileList, &fileListNum);
		listChanged(FILE_TREEVIEW);
		listChanged(RESOURCE_TREEVIEW);
		gtk_list_store_clear(errorsListStore);
		gtk_widget_set_sensitive(projectRunGameItem, FALSE);

		setFilename(filename);
		setFolderFromFilename(filename);

		g_free(filename);
		success = TRUE;
	}
	gtk_widget_destroy(dialog);

	if (success)
		on_project_settings();

	setupButtons();
}
Esempio n. 2
0
void CdListen::updateList()
{
	if ( newList==currentList ) return;

	currentList = newList;
	emit listChanged( currentList );
}
RKSettingsModulePlugins::RKSettingsModulePlugins (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
	QVBoxLayout *main_vbox = new QVBoxLayout (this, RKGlobals::marginHint ());
	
	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
	
	QLabel *label = new QLabel (i18n ("Some plugins are available with both, a wizard-like interface and a traditional dialog interface. If both are available, which mode of presentation do you prefer?"), this);
	label->setAlignment (Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak);
	main_vbox->addWidget (label);
	
	button_group = new QButtonGroup (this);
	button_group->setColumnLayout (0, Qt::Vertical);
	button_group->layout()->setSpacing (6);
	button_group->layout()->setMargin (11);
	QVBoxLayout *group_layout = new QVBoxLayout(button_group->layout());
	group_layout->addWidget (new QRadioButton (i18n ("Always prefer dialogs"), button_group));
	group_layout->addWidget (new QRadioButton (i18n ("Prefer recommended interface"), button_group));
	group_layout->addWidget (new QRadioButton (i18n ("Always prefer wizards"), button_group));
	button_group->setButton (static_cast<int> (interface_pref));
	connect (button_group, SIGNAL (clicked (int)), this, SLOT (buttonClicked (int)));
	main_vbox->addWidget (button_group);
	
	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
	
	map_choser = new MultiStringSelector (i18n ("Select .pluginmap file(s)"), this);
	map_choser->setValues (plugin_maps);
	connect (map_choser, SIGNAL (getNewStrings (QStringList*)), this, SLOT (browseRequest (QStringList*)));
	connect (map_choser, SIGNAL (listChanged ()), this, SLOT (pathsChanged ()));
	main_vbox->addWidget (map_choser);

	main_vbox->addStretch ();
}
Esempio n. 4
0
void QTodoLists::removeCurrent()
{
	if(QTodoListViewItem* item = currentListItem())
	{
		QTodoRadioDialog radio_dialog(tr("Remove list"),tr("You are about to remove the %1-list").arg(item->listWidget()->getHeader()->getName()));
		radio_dialog.setIcon(QTP::yellow_minus.s(12,12));	

		radio_dialog.add(QTP::hdd,tr("Remove from filesystem"),LRID_FILESYSTEM);
		radio_dialog.add(QTP::todo_list.s(32,32),tr("Remove from QTodo"),LRID_QTODO);
		if(radio_dialog.exec() != QDialog::Accepted)
			return;

		QString file;
		switch(radio_dialog.selected())
		{
			case LRID_FILESYSTEM:
				file = item->listWidget()->getFile();
			case LRID_QTODO:
				QTUM::get()->deleteUndosRelatedToList(item->list());
				delete item->listWidget();
				delete item;
				if(firstChild())
					setSelected(firstChild(),true);
				else
					emit listChanged();
				if(!file.isEmpty())
					QFile::remove(file);
				break;
		}
	}
}
void GofunListWidget::remove()
{
	if(list->selectedItem())
		delete list->selectedItem();
		
	emit listChanged();
}
void SludgeProjectManager::on_files_tree_selection_changed(GtkTreeSelection *theSelection)
{
	GList * selectedRows;
    GtkTreeIter iter;
    GtkTreeModel *model;
    gchar *tx, *tx1;

	clearFileList(resourceList, &numResources);
	if (currentFilename[0] == 0)
		return;
	getSourceDirFromName(currentFilename);

	selectedRows = gtk_tree_selection_get_selected_rows(theSelection, &model);

	for (int j = 0; j < g_list_length(selectedRows); j++)
	{
		gtk_tree_model_get_iter(model, &iter, (GtkTreePath *)g_list_nth(selectedRows, j)->data);
		gtk_tree_model_get(model, &iter, 0, &tx1, -1);
		tx = g_locale_from_utf8(tx1, -1, NULL, NULL, NULL);
		g_free(tx1);
		populateResourceList(tx, resourceList, &numResources);
		g_free(tx);

		gtk_widget_set_sensitive(removeFileButton, TRUE);
	}
	if (g_list_length(selectedRows) == 0) {
		gtk_widget_set_sensitive(removeFileButton, FALSE);
	}
	g_list_foreach(selectedRows, (GFunc) gtk_tree_path_free, NULL);
	g_list_free(selectedRows);

	listChanged(RESOURCE_TREEVIEW);
}
Esempio n. 7
0
void RSSEditor::slotEditSite()
{
    QMutexLocker locker(&m_lock);

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();

    RSSSite *site = qVariantValue<RSSSite *>(m_sites->GetItemCurrent()->GetData());

    if (site)
    {
        RSSEditPopup *rsseditpopup = new RSSEditPopup(site->GetURL(), true, mainStack, "rsseditpopup");

        if (rsseditpopup->Create())
        {
            connect(rsseditpopup, SIGNAL(saving()), this,
                           SLOT(listChanged()));

            mainStack->AddScreen(rsseditpopup);
        }
        else
        {
            delete rsseditpopup;
        }
    }
}
Esempio n. 8
0
TimeTable::TimeTable(QWidget *parent) :
    TaskList(parent)
{
    QObject::connect(this, SIGNAL(listChanged()),
                          this, SLOT(refresh()));
    addEmptyItem();
}
void GuiScrollbar::ScrollByButton(GuiTrigger *t)
{
	static int pressedPosition = -1;

	if(!t->wpad.ir.valid || ScrollState < ButtonScrollSpeed-ButtonScrollSpeed*fabs(pressedPosition-t->wpad.ir.y)/250.f)
		return;

	if(pressedChan == -1 && ((t->wpad.btns_d & ButtonScroll) || (t->wupcdata.btns_d & ButtonScroll) ) &&
	   parentElement && parentElement->IsInside(t->wpad.ir.x, t->wpad.ir.y))
	{
		pressedPosition = t->wpad.ir.y;
		pressedChan = t->chan;
		oneButtonScrollImg->SetPosition(t->wpad.ir.x-oneButtonScrollImg->GetWidth()/2, t->wpad.ir.y-oneButtonScrollImg->GetHeight()/2);
	}

	if(pressedChan == t->chan && ((t->wpad.btns_h & ButtonScroll) || (t->wupcdata.btns_h & ButtonScroll) ))
	{
		if(pressedPosition-oneButtonScrollImg->GetHeight()/2 > t->wpad.ir.y)
			ScrollOneUp();
		else if(pressedPosition+oneButtonScrollImg->GetHeight()/2 < t->wpad.ir.y)
			ScrollOneDown();

		ScrollState = 0;
		listChanged(SelItem, SelInd);
	}

	if(pressedChan == t->chan && !t->wpad.btns_d && !t->wpad.btns_h && !t->wupcdata.btns_d && !t->wupcdata.btns_h)
	{
		pressedChan = -1;
		pressedPosition = -1;
	}
}
void GuiScrollbar::CheckDPadControls(GuiTrigger *t)
{
	if(t->Up())
	{
		ScrollOneUp();
		listChanged(SelItem, SelInd);
		MovePointer = true;
	}
	else if(t->Down())
	{
		ScrollOneDown();
		listChanged(SelItem, SelInd);
		MovePointer = true;
	}
	else if(t->Left() && Mode == LISTMODE)
	{
		SelInd -= PageSize;
		if(SelInd < 0)
		{
			SelInd = 0;
			SelItem = 0;
		}
		listChanged(SelItem, SelInd);
		MovePointer = true;
	}
	else if(t->Right() && Mode == LISTMODE)
	{
		SelInd += PageSize;
		if(SelInd+PageSize >= EntrieCount)
		{
			SelInd = MAX(EntrieCount-PageSize, 0);
			SelItem = LIMIT(PageSize-1, 0, EntrieCount-1);
		}
		listChanged(SelItem, SelInd);
		MovePointer = true;
	}
	
	if(MovePointer)
	{
		int selHeight = (arrowDownBtn->GetTop()+arrowDownBtn->GetHeight()-arrowUpBtn->GetTop())/PageSize;
		int position = arrowUpBtn->GetTop()+(selHeight*SelItem)+(selHeight/2);
		for (int i = 3; i >= 0; i--)
			pointer[i]->SetPosition(scrollbarBoxBtn->GetLeft()-22, position, 0);
		MovePointer = false;
	}
}
void GuiScrollbar::SetEntrieCount(int cnt)
{
	if(EntrieCount == cnt)
		return;

	EntrieCount = cnt;
	listChanged(SelItem, SelInd);
}
void GuiScrollbar::SetSelectedIndex(int pos)
{
	if(SelInd == pos)
		return;

	SelInd = pos;
	listChanged(SelItem, SelInd);
}
void GuiScrollbar::SetRowSize(int size)
{
	if(RowSize == size)
		return;

	RowSize = size;
	listChanged(SelItem, SelInd);
}
void GuiScrollbar::SetPageSize(int size)
{
	if(PageSize == size)
		return;

	PageSize = size;
	listChanged(SelItem, SelInd);
}
Esempio n. 15
0
QTodoLists::QTodoLists(QWidget* parent) : QListView(parent)
{
	connect(this,SIGNAL(contextMenuRequested(QListViewItem * , const QPoint & , int )),this,SLOT(contextMenu(QListViewItem * , const QPoint & , int )));
	connect(this,SIGNAL(selectionChanged()),this,SLOT(listChange()));
	connect(this,SIGNAL(listChanged()),this,SLOT(prepareList()));

	current = 0;
}
Esempio n. 16
0
PaintBoard::PaintBoard(QWidget *parent): QWidget(parent)
{
   this->lista =0;
   this->currentFigura = 0; // Valida es de 0 en adelante

    pix = new QPixmap(geometry().width(), geometry().height());
    connect(this, SIGNAL(listChanged()), this, SLOT(update()));
}
Esempio n. 17
0
void TrackListModel::clear()
{
    beginResetModel();
    m_tracks.clear();
    endResetModel();

    emit listChanged();
}
void GofunListWidget::fillList(const QStringList& _list)
{
	for(QStringList::ConstIterator it = _list.begin(); it != _list.end(); ++it)
	{
		new QListViewItem(list,(*it));
	}
	
	emit listChanged();
}
void GofunListWidget::updateValue(const QString& text)
{
	if(!list->selectedItem())
		return;
	
	list->selectedItem()->setText(0,text);
	
	emit listChanged();
}
Esempio n. 20
0
void InputSettingsWindow::setup() {
  panel = new QWidget;

  layout = new QVBoxLayout;
  layout->setMargin(0);
  layout->setSpacing(0);

  title = new QLabel("Input Configuration Editor");
  title->setProperty("class", "title");
  layout->addWidget(title);

  selection = new QHBoxLayout; {
    port = new QComboBox;
    port->addItem("Controller Port 1");
    port->addItem("Controller Port 2");
    port->addItem("User Interface");
    selection->addWidget(port);

    device = new QComboBox;
    selection->addWidget(device);
  }
  selection->setSpacing(Style::WidgetSpacing);
  layout->addLayout(selection);
  layout->addSpacing(Style::WidgetSpacing);

  list = new QTreeWidget;
  list->setColumnCount(3);
  list->setHeaderLabels(QStringList() << "Hidden" << "Name" << "Assignment");
  list->hideColumn(0);  //used for default sorting + hides child expansion box
  layout->addWidget(list);
  layout->addSpacing(Style::WidgetSpacing);

  controls = new QHBoxLayout; {
    assign = new QPushButton("Assign ...");
    controls->addWidget(assign);

    assignAll = new QPushButton("Assign All ...");
    controls->addWidget(assignAll);

    unassign = new QPushButton("Unassign");
    controls->addWidget(unassign);
  }
  controls->setSpacing(Style::WidgetSpacing);
  layout->addLayout(controls);

  panel->setLayout(layout);
  connect(port, SIGNAL(currentIndexChanged(int)), this, SLOT(portChanged()));
  connect(device, SIGNAL(currentIndexChanged(int)), this, SLOT(reloadList()));
  connect(list, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(assignKey()));
  connect(list, SIGNAL(itemSelectionChanged()), this, SLOT(listChanged()));
  connect(assign, SIGNAL(released()), this, SLOT(assignKey()));
  connect(assignAll, SIGNAL(released()), this, SLOT(assignAllKeys()));
  connect(unassign, SIGNAL(released()), this, SLOT(unassignKey()));

  portChanged();
}
void GuiScrollbar::OnDownButtonHold(GuiButton *sender, int pointer, const POINT &p)
{
	if(ScrollState < ScrollSpeed)
		return;

	ScrollOneDown();

	ScrollState = 0;
	listChanged(SelItem, SelInd);
}
void GofunListWidget::down()
{
    if (!list->currentItem())
        return;
    if (list->currentItem()->nextSibling() == 0)
        return;

    list->currentItem()->moveItem(list->currentItem()->nextSibling()); 
    
	emit listChanged();
}
Esempio n. 23
0
void PrivacyDlg::changeList_succeeded()
{
	// If we just deleted a list, select the first list
	if (model_.list().isEmpty()) {
		ui_.cb_lists->setCurrentIndex(0);
		listChanged();
	}
	else {
		setWidgetsEnabled(true);
	}
}
Esempio n. 24
0
bool PlayListModel::setCurrent(int c)
{
    if (c > count()-1 || c < 0)
    {
        return FALSE;
    }
    current_ = c;
    current_item_ = items_.at(c);
    emit currentChanged();
    emit listChanged();
    return TRUE;
}
Esempio n. 25
0
void RSSEditor::doDeleteSite(bool remove)
{
    QMutexLocker locker(&m_lock);

    if (!remove)
        return;

    RSSSite *site = qVariantValue<RSSSite *>(m_sites->GetItemCurrent()->GetData());

    if (removeFromDB(site))
        listChanged();
}
CtrlrModulatorListProperty::CtrlrModulatorListProperty(const Value &_valueToControl, CtrlrPanel *_owner) 
	: owner(_owner), valueToControl(_valueToControl)
{
	addAndMakeVisible (combo = new ComboBox (String::empty));
    combo->setEditableText (false);
    combo->setJustificationType (Justification::centredLeft);
    combo->setTextWhenNothingSelected (COMBO_ITEM_NONE);
    combo->setTextWhenNoChoicesAvailable ("No modulators");
    combo->addListener (this);

	listChanged();
}
Esempio n. 27
0
void QTodoLists::listChange()
{
	if(current != currentListItem())
	{
		current = currentListItem();
		emit listChanged();
	}
	if(QTodoListViewItemSection* item = dynamic_cast<QTodoListViewItemSection*>(selectedItem()))
	{
		currentList()->setContentsPos(0,item->section()->y());
	}
}
void SludgeProjectManager::update_compile_window()
{
	char intbuf[100];

	compilerInfo *info = (compilerInfo *) g_async_queue_pop(compilerInfoQueue);

	if (info->progress1 > -1.)
		gtk_progress_bar_set_fraction(compProgress1, info->progress1);
	if (info->progress2 > -1.)
		gtk_progress_bar_set_fraction(compProgress2, info->progress2);
	if (info->task[0] != 0)
		gtk_label_set_text(compTask, info->task);
	if (info->file[0] != 0)
		gtk_label_set_text(compFile, info->file);
	if (info->item[0] != 0)
		gtk_label_set_text(compItem, info->item);
	if (info->funcs > -1) {
		sprintf(intbuf, "%i", info->funcs);
		gtk_label_set_text(compFuncs, intbuf);
	}
	if (info->objs > -1) {
		sprintf(intbuf, "%i", info->objs);
		gtk_label_set_text(compObjs, intbuf);
	}
	if (info->globs > -1) {
		sprintf(intbuf, "%i", info->globs);
		gtk_label_set_text(compGlobs, intbuf);
	}
	if (info->strings > -1) {
		sprintf(intbuf, "%i", info->strings);
		gtk_label_set_text(compStrings, intbuf);
	}
	if (info->resources > -1) {
		sprintf(intbuf, "%i", info->resources);
		gtk_label_set_text(compResources, intbuf);
	}
	if (info->newComments) {
		listChanged(ERROR_TREEVIEW);
	}
	if (info->finished) {
		gtk_label_set_text(compFile, "");
		gtk_label_set_text(compItem, "");
		gtk_widget_set_sensitive(closeCompilerButton, TRUE);
		if (info->success) {
			gtk_widget_set_sensitive(runGameButton, TRUE);
			gtk_widget_set_sensitive(projectRunGameItem, TRUE);
		} else {
			gtk_widget_set_sensitive(projectRunGameItem, FALSE);
		}
	}
	delete info;
}
Esempio n. 29
0
void 
MostRecentTests::setTestToRun( CPPUNIT_NS::Test *test )
{
  m_tests.removeRef( test );
  m_tests.prepend( test );

  const int maxRecentTest = 20;
  if ( m_tests.count() > maxRecentTest )
    m_tests.remove( maxRecentTest );

  emit listChanged();
  emit testToRunChanged( testToRun() );
}
Esempio n. 30
0
File: phrase.cpp Progetto: Suneal/qt
bool PhraseBook::load(const QString &fileName, bool *langGuessed)
{
    QFile f(fileName);
    if (!f.open(QIODevice::ReadOnly))
        return false;

    m_fileName = fileName;

    QXmlInputSource in(&f);
    QXmlSimpleReader reader;
    // don't click on these!
    reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), false);
    reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), true);
    reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace"
                                    "-only-CharData"), false);
    QphHandler *hand = new QphHandler(this);
    reader.setContentHandler(hand);
    reader.setErrorHandler(hand);

    bool ok = reader.parse(in);
    reader.setContentHandler(0);
    reader.setErrorHandler(0);

    Translator::languageAndCountry(hand->language(), &m_language, &m_country);
    *langGuessed = false;
    if (m_language == QLocale::C) {
        QLocale sys;
        m_language = sys.language();
        m_country = sys.country();
        *langGuessed = true;
    }

    QString lang = hand->sourceLanguage();
    if (lang.isEmpty()) {
        m_sourceLanguage = QLocale::C;
        m_sourceCountry = QLocale::AnyCountry;
    } else {
        Translator::languageAndCountry(lang, &m_sourceLanguage, &m_sourceCountry);
    }

    delete hand;
    f.close();
    if (!ok) {
        qDeleteAll(m_phrases);
        m_phrases.clear();
    } else {
        emit listChanged();
    }

    return ok;
}