コード例 #1
0
void FolderItemPropertiesWidget::sl_ResetIconToDefaultButton_Clicked() {
	Document* doc = Application::I()->CurrentDocument();
	if (doc == 0) {
		WARNING("Current document is 0");
		return;
	}

	if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Folder) {
		iconLabel->setPixmap(doc->GetItemIcon(doc->GetDefaultFolderIcon()));
		selectedIconKey = doc->GetDefaultFolderIcon();
	} else if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Note) {
		iconLabel->setPixmap(doc->GetItemIcon(doc->GetDefaultNoteIcon()));
		selectedIconKey = doc->GetDefaultNoteIcon();
	}
}
コード例 #2
0
void FolderItemPropertiesWidget::sl_ChooseIconButton_Clicked() {
	if (!itemToEdit) {
		WARNING("Null pointer recieved");
		reject();
	}

	if (!customIconsWidget) {
		customIconsWidget = new CustomIconsListWidget(this);
	}

	if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Folder) {
		Folder* f = dynamic_cast<Folder*>(itemToEdit);
		customIconsWidget->SelectIcon(f->GetIconID());
	} else if (itemToEdit->GetItemType() == AbstractFolderItem::Type_Note) {
		Note* n = dynamic_cast<Note*>(itemToEdit);
		customIconsWidget->SelectIcon(n->GetIconID());
	}

	if (customIconsWidget->exec() != QDialog::Accepted) {return;}

	Document* doc = Application::I()->CurrentDocument();
	if (doc == 0) {
		WARNING("Current document is 0");
		return;
	}

	selectedIconKey = customIconsWidget->SelectedIconKey;
	iconLabel->setPixmap(doc->GetItemIcon(selectedIconKey));
}