Ejemplo n.º 1
0
void PdfViewer::createActions()
{
	// File
    m_fileOpenAction = new QAction(Icon("document-open"), tr("&Open...", "Action: open file"), this);
#ifndef QT_NO_SHORTCUT
    m_fileOpenAction->setShortcut(QKeySequence::Open);
#endif // QT_NO_SHORTCUT
	m_fileOpenAction->setObjectName("file_open");
	connect(m_fileOpenAction, SIGNAL(triggered()), this, SLOT(slotOpenFile()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_fileOpenAction);
#endif // QT_NO_SHORTCUT

    m_ReloadDocAction = new QAction(Icon("reload3"), tr("Re&load...", "Action: reload file"), this);
#ifndef QT_NO_SHORTCUT
    m_ReloadDocAction->setShortcut(tr("Ctrl+L"));
#endif // QT_NO_SHORTCUT
    m_ReloadDocAction->setObjectName("file_reload");
    connect(m_ReloadDocAction, SIGNAL(triggered()), this, SLOT(slotReload()));
#ifndef QT_NO_SHORTCUT
    ShortcutHandler::instance()->addAction(m_ReloadDocAction);
#endif // QT_NO_SHORTCUT

    m_fileSaveCopyAction = new QAction(Icon("document-save-as"), tr("&Save a Copy...", "Action: save a copy of the open file"), this);
#ifndef QT_NO_SHORTCUT
    m_fileSaveCopyAction->setShortcut(tr("Ctrl+Shift+S"));
#endif // QT_NO_SHORTCUT
    m_fileSaveCopyAction->setEnabled(false);
	m_fileSaveCopyAction->setObjectName("file_save_copy");
	connect(m_fileSaveCopyAction, SIGNAL(triggered()), this, SLOT(slotSaveCopy()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_fileSaveCopyAction);
#endif // QT_NO_SHORTCUT

	m_printAction = m_pdfView->action(PdfView::Print);
	m_printAction->setIcon(Icon("document-print"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_printAction);
#endif // QT_NO_SHORTCUT

    m_quitAction = new QAction(Icon("application-exit"), tr("&Quit", "Action: quit the application"), this);
#ifndef QT_NO_SHORTCUT
    m_quitAction->setShortcut(QKeySequence::Quit);
#endif // QT_NO_SHORTCUT
	m_quitAction->setObjectName("application_exit");
//	connect(m_quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
	connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_quitAction);
#endif // QT_NO_SHORTCUT

	// Edit
	m_findAction = new QAction(Icon("edit-find"), tr("&Find...", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_findAction->setShortcut(QKeySequence::Find);
#endif // QT_NO_SHORTCUT
	m_findAction->setEnabled(false);
	m_findAction->setObjectName("edit_find");
	connect(m_findAction, SIGNAL(triggered()), this, SLOT(slotFind()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_findAction);
#endif // QT_NO_SHORTCUT

	m_findNextAction = new QAction(tr("Find &Next", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_findNextAction->setShortcut(QKeySequence::FindNext);
#endif // QT_NO_SHORTCUT
	m_findNextAction->setEnabled(false);
	m_findNextAction->setObjectName("edit_find_next");
	connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(slotFindNext()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_findNextAction);
#endif // QT_NO_SHORTCUT

	m_findPreviousAction = new QAction(tr("Find &Previous", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_findPreviousAction->setShortcut(QKeySequence::FindPrevious);
#endif // QT_NO_SHORTCUT
	m_findPreviousAction->setEnabled(false);
	m_findPreviousAction->setObjectName("edit_find_previous");
	connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(slotFindPrevious()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_findPreviousAction);
#endif // QT_NO_SHORTCUT

	// View
	m_zoomInAction = m_pdfView->action(PdfView::ZoomIn);
	m_zoomInAction->setIcon(Icon("zoom-in"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_zoomInAction);
#endif // QT_NO_SHORTCUT

	m_zoomOutAction = m_pdfView->action(PdfView::ZoomOut);
	m_zoomOutAction->setIcon(Icon("zoom-out"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_zoomOutAction);
#endif // QT_NO_SHORTCUT

	m_zoomAction = m_pdfView->action(PdfView::Zoom);

	m_showPresentationAction = new QAction(Icon("view-presentation"), tr("P&resentation", "Action"), this);
#ifndef QT_NO_SHORTCUT
	m_showPresentationAction->setShortcut(tr("Ctrl+Shift+P"));
#endif // QT_NO_SHORTCUT
	m_showPresentationAction->setEnabled(false);
	m_showPresentationAction->setObjectName("view_presentation");
	connect(m_showPresentationAction, SIGNAL(triggered()), this, SLOT(slotShowPresentation()));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_showPresentationAction);
#endif // QT_NO_SHORTCUT

	// Go
	m_goToStartAction = m_pdfView->action(PdfView::GoToStartOfDocument);
	m_goToStartAction->setIcon(Icon("go-first"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToStartAction);
#endif // QT_NO_SHORTCUT

	m_goToEndAction = m_pdfView->action(PdfView::GoToEndOfDocument);
	m_goToEndAction->setIcon(Icon("go-last"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToEndAction);
#endif // QT_NO_SHORTCUT

	m_goToPreviousPageAction = m_pdfView->action(PdfView::GoToPreviousPage);
	m_goToPreviousPageAction->setIcon(Icon("go-previous"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToPreviousPageAction);
#endif // QT_NO_SHORTCUT

	m_goToNextPageAction = m_pdfView->action(PdfView::GoToNextPage);
	m_goToNextPageAction->setIcon(Icon("go-next"));
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_goToNextPageAction);
#endif // QT_NO_SHORTCUT

	m_goToPageAction = m_pdfView->action(PdfView::GoToPage);

    m_amkhlvDnAction = m_pdfView->action(PdfView::AmkhlvDn);
    m_amkhlvUpAction = m_pdfView->action(PdfView::AmkhlvUp);
    m_amkhlvDnFAction = m_pdfView->action(PdfView::AmkhlvDnF);
    m_amkhlvUpFAction = m_pdfView->action(PdfView::AmkhlvUpF);
    m_amkhlvRtAction = m_pdfView->action(PdfView::AmkhlvRt);
    m_amkhlvLtAction = m_pdfView->action(PdfView::AmkhlvLt);
    m_amkhlvRtFAction = m_pdfView->action(PdfView::AmkhlvRtF);
    m_amkhlvLtFAction = m_pdfView->action(PdfView::AmkhlvLtF);
    m_ReturnBackAction = m_pdfView->action(PdfView::ReturnBack);
    m_ReturnBackAction->setIcon(Icon("stock_undo"));

#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_amkhlvDnAction);
	ShortcutHandler::instance()->addAction(m_amkhlvDnFAction);
	ShortcutHandler::instance()->addAction(m_amkhlvRtAction);
	ShortcutHandler::instance()->addAction(m_amkhlvRtFAction);
#endif // QT_NO_SHORTCUT
#ifndef QT_NO_SHORTCUT
	ShortcutHandler::instance()->addAction(m_amkhlvUpAction);
	ShortcutHandler::instance()->addAction(m_amkhlvUpFAction);
	ShortcutHandler::instance()->addAction(m_amkhlvLtAction);
	ShortcutHandler::instance()->addAction(m_amkhlvLtFAction);
    ShortcutHandler::instance()->addAction(m_ReturnBackAction);
    ShortcutHandler::instance()->addAction(m_ReloadDocAction);
#endif // QT_NO_SHORTCUT


	// Tools
	m_mouseBrowseAction = m_pdfView->action(PdfView::MouseToolBrowse);
	m_mouseBrowseAction->setIcon(Icon("input-mouse"));
#ifndef QT_NO_SHORTCUT
	m_mouseBrowseAction->setShortcut(tr("Ctrl+1"));
	ShortcutHandler::instance()->addAction(m_mouseBrowseAction);
#endif // QT_NO_SHORTCUT

	m_mouseMagnifyAction = m_pdfView->action(PdfView::MouseToolMagnify);
	m_mouseMagnifyAction->setIcon(Icon("page-zoom"));
#ifndef QT_NO_SHORTCUT
	m_mouseMagnifyAction->setShortcut(tr("Ctrl+2"));
	ShortcutHandler::instance()->addAction(m_mouseMagnifyAction);
#endif // QT_NO_SHORTCUT

	m_mouseSelectionAction = m_pdfView->action(PdfView::MouseToolSelection);
	m_mouseSelectionAction->setIcon(Icon("select-rectangular"));
#ifndef QT_NO_SHORTCUT
	m_mouseSelectionAction->setShortcut(tr("Ctrl+3"));
	ShortcutHandler::instance()->addAction(m_mouseSelectionAction);
#endif // QT_NO_SHORTCUT

	m_mouseTextSelectionAction = m_pdfView->action(PdfView::MouseToolTextSelection);
	m_mouseTextSelectionAction->setIcon(Icon("draw-text"));
#ifndef QT_NO_SHORTCUT
	m_mouseTextSelectionAction->setShortcut(tr("Ctrl+4"));
	ShortcutHandler::instance()->addAction(m_mouseTextSelectionAction);
#endif // QT_NO_SHORTCUT

	// Settings
    m_settingsTextAAAction = new QAction(tr("&Text Antialias", "Action: enable/disable antialias"), this);
    m_settingsTextAAAction->setCheckable(true);
    connect(m_settingsTextAAAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleTextAA(bool)));

    m_settingsGfxAAAction = new QAction(tr("&Graphics Antialias", "Action: enable/disable antialias"), this);
    m_settingsGfxAAAction->setCheckable(true);
    connect(m_settingsGfxAAAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleGfxAA(bool)));

	QMenu *settingsRenderMenu = new QMenu(tr("&Render Backend", "Menu title"), this);
	m_settingsRenderBackendGrp = new QActionGroup(settingsRenderMenu);
	m_settingsRenderBackendGrp->setExclusive(true);
	QAction *action = settingsRenderMenu->addAction(tr("&Splash", "Action: select render backend"));
	action->setCheckable(true);
	action->setChecked(true);
	action->setData(qVariantFromValue(int(Poppler::Document::SplashBackend)));
	m_settingsRenderBackendGrp->addAction(action);
	action = settingsRenderMenu->addAction(tr("&Arthur", "Action: select render backend"));
	action->setCheckable(true);
	action->setData(qVariantFromValue(int(Poppler::Document::ArthurBackend)));
	m_settingsRenderBackendGrp->addAction(action);
	connect(m_settingsRenderBackendGrp, SIGNAL(triggered(QAction*)), this, SLOT(slotRenderBackend(QAction*)));
	m_renderBackendAction = new QAction(tr("&Render Backend", "Menu title"), this);
	m_renderBackendAction->setMenu(settingsRenderMenu);

	m_configureAction = new QAction(Icon("configure"), tr("&Configure %1...", "Action: show configuration dialog").arg(QCoreApplication::applicationName()), this);
	connect(m_configureAction, SIGNAL(triggered()), this, SLOT(slotConfigure()));
}
Ejemplo n.º 2
0
OnlineServicesPage::OnlineServicesPage(QWidget *p)
    : QWidget(p)
    , onlineSearchRequest(false)
    , searchable(true)
    , expanded(false)
{
    setupUi(this);
    addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction);
    replacePlayQueue->setDefaultAction(StdActions::self()->replacePlayQueueAction);
    view->addAction(StdActions::self()->addToPlayQueueAction);
    view->addAction(StdActions::self()->replacePlayQueueAction);
    view->addAction(StdActions::self()->addWithPriorityAction);
    view->addAction(StdActions::self()->addToStoredPlaylistAction);
    downloadAction = new Action(Icon("go-down"), i18n("Download To Library"), this);
    downloadPodcastAction = new Action(Icon("go-down"), i18n("Download Episodes"), this);
    deleteDownloadedPodcastAction = new Action(Icon("edit-delete"), i18n("Delete Downloaded Episodes"), this);
    cancelPodcastDownloadAction = new Action(Icons::self()->cancelIcon, i18n("Cancel Podcast Download"), this);
    markPodcastAsNewAction = new Action(Icon("document-new"), i18n("Mark Episodes As New"), this);
    markPodcastAsListenedAction = new Action(i18n("Mark Episodes As Listened"), this);

    connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8)));
    connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &)));
    connect(genreCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(searchItems()));
    connect(OnlineServicesModel::self(), SIGNAL(updateGenres(const QSet<QString> &)), genreCombo, SLOT(update(const QSet<QString> &)));
    connect(OnlineServicesModel::self(), SIGNAL(updated(QModelIndex)), this, SLOT(updated(QModelIndex)));
//    connect(OnlineServicesModel::self(), SIGNAL(needToSort()), this, SLOT(sortList()));
    connect(OnlineServicesModel::self(), SIGNAL(busy(bool)), view, SLOT(showSpinner(bool)));
    connect(OnlineServicesModel::self(), SIGNAL(providersChanged()), this, SLOT(providersChanged()));
    connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &)));
    connect(view, SIGNAL(searchItems()), this, SLOT(searchItems()));
    connect(view, SIGNAL(searchIsActive(bool)), this, SLOT(controlSearch(bool)));
    connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions()));
    connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(updateGenres(QModelIndex)));
    connect(view, SIGNAL(rootIndexSet(QModelIndex)), this, SLOT(setSearchable(QModelIndex)));
    connect(OnlineServicesModel::self()->configureAct(), SIGNAL(triggered()), this, SLOT(configureService()));
    connect(OnlineServicesModel::self()->refreshAct(), SIGNAL(triggered()), this, SLOT(refreshService()));
    connect(OnlineServicesModel::self()->subscribeAct(), SIGNAL(triggered()), this, SLOT(subscribe()));
    connect(OnlineServicesModel::self()->unSubscribeAct(), SIGNAL(triggered()), this, SLOT(unSubscribe()));
    connect(OnlineServicesModel::self()->refreshSubscriptionAct(), SIGNAL(triggered()), this, SLOT(refreshSubscription()));
    connect(downloadAction, SIGNAL(triggered()), this, SLOT(download()));
    connect(downloadPodcastAction, SIGNAL(triggered()), this, SLOT(downloadPodcast()));
    connect(deleteDownloadedPodcastAction, SIGNAL(triggered()), this, SLOT(deleteDownloadedPodcast()));
    connect(cancelPodcastDownloadAction, SIGNAL(triggered()), this, SLOT(cancelPodcastDownload()));
    connect(markPodcastAsNewAction, SIGNAL(triggered()), this, SLOT(markPodcastAsNew()));
    connect(markPodcastAsListenedAction, SIGNAL(triggered()), this, SLOT(markPodcastAsListened()));

    QMenu *menu=new QMenu(this);
    menu->addAction(OnlineServicesModel::self()->configureAct());
    menu->addAction(OnlineServicesModel::self()->refreshAct());
    menu->addSeparator();
    menu->addAction(OnlineServicesModel::self()->subscribeAct());
    menu->addAction(OnlineServicesModel::self()->unSubscribeAct());
    menu->addAction(OnlineServicesModel::self()->refreshSubscriptionAct());
    menu->addAction(downloadPodcastAction);
    menu->addAction(cancelPodcastDownloadAction);
    menu->addAction(deleteDownloadedPodcastAction);
    menu->addSeparator();
    menu->addAction(markPodcastAsNewAction);
    menu->addAction(markPodcastAsListenedAction);
    menu->addSeparator();
    QAction *configAction=new QAction(Icons::self()->configureIcon, i18n("Configure..."), this);
    menu->addAction(configAction);
    connect(configAction, SIGNAL(triggered()), this, SLOT(showPreferencesPage()));

    view->addAction(downloadAction);
    view->addSeparator();
    view->addAction(OnlineServicesModel::self()->subscribeAct());
    view->addAction(OnlineServicesModel::self()->unSubscribeAct());
    view->addAction(OnlineServicesModel::self()->refreshSubscriptionAct());
    view->addAction(downloadPodcastAction);
    view->addAction(deleteDownloadedPodcastAction);
    view->addAction(cancelPodcastDownloadAction);
    view->addAction(deleteDownloadedPodcastAction);
    view->addSeparator();
    view->addAction(markPodcastAsNewAction);
    view->addAction(markPodcastAsListenedAction);
    menuButton->setMenu(menu);
    proxy.setSourceModel(OnlineServicesModel::self());
//    proxy.setDynamicSortFilter(false);
    view->setModel(&proxy);
    view->setRootIsDecorated(true);
    view->setSearchResetLevel(1);
}
Ejemplo n.º 3
0
AnimeList::AnimeList()
{
	CtrlLayout(*this, "Anime List");
	CtrlLayout(infoTab);
	CtrlLayout(addTab);
	CtrlLayout(clndr);
	CtrlLayout(parameters);
	CtrlLayout(dlg, "Modify Items");
	CtrlLayout(test);
	
	test.testList.AddColumn("1");
	test.testList.AddColumn("2");
	
	Icon(AImage::icon());

	animeList.Add(infoTab, "Information");
	animeList.Add(addTab, "Add Items");
	animeList.Add(test, "Test Information");

	parTab.Add(clndr, "Calendar");
	parTab.Add(parameters, "Parameters");

	addTab.complete.Add("Yes");
	addTab.complete.Add("No");
	addTab.complete.Add("New");
	addTab.complete.SetIndex(1);
	addTab.episodes.SetText("0");

	drop.Add("Yes");
	drop.Add("No");
	drop.Add("New");

	dlg.complete.Add("Yes");
	dlg.complete.Add("No");
	dlg.complete.Add("New");

	parameters.seasons.Add("All Seasons");
	parameters.seasons.Add("Winter");
	parameters.seasons.Add("Spring");
	parameters.seasons.Add("Summer");
	parameters.seasons.Add("Autumn");
	parameters.seasons.SetIndex(0);
	
	parameters.years.Add("All Years");
	parameters.years.SetIndex(0);
	
	parameters.complete.Add("All");
	parameters.complete.Add("Yes");
	parameters.complete.Add("No");
	parameters.complete.Add("New");
	parameters.complete.SetIndex(0);

	parameters.looking.Add("All");
	parameters.looking.Add("Looking");
	parameters.looking.Add("Don't Looking");
	parameters.looking.SetIndex(0);

	CreateArray();

	seriesDate.AddColumn("Ep");
	seriesDate.AddColumn("Release(m/d/y)");
	seriesDate.ColumnWidths("2 5");
	seriesDate.EvenRowColor(WhiteGray());

	listName.WhenLeftClick = THISBACK(Change);
	listName.WhenAcceptEdit = THISBACK(EditValue);
	listName.WhenBar = THISBACK(RightMenu);
	seriesDate.WhenLeftClick = THISBACK(ChangeSeries);
	dateSeries.WhenAction = THISBACK(ModifyDate);
	clndr.calendar.WhenAction = THISBACK(Test);
	parameters.years.WhenAction = THISBACK(Sorts);
	parameters.seasons.WhenAction = THISBACK(Sorts);
	parameters.complete.WhenAction = THISBACK(Sorts);
	parameters.looking.WhenAction = THISBACK(Sorts);
	
	addTab.add <<= THISBACK(Add);
	infoTab.modify <<= THISBACK(OpenModify);
	dlg.modify <<= THISBACK(Modify);
	dlg.cancel <<= THISBACK(DoClose);
	infoTab.viewPlus <<= THISBACK(PlusViews);
	infoTab.viewMinus <<= THISBACK(MinusViews);
	moved <<= THISBACK(ModifySeries);
	parameters.reset <<= THISBACK(ResetParameters);
	
	fs.AllFilesType();
	
	menu.Set(THISBACK(MainMenu));

	infoTab.viewPlus.SetImage(AImage::plus());
	infoTab.viewMinus.SetImage(AImage::minus());
}
Ejemplo n.º 4
0
void IconsPlugin::setIcons()
{
    for (ICONS_MAP::iterator it = dlls.begin(); it != dlls.end(); ++it)
        delete (*it).second;
    dlls.clear();
    for (unsigned n = 1; ; n++){
        const char *cfg = getIconDLLs(n);
        if ((cfg == NULL) || (*cfg == 0))
            break;
        string v = cfg;
        string name = getToken(v, ',');
        if (v.length() == 0)
            continue;
        IconDLL *dll = new IconDLL;
        if (!dll->load(QString::fromUtf8(v.c_str())))
            continue;
        dlls.insert(ICONS_MAP::value_type(name.c_str(), dll));
    }
	if (smiles){
		string s;
		for (unsigned i = 0; i < smiles->count(); i++){
			const QIconSet *is = smiles->get(i);
			if (is == NULL){
				log(L_DEBUG, "Skip %u", i);
				s += '-';
				s += '\x00';
				s += '\x00';
				s += '\x00';
				continue;
			}
			QString pat = smiles->pattern(i);
			while (!pat.isEmpty()){
				QString p = getToken(pat, ' ', false);
				if (p.isEmpty())
					continue;
				s += p.latin1();
				s += '\x00';
				log(L_DEBUG, "%u > %s", i, (const char*)(p.latin1()));
			}
			s += '\x00';
			QString tip = smiles->tip(i);
			if (!tip.isEmpty()){
				s += tip.local8Bit();
				log(L_DEBUG, "%u Tip %s", i, (const char*)(tip.local8Bit()));
			}
			s += '\x00';
			QString url = "smile";
			url += QString::number(i).upper();
			url = QString("icon:") + url;
		    QMimeSourceFactory::defaultFactory()->setPixmap(url, is->pixmap(QIconSet::Small, QIconSet::Normal));
		}
		s += '\x00';
		s += '\x00';
		s += '\x00';
		SIM::setSmiles(s.c_str());
	}else{
		for (unsigned i = 0; i < 16; i++){
			QString url = "icon:smile";
			url += QString::number(i).upper();
			const QIconSet *is = Icon((const char*)(url.latin1()));
			if (is == NULL)
				continue;
		    QMimeSourceFactory::defaultFactory()->setPixmap(url, is->pixmap(QIconSet::Small, QIconSet::Normal));
		}
		SIM::setSmiles(NULL);
	}
    Event eIcon(EventIconChanged);
    eIcon.process();
	Event eHistory(EventHistoryConfig);
	eHistory.process();
}
Ejemplo n.º 5
0
KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent, const char *name, bool modal)
        : AboutDlgBase(parent, name, modal)
{
    SET_WNDPROC("about")
    setButtonsPict(this);
    setCaption(caption());

    connect(btnOK, SIGNAL(clicked()), this, SLOT(close()));
    setIcon(Pict("licq"));
    const QIconSet *icon = Icon("licq");
    if (icon)
        lblIcon->setPixmap(icon->pixmap(QIconSet::Large, QIconSet::Normal));
    lblVersion->setText(i18n("%1 Version: %2") .arg(aboutData->appName()) .arg(aboutData->version()));
    txtAbout->setText((QString("<center><br>%1<br><br>%2<br><br>") +
                       "<a href=\"%3\">%4</a><br><br>" +
                       i18n("Bug report") + ": <a href=\"mailto:%5\">%6</a>" +
                       "</center>")
                      .arg(quote(aboutData->shortDescription()))
                      .arg(quote(aboutData->copyrightStatement()))
                      .arg(quote(aboutData->homepage()))
                      .arg(quote(aboutData->homepage()))
                      .arg(quote(aboutData->bugAddress()))
                      .arg(quote(aboutData->bugAddress())));
    QString txt;
    QValueList<KAboutPerson>::ConstIterator it;
    for (it = aboutData->authors().begin();
            it != aboutData->authors().end(); ++it)
    {
        txt += addPerson(&(*it));
        txt += "<br>";
    }
    txtAuthors->setText(txt);
    txt = "";
    QValueList<KAboutTranslator> translators = aboutData->translators();
    QValueList<KAboutTranslator>::ConstIterator itt;
    if (!translators.isEmpty()){
        for (itt = translators.begin();
                itt != translators.end(); ++itt)
        {
            const KAboutTranslator &t = *itt;
            txt += QString("%1 &lt;<a href=\"mailto:%2\">%3</a>&gt;<br>")
                   .arg(quote(t.name()))
                   .arg(quote(t.emailAddress()))
                   .arg(quote(t.emailAddress()));
            txt += "<br>";
        }
        txtTranslations->setText(txt);
    }else{
        tabMain->removePage(tabTranslation);
    }
    QString license = aboutData->license();
    license += "\n\n";
    QFile f(QString::fromLocal8Bit(app_file("COPYING").c_str()));
    if (f.open(IO_ReadOnly)){
        for (;;){
            QString s;
            if (f.readLine(s, 512) == -1)
                break;
            license += s;
        }
    }
    txtLicence->setText(quote(license));
}
Ejemplo n.º 6
0
TodoView::TodoView(CalObject *cal, QWidget *parent, const char *name)
    : KTabListBox(parent, name, 5)
{
  calendar = cal;
  // set up filter for events
  lbox.installEventFilter(this);
  // set up the widget to have 4 columns (one hidden), and
  // only a vertical scrollbar
  clearTableFlags(Tbl_hScrollBar);
  clearTableFlags(Tbl_autoHScrollBar);
  // BL: autoscrollbar in not working...
  setTableFlags(Tbl_hScrollBar);
  setAutoUpdate(TRUE);
  adjustColumns();
  // insert pictures for use to show a checked/not checked todo
  dict().insert("CHECKED", new QPixmap(Icon("checkedbox.xpm")));
  dict().insert("EMPTY", new QPixmap(Icon("emptybox.xpm")));
  dict().insert("CHECKEDMASK", new QPixmap(Icon("checkedbox-mask.xpm")));
  dict().insert("EMPTYMASK", new QPixmap(Icon("emptybox-mask.xpm")));

  // this is the thing that lets you edit the todo text.
  editor = new QLineEdit(this);
  editor->hide();
  connect(editor, SIGNAL(returnPressed()),
	  this, SLOT(updateSummary()));
  connect(editor, SIGNAL(returnPressed()),
	  editor, SLOT(hide()));
  connect(editor, SIGNAL(textChanged(const char *)),
	  this, SLOT(changeSummary(const char *)));
  
  connect(this, SIGNAL(selected(int, int)),
    	  this, SLOT(updateItem(int, int)));
  connect(this, SIGNAL(highlighted(int, int)),
	  this, SLOT(hiliteAction(int, int)));

  priList = new QListBox(this);
  priList->hide();
  priList->insertItem("1");
  priList->insertItem("2");
  priList->insertItem("3");
  priList->insertItem("4");
  priList->insertItem("5");
  priList->setFixedHeight(priList->itemHeight()*5+5);
  priList->setFixedWidth(priList->maxItemWidth()+5);
  connect(priList, SIGNAL(highlighted(int)),
	  priList, SLOT(hide()));
  connect(priList, SIGNAL(highlighted(int)),
	  this, SLOT(changePriority(int)));

  QPixmap pixmap;
  rmbMenu1 = new QPopupMenu;
  pixmap = Icon("checkedbox.xpm");
  rmbMenu1->insertItem(pixmap, i18n("New Todo"), this,
		       SLOT(newTodo()));
  pixmap = Icon("delete.xpm");
  rmbMenu1->insertItem(pixmap, i18n("Purge Completed "), this,
		       SLOT(purgeCompleted()));

  rmbMenu2 = new QPopupMenu;
  pixmap = Icon("checkedbox.xpm");
  rmbMenu2->insertItem(pixmap, i18n("New Todo"), this,
		     SLOT (newTodo()));
  rmbMenu2->insertItem(i18n("Edit Todo"), this,
		     SLOT (editTodo()));
  pixmap = Icon("delete.xpm");
  rmbMenu2->insertItem(pixmap, i18n("Delete Todo"), this,
		     SLOT (deleteTodo()));
  rmbMenu2->insertItem(i18n("Purge Completed "), this,
		       SLOT(purgeCompleted()));


  editingFlag = FALSE;
  connect(this, SIGNAL(headerClicked(int)), this, SLOT(headerAction(int)));
  updateConfig();
  prevRow = updatingRow = -1;
}
Ejemplo n.º 7
0
UserBox::UserBox(unsigned long grpId)
        : QMainWindow(NULL, NULL,
                      (WType_TopLevel | WStyle_Customize | WStyle_NormalBorder |
                       WStyle_Title | WStyle_SysMenu)
#ifdef USE_KDE
                      | (pMain->UserWindowInTaskManager() ? WStyle_Minimize : 0)
#endif
                     ),
        GrpId(this, "Group"),
        CurrentUser(this, "CurrentUser"),
        mLeft(this, "Left"),
        mTop(this, "Top"),
        mWidth(this, "Width"),
        mHeight(this, "Height"),
        ToolbarDock(this, "ToolbarDock", "Top"),
        ToolbarOffset(this, "ToolbarOffset"),
        ToolbarY(this, "ToolbarY")
{
    ToolbarDock = pMain->UserBoxToolbarDock();
    ToolbarOffset = pMain->UserBoxToolbarOffset();
    ToolbarY = pMain->UserBoxToolbarY();
    users = NULL;
    GrpId = grpId;
    msgView = NULL;
    progress = NULL;
    setWFlags(WDestructiveClose);
    infoWnd = NULL;
    historyWnd = NULL;
    transparent = new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);
    menuUser = new QPopupMenu(this);
    menuUser->setCheckable(true);
    connect(menuUser, SIGNAL(activated(int)), this, SLOT(selectedUser(int)));
    curWnd = NULL;
    frm = new QFrame(this);
    setCentralWidget(frm);
    lay = new QVBoxLayout(frm);
    vSplitter = new QSplitter(Horizontal, frm);
    vSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(vSplitter);
    splitter = new QSplitter(Vertical, vSplitter);
    modeChanged(pMain->SimpleMode());
    frmUser = new QFrame(splitter);
    layUser = new QVBoxLayout(frmUser);
    tabSplitter = new Splitter(frm);
    tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    tabs = new UserTabBar(tabSplitter);
    tabs->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    QSize s;
    status = new QStatusBar(tabSplitter);
    {
        QProgressBar p(status);
        status->addWidget(&p);
        s = status->minimumSizeHint();
    }
    status->setMinimumSize(QSize(0, s.height()));
    tabSplitter->setResizeMode(status, QSplitter::KeepSize);
    lay->addWidget(tabSplitter);
    setIcon(Pict(pClient->getStatusIcon()));
    connect(tabs, SIGNAL(selected(int)), this, SLOT(selectedUser(int)));
    connect(tabs, SIGNAL(showUserPopup(int, QPoint)), this, SLOT(showUserPopup(int, QPoint)));
    toolbar = new QToolBar(this);
    toolbar->setHorizontalStretchable(true);
    toolbar->setVerticalStretchable(true);
    menuType = new QPopupMenu(this);
    connect(menuType, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
    btnType = new PictButton(toolbar);
    btnType->setPopup(menuType);
    btnType->setPopupDelay(0);
    toolbar->addSeparator();
    btnUser = new PictButton(toolbar);
    btnUser->setPopup(menuUser);
    btnUser->setPopupDelay(0);
    toolbar->addSeparator();
    btnIgnore = new QToolButton(toolbar);
    btnIgnore->setIconSet(Icon("ignorelist"));
    btnIgnore->setTextLabel(i18n("Add to ignore list"));
    connect(btnIgnore, SIGNAL(clicked()), this, SLOT(toIgnore()));
    menuGroup = new QPopupMenu(this);
    connect(menuGroup, SIGNAL(aboutToShow()), this, SLOT(showGrpMenu()));
    connect(menuGroup, SIGNAL(activated(int)), this, SLOT(moveUser(int)));
    btnGroup = new CToolButton(toolbar);
    btnGroup->setIconSet(Icon("grp_on"));
    btnGroup->setTextLabel(i18n("Move to group"));
    btnGroup->setPopup(menuGroup);
    btnGroup->setPopupDelay(0);
    toolbar->addSeparator();
    btnInfo = new QToolButton(toolbar);
    btnInfo->setIconSet(Icon("info"));
    btnInfo->setTextLabel(i18n("User info"));
    btnInfo->setToggleButton(true);
    connect(btnInfo, SIGNAL(toggled(bool)), this, SLOT(toggleInfo(bool)));
    btnHistory = new QToolButton(toolbar);
    btnHistory->setIconSet(Icon("history"));
    btnHistory->setTextLabel(i18n("History"));
    btnHistory->setToggleButton(true);
    connect(btnHistory, SIGNAL(toggled(bool)), this, SLOT(toggleHistory(bool)));
    btnQuit = new QToolButton(Icon("exit"), i18n("Close"), "", this, SLOT(quit()), toolbar);
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(pClient, SIGNAL(messageRead(ICQMessage*)), this, SLOT(messageRead(ICQMessage*)));
    connect(pClient, SIGNAL(messageReceived(ICQMessage*)), this, SLOT(messageReceived(ICQMessage*)));
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(iconChanged()));
    connect(pMain, SIGNAL(wmChanged()), this, SLOT(wmChanged()));
    connect(pMain, SIGNAL(modeChanged(bool)), this, SLOT(modeChanged(bool)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolBarChanged(QToolBar*)));
    setGroupButtons();
    wmChanged();
    adjustPos();
    adjustToolbar();
}
Ejemplo n.º 8
0
void UpdaterTray::programInit()
{
  QString tmp, command;
  autoStatus = AUTOINACTIVE;
  doingCheck=false;
  shownPopup=false;

  // Use built-in frequency until we load another
  updateFrequency = -1;

  sysTimer = new QTimer(this);
  pbiTimer = new QTimer(this);

  connect( sysTimer, SIGNAL(timeout()), this, SLOT(slotScheduledSystemCheck()) );
  connect( pbiTimer, SIGNAL(timeout()), this, SLOT(slotScheduledPBICheck()) );

  // Get the username of the person running X
  username = getlogin();

  // Setup our Context Menu
  QIcon contextIcon;
  contextIcon.addFile(":/images/updated.png");


  trayIconMenu = new QMenu(this);
  trayIconMenu->setIcon(contextIcon);
  trayIconMenu->addSeparator();
  trayIconMenu->addAction( QIcon(":/images/sysupdater.png"), tr("Start the Update Manager"),  this, SLOT(slotOpenUpdateManager()));
  trayIconMenu->addAction( QIcon(":/images/pkgmanager.png"), tr("Start the Package Manager"), this, SLOT(slotOpenPackageManager()));
  trayIconMenu->addSeparator();
  trayIconMenu->addAction( QIcon(":/images/appcafe.png"),    tr("Start the AppCafe"), this, SLOT(slotOpenSoftwareManager()));
  trayIconMenu->addAction( QIcon(":/images/warden.png"),     tr("Start the Warden"),  this, SLOT(slotOpenJailManager()));
  trayIconMenu->addSeparator();
  trayIconMenu->addAction( QIcon(":/images/view-refresh.png"),tr("Check for updates"),this, SLOT(slotCheckAllUpdates()));
  trayIconMenu->addSeparator();
  runAction = trayIconMenu->addAction( tr("Run at startup"), this, SLOT(slotChangeRunStartup()) );
  runAction->setCheckable( TRUE );
  runAction->setChecked( TRUE );
  popAction = trayIconMenu->addAction( tr("Display notifications"), this, SLOT(slotChangePopup()) );
  popAction->setCheckable( TRUE );
  popAction->setChecked( TRUE );
  trayIconMenu->addSeparator();
  trayIconMenu->addAction( tr("Quit"), this, SLOT(slotQuitTray()) );
  
  // Init the tray icon
  trayIcon = new QSystemTrayIcon(this);
  trayIcon->setContextMenu(trayIconMenu);
  QIcon Icon(":/images/working.png");
  trayIcon->setIcon(Icon);
  trayIcon->show();
  connect( trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason) ) );

  // Load the program preferences
  loadUpdaterPrefs();

  // Start the monitor service for system updates
  QTimer::singleShot(1000, this, SLOT(slotScheduledSystemCheck()));

  // Start the monitor service for PBI updates
  QTimer::singleShot(60000, this, SLOT(slotScheduledPBICheck()));

  // Monitor if we need to start any update checks
  QTimer::singleShot(500, this, SLOT(slotMonitorForChanges()));

  // Watch our trigger file, to see if any automated updates are being downloaded
  QFile sysTrig( SYSTRIGGER );
  if ( sysTrig.open( QIODevice::WriteOnly ) ) {
    QTextStream streamTrig( &sysTrig );
     streamTrig << QDateTime::currentDateTime().toString("hhmmss");
  }
  sysTrig.close();

  // Start our file watchers
  fileWatcherAutoUpdate = new QFileSystemWatcher();
  fileWatcherAutoUpdate->addPath(SYSTRIGGER);
  connect(fileWatcherAutoUpdate, SIGNAL(fileChanged(const QString&)), this, SLOT(slotSetTimerReadAutoStatus() ));

  // Watch for PBI updates and refresh
  QFile pbiTrig( PBITRIGGER );
  if ( pbiTrig.open( QIODevice::WriteOnly ) ) {
    QTextStream streamTrig1( &pbiTrig );
     streamTrig1 << QDateTime::currentDateTime().toString("hhmmss");
     pbiTrig.close();
  }
  pbiWatcherAutoUpdate = new QFileSystemWatcher();
  pbiWatcherAutoUpdate->addPath(PBITRIGGER);
  connect(pbiWatcherAutoUpdate, SIGNAL(fileChanged(const QString&)), this, SLOT(slotScheduledPBICheck() ));

  // Watch our trigger file, to see if any automated updates are being downloaded
  fileWatcherSys = new QFileSystemWatcher();
  fileWatcherSys->addPath(PREFIX + "/share/pcbsd/pc-updatemanager/conf/sysupdate.conf");
  connect(fileWatcherSys, SIGNAL(fileChanged(const QString&)), this, SLOT(slotScheduledSystemCheck() ));
}
Ejemplo n.º 9
0
/**
 * name:	OnAddPage
 * class:	CPsTreeItem
 * desc:	inits the treeitem's attributes
 * params:	pPsh	- pointer to the property page's header structure
 *			odp		- OPTIONSDIALOGPAGE structure with the information about the page to add
 * return:	0 on success, 1 on failure
 **/
int CPsTreeItem::Create(CPsHdr* pPsh, OPTIONSDIALOGPAGE *odp)
{
	int err;
	TCHAR szTitle[ MAXSETTING ];

	// check parameter
	if (pPsh && pPsh->_dwSize == sizeof(CPsHdr) && odp && PtrIsValid(odp->hInstance)) {
		// instance value
		_hInst = odp->hInstance;
		_dwFlags = odp->flags;
		_initParam = odp->dwInitParam;

		// init page owning contact
		_hContact = pPsh->_hContact;
		_pszProto = mir_strdup(pPsh->_pszProto);

		// global settings prefix for current contact (is dialog owning contact's protocol by default)
		_pszPrefix = (pPsh->_pszPrefix) ? pPsh->_pszPrefix : "Owner";

		if (pPsh->_dwFlags & PSF_PROTOPAGESONLY) {
			if (_dwFlags & ODPF_USERINFOTAB)
				mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s %d\\%s"), odp->ptszTitle, pPsh->_nSubContact+1, odp->ptszTab);
			else
				mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s %d"), odp->ptszTitle, pPsh->_nSubContact+1);
		}
		else {
			if (_dwFlags & ODPF_USERINFOTAB)
				mir_sntprintf(szTitle, SIZEOF(szTitle), _T("%s\\%s"), odp->ptszTitle, odp->ptszTab);
			else
				mir_tstrcpy(szTitle, odp->ptszTitle);
		}
		// set the unique utf8 encoded name for the item
		if (err = Name(szTitle, (_dwFlags & ODPF_UNICODE) == ODPF_UNICODE)) 
			MsgErr(NULL, LPGENT("Creating unique name for a page failed with %d and error code %d"), err, GetLastError());

		// read label from database or create it
		else if (err = ItemLabel(TRUE)) 
			MsgErr(NULL, LPGENT("Creating the label for a page failed with %d and error code %d"), err, GetLastError());
		else {
			// load icon for the item
			Icon(pPsh->_hImages, odp, (pPsh->_dwFlags & PSTVF_INITICONS) == PSTVF_INITICONS);
			
			// the rest is not needed if only icons are loaded
			if (pPsh->_dwFlags & PSTVF_INITICONS)
				return 0;

			// load custom order
			if (!(pPsh->_dwFlags & PSTVF_SORTTREE)) {
				_iPosition = (int)db_get_b(NULL, MODNAME, PropertyKey(SET_ITEM_POS), odp->position);
				if ((_iPosition < 0) && (_iPosition > 0x800000A))
					_iPosition = 0;
			}
			// read visibility state
			_bState =	db_get_b(NULL, MODNAME, PropertyKey(SET_ITEM_STATE), DBTVIS_EXPANDED);

			// error for no longer supported dialog template type
			if (((UINT_PTR)odp->pszTemplate & 0xFFFF0000)) 
				MsgErr(NULL, LPGENT("The dialog template type is no longer supported"));
			else {
				// fetch dialog resource id
				_idDlg = (INT_PTR)odp->pszTemplate;
				// dialog procedure
				_pfnDlgProc = odp->pfnDlgProc;

				// is dummy item?
				if (!_idDlg	&& !_pfnDlgProc)
					return 0;

				if (_idDlg	&& _pfnDlgProc) {
					// lock the property pages dialog resource
					_pTemplate = (DLGTEMPLATE*)LockResource(LoadResource(_hInst, FindResource(_hInst, (LPCTSTR)(UINT_PTR)_idDlg, RT_DIALOG)));
					if (_pTemplate)
						return 0;
				}
			}
		}
	}
	return 1;
}
Ejemplo n.º 10
0
QIcon CodeModelIcon::iconForType(CodeModelIcon::Type type)
{
    static const IconMaskAndColor classRelationIcon {
        QLatin1String(":/codemodel/images/classrelation.png"), Theme::IconsCodeModelOverlayForegroundColor};
    static const IconMaskAndColor classRelationBackgroundIcon {
        QLatin1String(":/codemodel/images/classrelationbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
    static const IconMaskAndColor classMemberFunctionIcon {
        QLatin1String(":/codemodel/images/classmemberfunction.png"), Theme::IconsCodeModelFunctionColor};
    static const IconMaskAndColor classMemberVariableIcon {
        QLatin1String(":/codemodel/images/classmembervariable.png"), Theme::IconsCodeModelVariableColor};
    static const IconMaskAndColor functionIcon {
        QLatin1String(":/codemodel/images/member.png"), Theme::IconsCodeModelFunctionColor};
    static const IconMaskAndColor variableIcon {
        QLatin1String(":/codemodel/images/member.png"), Theme::IconsCodeModelVariableColor};
    static const IconMaskAndColor signalIcon {
        QLatin1String(":/codemodel/images/signal.png"), Theme::IconsCodeModelFunctionColor};
    static const IconMaskAndColor slotIcon {
        QLatin1String(":/codemodel/images/slot.png"), Theme::IconsCodeModelFunctionColor};
    static const IconMaskAndColor propertyIcon {
        QLatin1String(":/codemodel/images/property.png"), Theme::IconsCodeModelOverlayForegroundColor};
    static const IconMaskAndColor propertyBackgroundIcon {
        QLatin1String(":/codemodel/images/propertybackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
    static const IconMaskAndColor protectedIcon {
        QLatin1String(":/codemodel/images/protected.png"), Theme::IconsCodeModelOverlayForegroundColor};
    static const IconMaskAndColor protectedBackgroundIcon {
        QLatin1String(":/codemodel/images/protectedbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
    static const IconMaskAndColor privateIcon {
        QLatin1String(":/codemodel/images/private.png"), Theme::IconsCodeModelOverlayForegroundColor};
    static const IconMaskAndColor privateBackgroundIcon {
        QLatin1String(":/codemodel/images/privatebackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};
    static const IconMaskAndColor staticIcon {
        QLatin1String(":/codemodel/images/static.png"), Theme::IconsCodeModelOverlayForegroundColor};
    static const IconMaskAndColor staticBackgroundIcon {
        QLatin1String(":/codemodel/images/staticbackground.png"), Theme::IconsCodeModelOverlayBackgroundColor};

    switch (type) {
    case Class: {
        const static QIcon icon(Icon({
            classRelationBackgroundIcon, classRelationIcon,
            {QLatin1String(":/codemodel/images/classparent.png"), Theme::IconsCodeModelClassColor},
            classMemberFunctionIcon, classMemberVariableIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case Struct: {
        const static QIcon icon(Icon({
            classRelationBackgroundIcon, classRelationIcon,
            {QLatin1String(":/codemodel/images/classparent.png"), Theme::IconsCodeModelStructColor},
            classMemberFunctionIcon, classMemberVariableIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case Enum: {
        const static QIcon icon(Icon({
            {QLatin1String(":/codemodel/images/enum.png"), Theme::IconsCodeModelEnumColor}
        }, Icon::Tint).icon());
        return icon;
    }
    case Enumerator: {
        const static QIcon icon(Icon({
            {QLatin1String(":/codemodel/images/enumerator.png"), Theme::IconsCodeModelEnumColor}
        }, Icon::Tint).icon());
        return icon;
    }
    case FuncPublic: {
        const static QIcon icon(Icon({
                functionIcon}, Icon::Tint).icon());
        return icon;
    }
    case FuncProtected: {
        const static QIcon icon(Icon({
                functionIcon, protectedBackgroundIcon, protectedIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case FuncPrivate: {
        const static QIcon icon(Icon({
            functionIcon, privateBackgroundIcon, privateIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case FuncPublicStatic: {
        const static QIcon icon(Icon({
            functionIcon, staticBackgroundIcon, staticIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case FuncProtectedStatic: {
        const static QIcon icon(Icon({
            functionIcon, staticBackgroundIcon, staticIcon, protectedBackgroundIcon, protectedIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case FuncPrivateStatic: {
        const static QIcon icon(Icon({
            functionIcon, staticBackgroundIcon, staticIcon, privateBackgroundIcon, privateIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case Namespace: {
        const static QIcon icon(Icon({
            {QLatin1String(":/utils/images/namespace.png"), Theme::IconsCodeModelKeywordColor}
        }, Icon::Tint).icon());
        return icon;
    }
    case VarPublic: {
        const static QIcon icon(Icon({
            variableIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case VarProtected: {
        const static QIcon icon(Icon({
            variableIcon, protectedBackgroundIcon, protectedIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case VarPrivate: {
        const static QIcon icon(Icon({
            variableIcon, privateBackgroundIcon, privateIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case VarPublicStatic: {
        const static QIcon icon(Icon({
            variableIcon, staticBackgroundIcon, staticIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case VarProtectedStatic: {
        const static QIcon icon(Icon({
            variableIcon, staticBackgroundIcon, staticIcon, protectedBackgroundIcon, protectedIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case VarPrivateStatic: {
        const static QIcon icon(Icon({
            variableIcon, staticBackgroundIcon, staticIcon, privateBackgroundIcon, privateIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case Signal: {
        const static QIcon icon(Icon({
            signalIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case SlotPublic: {
        const static QIcon icon(Icon({
            slotIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case SlotProtected: {
        const static QIcon icon(Icon({
            slotIcon, protectedBackgroundIcon, protectedIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case SlotPrivate: {
        const static QIcon icon(Icon({
            slotIcon, privateBackgroundIcon, privateIcon
        }, Icon::Tint).icon());
        return icon;
    }
    case Keyword: {
        const static QIcon icon(Icon({
            {QLatin1String(":/codemodel/images/keyword.png"), Theme::IconsCodeModelKeywordColor}
        }, Icon::Tint).icon());
        return icon;
    }
    case Macro: {
        const static QIcon icon(Icon({
            {QLatin1String(":/codemodel/images/macro.png"), Theme::IconsCodeModelMacroColor}
        }, Icon::Tint).icon());
        return icon;
    }
    case Property: {
        const static QIcon icon(Icon({
            variableIcon, propertyBackgroundIcon, propertyIcon
        }, Icon::Tint).icon());
        return icon;
    }
    default:
        break;
    }
    return QIcon();
}
Ejemplo n.º 11
0
/* 
 * EventWidget -- main widget for displaying events
 */
EventWidget::EventWidget( KDPEvent *_event, CalObject *_calendar,
			  QDate _date, QWidget *parent, char *_name )
  : QFrame( parent, _name )
{
  widgetEvent = _event;
  widgetDate = _date;
  calendar = _calendar;
  ASSERT(widgetEvent);

  // set up widgets.
  useHandle = TRUE;
  handleFrame = new QFrame(this, "handleFrame");
  handleFrame->setFrameStyle(Panel | Sunken);
  handleFrame->setLineWidth(2);
  handleFrame->setFixedWidth(HANDLESIZE);
  handleFrame->setMouseTracking(TRUE);
  handleFrame->setFocusProxy(this);

  textBox = new KTextBox(this, "textBox");
  textBox->setFrameStyle(NoFrame);
  textBox->setMouseTracking(TRUE);

  useIcons = TRUE;
  iconBox = new EWIconBoxFrame(this, "iconBox");
  iconBox->setFrameStyle(NoFrame);
  iconBox->setMinimumWidth(2*PMMARGIN+MAXPMSIZE);
  iconBox->setMouseTracking(TRUE);
  iconBox->setFocusProxy(this);

  // we filter ALL events.
  setFrameStyle(Box | Plain);
  setLineWidth(1);
  setFocusPolicy(ClickFocus);
  setMouseTracking(TRUE);
  installEventFilter(this);
  handleFrame->installEventFilter(this);
  textBox->installEventFilter(this);
  iconBox->installEventFilter(this);

  // set flags
  setState(NoState);
  // what type of resizing is going on
  ResizeStatus = 0;
  
  widgetSelected = FALSE;

  // RMB popup menu
  rmbPopup = new QPopupMenu();
  rmbPopup->insertItem(i18n("&Edit"));
  QPixmap pm = Icon("delete.xpm");
  rmbPopup->insertItem(pm, i18n("&Delete"));
  pm = Icon("bell.xpm");
  rmbPopup->insertItem(pm, i18n("Toggle Alarm"));
  connect(rmbPopup, SIGNAL(activated(int)), 
	  SLOT(popupSlot(int)));

  updateConfig();

  setSelected(FALSE);

  // set text
  if (!widgetEvent->getSummary().isEmpty())
    setText(widgetEvent->getSummary());

  if (widgetEvent->isReadOnly()) {
    setEnabled(FALSE);
    iconBox->setEnabled(FALSE);
    textBox->setEnabled(FALSE);
    setBackgroundColor(palette().disabled().base());
  }
}
Ejemplo n.º 12
0
ShortcutSettings::ShortcutSettings(QObject *parent) :
    QObject(parent)
{
    GeneralSettingsItem<ShortcutSettingsWidget> *item = new GeneralSettingsItem<ShortcutSettingsWidget>(Settings::General, Icon("preferences-desktop-peripherals"), QT_TRANSLATE_NOOP("Settings","Shortcuts"));
    Settings::registerItem(item);
    deleteLater();
}
Ejemplo n.º 13
0
bool cWindowSFML::Create( WindowSettings Settings, ContextSettings Context ) {
	if ( mWindow.Created )
		return false;

	sf::VideoMode mode			= sf::VideoMode::getDesktopMode();
	mWindow.WindowConfig		= Settings;
	mWindow.ContextConfig		= Context;
	mWindow.DesktopResolution	= eeSize( mode.width, mode.height );

	if ( mWindow.WindowConfig.Style & WindowStyle::Titlebar )
		mWindow.Flags |= sf::Style::Titlebar;

	if ( mWindow.WindowConfig.Style & WindowStyle::Resize )
		mWindow.Flags |= sf::Style::Resize;

	if ( mWindow.WindowConfig.Style & WindowStyle::NoBorder )
		mWindow.Flags = sf::Style::None;

	if ( mWindow.WindowConfig.Style & WindowStyle::UseDesktopResolution ) {
		mWindow.WindowConfig.Width	= mode.width;
		mWindow.WindowConfig.Height	= mode.height;
	}

	Uint32 TmpFlags = mWindow.Flags;

	if ( mWindow.WindowConfig.Style & WindowStyle::Fullscreen )
		TmpFlags |= sf::Style::Fullscreen;

	mSFMLWindow.create( sf::VideoMode( Settings.Width, Settings.Height, Settings.BitsPerPixel ), mWindow.WindowConfig.Caption, TmpFlags, sf::ContextSettings( Context.DepthBufferSize, Context.StencilBufferSize ) );

	mSFMLWindow.setVerticalSyncEnabled( Context.VSync );

	if ( NULL == cGL::ExistsSingleton() ) {
		cGL::CreateSingleton( mWindow.ContextConfig.Version );
		cGL::instance()->Init();
	}

	CreatePlatform();

	GetMainContext();

	CreateView();

	Setup2D();

	mWindow.Created = true;
	mVisible = true;

	if ( "" != mWindow.WindowConfig.Icon ) {
		Icon( mWindow.WindowConfig.Icon );
	}

	/// Init the clipboard after the window creation
	reinterpret_cast<cClipboardSFML*> ( mClipboard )->Init();

	/// Init the input after the window creation
	reinterpret_cast<cInputSFML*> ( mInput )->Init();

	LogSuccessfulInit( GetVersion() );

	return true;
}
Ejemplo n.º 14
0
Icons::Icons()
{
    QColor stdColor=Utils::monoIconColor();

    singleIcon=MonoIcon::icon(FontAwesome::ex_one, stdColor);
    consumeIcon=MonoIcon::icon(":consume.svg", stdColor);
    menuIcon=MonoIcon::icon(FontAwesome::bars, stdColor);

    QString iconFile=QString(CANTATA_SYS_ICONS_DIR+"stream.png");
    if (QFile::exists(iconFile)) {
        streamIcon.addFile(iconFile);
    }
    if (streamIcon.isNull()) {
        streamIcon=Icon("applications-internet");
    }
    podcastIcon=MonoIcon::icon(FontAwesome::podcast, stdColor);
    audioFileIcon=Icon("audio-x-generic");
    folderIcon=Icon("inode-directory");
    speakerIcon=Icon(QStringList() << "speaker" << "audio-speakers" << "gnome-volume-control");
    repeatIcon=MonoIcon::icon(FontAwesome::refresh, stdColor);
    shuffleIcon=MonoIcon::icon(FontAwesome::random, stdColor);
    filesIcon=Icon(QStringList() << "folder-downloads" << "folder-download" << "folder" << "go-down");
    albumIconSmall.addFile(":album32.svg");
    albumIconLarge.addFile(":album.svg");
    albumMonoIcon=MonoIcon::icon(":mono-album.svg", stdColor);
    artistIcon=MonoIcon::icon(":artist.svg", stdColor);
    genreIcon=MonoIcon::icon(":genre.svg", stdColor);
    appIcon=Icon("cantata");

    lastFmIcon=MonoIcon::icon(FontAwesome::lastfmsquare, MonoIcon::constRed, MonoIcon::constRed);
    replacePlayQueueIcon=MonoIcon::icon(FontAwesome::play, stdColor);
    appendToPlayQueueIcon=MonoIcon::icon(FontAwesome::plus, stdColor);
    centrePlayQueueOnTrackIcon=MonoIcon::icon(Qt::RightToLeft==QApplication::layoutDirection() ? FontAwesome::chevronleft : FontAwesome::chevronright, stdColor);
    savePlayQueueIcon=MonoIcon::icon(FontAwesome::save, stdColor);
    cutIcon=MonoIcon::icon(FontAwesome::remove, MonoIcon::constRed, MonoIcon::constRed);
    addNewItemIcon=MonoIcon::icon(FontAwesome::plussquare, stdColor);
    editIcon=MonoIcon::icon(FontAwesome::edit, stdColor);
    stopDynamicIcon=MonoIcon::icon(FontAwesome::stop, MonoIcon::constRed, MonoIcon::constRed);
    searchIcon=MonoIcon::icon(FontAwesome::search, stdColor);
    addToFavouritesIcon=MonoIcon::icon(FontAwesome::heart, MonoIcon::constRed, MonoIcon::constRed);
    reloadIcon=MonoIcon::icon(FontAwesome::repeat, stdColor);
    configureIcon=MonoIcon::icon(FontAwesome::cogs, stdColor);
    connectIcon=MonoIcon::icon(FontAwesome::plug, stdColor);
    disconnectIcon=MonoIcon::icon(FontAwesome::eject, stdColor);
    downloadIcon=MonoIcon::icon(FontAwesome::download, stdColor);
    removeIcon=MonoIcon::icon(FontAwesome::minussquare, MonoIcon::constRed, MonoIcon::constRed);
    minusIcon=MonoIcon::icon(FontAwesome::minus, MonoIcon::constRed, MonoIcon::constRed);
    addIcon=MonoIcon::icon(FontAwesome::plus, stdColor);
    addBookmarkIcon=MonoIcon::icon(FontAwesome::bookmark, stdColor);
    audioListIcon=MonoIcon::icon(FontAwesome::music, stdColor);
    playlistListIcon=MonoIcon::icon(FontAwesome::list, stdColor);
    dynamicListIcon=MonoIcon::icon(FontAwesome::cube, stdColor);
    rssListIcon=MonoIcon::icon(FontAwesome::rss, stdColor);
    savedRssListIcon=MonoIcon::icon(FontAwesome::rsssquare, stdColor);
    clockIcon=MonoIcon::icon(FontAwesome::clocko, stdColor);
    folderListIcon=MonoIcon::icon(FontAwesome::foldero, stdColor);
    refreshIcon=MonoIcon::icon(FontAwesome::refresh, stdColor);
    streamListIcon=audioListIcon;
    streamCategoryIcon=folderListIcon;
    #ifdef ENABLE_HTTP_STREAM_PLAYBACK
    httpStreamIcon=MonoIcon::icon(FontAwesome::headphones, stdColor);
    #endif
    leftIcon=MonoIcon::icon(FontAwesome::chevronleft, stdColor);
    rightIcon=MonoIcon::icon(FontAwesome::chevronright, stdColor);
    upIcon=MonoIcon::icon(FontAwesome::chevronup, stdColor);
    downIcon=MonoIcon::icon(FontAwesome::chevrondown, stdColor);
    cancelIcon=MonoIcon::icon(FontAwesome::close, MonoIcon::constRed, MonoIcon::constRed);

    #if !defined Q_OS_WIN
    if (QLatin1String("gnome")==QIcon::themeName()) {
        QColor col=QApplication::palette().color(QPalette::Active, QPalette::WindowText);
        contextIcon=MonoIcon::icon(QLatin1String(":sidebar-info"), col);
    } else
    #endif
        contextIcon=Icon(QStringList() << "dialog-information" << "information");
}
Ejemplo n.º 15
0
InitialSettingsWizard::InitialSettingsWizard(QWidget *p)
    : QWizard(p)
{
    setupUi(this);
    connect(this, SIGNAL(currentIdChanged(int)), SLOT(pageChanged(int)));
    connect(this, SIGNAL(setDetails(const MPDConnectionDetails &)), MPDConnection::self(), SLOT(setDetails(const MPDConnectionDetails &)));
    connect(MPDConnection::self(), SIGNAL(stateChanged(bool)), SLOT(mpdConnectionStateChanged(bool)));
    connect(MPDConnection::self(), SIGNAL(error(const QString &, bool)), SLOT(showError(const QString &, bool)));
    connect(connectButton, SIGNAL(clicked(bool)), SLOT(connectToMpd()));
    connect(basicDir, SIGNAL(textChanged(QString)), SLOT(controlNextButton()));
    MPDConnection::self()->start();
    statusLabel->setText(i18n("Not Connected"));

    MPDConnectionDetails det=Settings::self()->connectionDetails();
    host->setText(det.hostname);
    port->setValue(det.port);
    password->setText(det.password);
    dir->setText(det.dir);
    #if defined Q_OS_WIN || defined Q_OS_MAC
    bool showGroupWarning=false;
    #else
    bool showGroupWarning=0==Utils::getGroupId();
    #endif
    groupWarningLabel->setVisible(showGroupWarning);
    groupWarningIcon->setVisible(showGroupWarning);
    int iconSize=Icon::dlgIconSize();
    groupWarningIcon->setPixmap(Icon("dialog-warning").pixmap(iconSize, iconSize));
    storeCoversInMpdDir->setChecked(Settings::self()->storeCoversInMpdDir());
    storeLyricsInMpdDir->setChecked(Settings::self()->storeLyricsInMpdDir());
    storeBackdropsInMpdDir->setChecked(Settings::self()->storeBackdropsInMpdDir());
    #ifdef ENABLE_KDE_SUPPORT
    introPage->setBackground(Icon("cantata"));
    #else
    introPage->setBackground(Icons::self()->appIcon);
    #endif
    connectionPage->setBackground(Icons::self()->audioFileIcon);
    filesPage->setBackground(Icons::self()->filesIcon);
    finishedPage->setBackground(Icon("dialog-ok"));

    #ifdef ENABLE_SIMPLE_MPD_SUPPORT
    introStack->setCurrentIndex(MPDUser::self()->isSupported() ? 1 : 0);
    basic->setChecked(false);
    advanced->setChecked(true);
    #else
    introStack->setCurrentIndex(0);
    basic->setChecked(true);
    advanced->setChecked(false);
    #endif

    #ifndef Q_OS_WIN
    QSize sz=size();
    // Adjust size for high-DPI setups...
    bool highDpi=fontMetrics().height()>20;
    if (highDpi) {
        foreach (int id, pageIds()) {
            QWizardPage *p=QWizard::page(id);
            p->adjustSize();
            QSize ps=p->size();
            if (ps.width()>sz.width()) {
                sz.setWidth(ps.width());
            }
            if (ps.height()>sz.height()) {
                sz.setHeight(ps.height());
            }
        }
    }
Ejemplo n.º 16
0
MsgSMS::MsgSMS(CToolCustom *parent, Message *msg)
        : QComboBox(parent)
{
    for (QWidget *p = parent->parentWidget(); p; p = p->parentWidget()){
        if (p->inherits("MsgEdit")){
            m_edit = static_cast<MsgEdit*>(p);
            break;
        }
    }

    m_bExpand = false;
    QString t = msg->getPlainText();
    if (!t.isEmpty())
        m_edit->m_edit->setText(t);
    m_panel	= NULL;
    setEditable(true);
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    parent->addWidget(this);
    btnTranslit = new QToolButton(parent);
    btnTranslit->setIconSet(*Icon("translit"));
    btnTranslit->setTextLabel(i18n("Send in translit"));
    btnTranslit->setToggleButton(true);
    parent->addWidget(btnTranslit);
    btnTranslit->show();
    parent->setText(i18n("Phone:"));
    m_edit->m_edit->setTextFormat(PlainText);
    Command cmd;
    cmd->id    = CmdSend;
    cmd->param = m_edit;
    Event e(EventCommandWidget, cmd);
    btnSend = (QToolButton*)(e.process());
    connect(lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(m_edit->m_edit, SIGNAL(textChanged()), this, SLOT(textChanged()));
    connect(btnTranslit, SIGNAL(toggled(bool)), this, SLOT(translitToggled(bool)));
    Contact *contact = getContacts()->contact(msg->contact());
    if (contact == NULL)
        return;
    SMSUserData *data = (SMSUserData*)(contact->getUserData(CorePlugin::m_plugin->sms_data_id));
    btnTranslit->setOn(data->SMSTranslit);
    QString phones = contact->getPhones();
    while (phones.length()){
        QString phoneItem = getToken(phones, ';', false);
        phoneItem = getToken(phoneItem, '/', false);
        QString phone = getToken(phoneItem, ',');
        getToken(phoneItem, ',');
        if (phoneItem.toUInt() == CELLULAR)
            insertItem(phone);
    }
    t = static_cast<SMSMessage*>(msg)->getPhone();
    if (!t.isEmpty())
        lineEdit()->setText(t);
    textChanged();
    if (contact->getTemporary()){
        m_panel = new SMSPanel(m_edit->m_frame);
        m_edit->m_layout->insertWidget(0, m_panel);
        connect(m_panel, SIGNAL(destroyed()), this, SLOT(panelDestroyed()));
        m_panel->show();
    }
    if (m_edit->m_edit->text().isEmpty()){
        TemplateExpand t;
        if (data->SMSSignatureBefore){
            t.tmpl = QString::fromUtf8(data->SMSSignatureBefore);
            t.contact  = contact;
            t.receiver = this;
            t.param    = NULL;
            Event eTmpl(EventTemplateExpand, &t);
            eTmpl.process();
        }else{
            m_bExpand = true;
            if (data->SMSSignatureAfter){
                t.tmpl = QString::fromUtf8(data->SMSSignatureAfter);
                t.contact = contact;
                t.receiver = this;
                t.param = NULL;
                Event eTmpl(EventTemplateExpand, &t);
                eTmpl.process();
            }
        }
    }
    show();
}