CViewer::CViewer() { KPluginFactory *factory=KPluginLoader("kfontviewpart").factory(); if(factory) { itsPreview=factory->create<KParts::ReadOnlyPart>(this); actionCollection()->addAction(KStandardAction::Open, this, SLOT(fileOpen())); actionCollection()->addAction(KStandardAction::Quit, this, SLOT(close())); actionCollection()->addAction(KStandardAction::KeyBindings, this, SLOT(configureKeys())); itsPrintAct=actionCollection()->addAction(KStandardAction::Print, itsPreview, SLOT(print())); itsPrintAct->setEnabled(false); if(itsPreview->browserExtension()) connect(itsPreview->browserExtension(), SIGNAL(enableAction(const char*,bool)), this, SLOT(enableAction(const char*,bool))); setCentralWidget(itsPreview->widget()); createGUI(itsPreview); setAutoSaveSettings(); applyMainWindowSettings(KSharedConfig::openConfig()->group("MainWindow")); } else
void GUI::setupActions() { KActionCollection* ac = actionCollection(); KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac); new_action->setToolTip(i18n("Create a new torrent")); KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac); open_action->setToolTip(i18n("Open a torrent")); paste_action = KStandardAction::paste(this, SLOT(paste()), ac); open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this); open_silently_action->setToolTip(i18n("Open a torrent without asking any questions")); connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently())); ac->addAction("file_open_silently", open_silently_action); KStandardAction::quit(this, SLOT(quit()), ac); show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac); show_status_bar_action->setIcon(KIcon("kt-show-statusbar")); show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac); KStandardAction::preferences(this, SLOT(showPrefDialog()), ac); KStandardAction::keyBindings(this, SLOT(configureKeys()), ac); KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac); KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac); paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this); paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported")); paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P)); connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL())); ac->addAction("paste_url", paste_url_action); ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this); ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses")); ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I)); connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter())); ac->addAction("ipfilter_action", ipfilter_action); import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this); import_action->setToolTip(i18n("Import a torrent")); import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I)); connect(import_action, SIGNAL(triggered()), this, SLOT(import())); ac->addAction("import", import_action); show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this); connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide())); ac->addAction("show_kt", show_kt_action); show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T)); setStandardToolBarMenuEnabled(true); }
RulesConfigWidget::RulesConfigWidget(QWidget* parent): QWidget(parent) { layout = new QHBoxLayout(this); leftWidget = new QWidget(this); leftLayout = new QVBoxLayout(leftWidget); rulesList = new QListWidget(this); leftLayout->addWidget(rulesList); QPushButton* upButton = new QPushButton(i18n("Up"), leftWidget); leftLayout->addWidget(upButton); QPushButton* downButton = new QPushButton(i18n("Down"), leftWidget); leftLayout->addWidget(downButton); newRuleButton = new QPushButton(i18n("New")); leftLayout->addWidget(newRuleButton); deleteRuleButton = new QPushButton(i18n("Delete")); leftLayout->addWidget(deleteRuleButton); layout->addWidget(leftWidget); rightWidget = new QWidget(this); rightLayout = new QFormLayout(rightWidget); QLabel *groupLabel = new QLabel(i18n("Group")); groupSelect = new QComboBox(rightWidget); rightLayout->addRow(groupLabel, groupSelect); QLabel *keyLabel = new QLabel(i18n("Key")); keySelect = new QComboBox; rightLayout->addRow(keyLabel, keySelect); QLabel *valueLabel = new QLabel(i18n("Value")); valueInput = new QLineEdit; rightLayout->addRow(valueLabel, valueInput); layout->addWidget(rightWidget); QObject::connect(rulesList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(currentItemChanged(QListWidgetItem*,QListWidgetItem*))); QObject::connect(newRuleButton, SIGNAL(clicked()), this, SLOT(createRule())); QObject::connect(deleteRuleButton, SIGNAL(clicked()), this, SLOT(deleteRule())); QObject::connect(upButton, SIGNAL(clicked()), this, SLOT(ruleUp())); QObject::connect(downButton, SIGNAL(clicked()), this, SLOT(ruleDown())); load(); configureKeys(); }
void KEYS::begin(uint8_t rows, uint16_t cols, uint8_t config) { _address = 0x34; Wire.begin(); configureKeys(rows, cols, config); }
KJotsMain::KJotsMain(const char* name) : KTopLevelWidget( name ) { //create widgets f_main = new QFrame( this, "Frame_0" ); f_main->move(0, 28); f_main->setMinimumSize( 500, 180 ); f_main->setFrameStyle( 0 ); f_text = new QFrame( f_main, "Frame_1" ); f_text->setGeometry( 8, 72, 452, 45 ); f_text->setFrameStyle( 50 ); f_labels = new QFrame( f_main, "Frame_2" ); f_labels->setMinimumSize( 436, 24 ); f_labels->setFrameStyle( 0 ); menubar = new KMenuBar( this, "MenuBar_1" ); // KMenubar is not a FRAME!!! (sven) //menubar->setFrameStyle( 34 ); //menubar->setLineWidth( 2 ); s_bar = new QScrollBar( f_main, "ScrollBar_1" ); s_bar->setMinimumSize( 452, 16 ); s_bar->setOrientation( QScrollBar::Horizontal ); me_text = new MyMultiEdit( f_text, "me_text" ); me_text->setMinimumSize( 436, 30 ); me_text->insertLine( "" ); l_folder = new QLabel( f_labels, "Label_4" ); l_folder->setMinimumSize( 68, 20 ); l_folder->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); l_folder->setText( "" ); le_subject = new QLineEdit( f_labels, "le_subject" ); le_subject->setMinimumSize( 56, 20 ); le_subject->setText( "" ); le_subject->setFocusPolicy(QWidget::ClickFocus); bg_top = new MyButtonGroup( f_main, "ButtonGroup_2" ); bg_top->setMinimumSize( 452, 32 ); bg_top->setFrameStyle( 49 ); bg_top->setTitle( "" ); bg_top->setAlignment( 1 ); bg_top->lower(); this->setMinimumSize(500, 211); KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup("kjots"); entrylist.setAutoDelete(TRUE); button_list.setAutoDelete(TRUE); folderOpen = FALSE; entrylist.append(new TextEntry); confdiag = NULL; subj_list = new SubjList; connect( this, SIGNAL(folderChanged(QList<TextEntry> *)), subj_list, SLOT(rebuildList( QList<TextEntry> *)) ); connect( this, SIGNAL(entryMoved(int)), subj_list, SLOT( select(int)) ); connect( subj_list, SIGNAL(entryMoved(int)), this, SLOT( barMoved(int)) ); connect( le_subject, SIGNAL(textChanged(const char *)), subj_list, SLOT(entryChanged(const char*)) ); me_text->setEnabled(FALSE); le_subject->setEnabled(FALSE); current = 0; connect( s_bar, SIGNAL(valueChanged(int)), this, SLOT(barMoved(int)) ); top2bottom = new QGridLayout( f_main, 4, 1, 4 ); top2bottom->addWidget( f_text, 0, 0, AlignCenter ); top2bottom->setRowStretch( 0, 1 ); top2bottom->addWidget( s_bar, 1, 0, AlignCenter ); top2bottom->addWidget( bg_top, 2, 0, AlignCenter ); top2bottom->addWidget( f_labels, 3, 0, AlignCenter ); top2bottom->activate(); labels_layout = new QGridLayout( f_labels, 1, 2, 0 ); labels_layout->addWidget( l_folder, 0, 0, AlignVCenter | AlignLeft ); labels_layout->addWidget( le_subject, 0, 1, AlignVCenter | AlignLeft ); labels_layout->setColStretch( 1, 1 ); labels_layout->activate(); QFont font_label(l_folder->fontInfo().family()); font_label.setBold(TRUE); l_folder->setFont(font_label); f_text_layout = new QGridLayout( f_text, 2, 1, 4 ); f_text_layout->addWidget( me_text, 0, 0, AlignCenter ); f_text_layout->setRowStretch( 0, 1 ); f_text_layout->activate(); s_bar->setRange(0,0); s_bar->setValue(0); s_bar->setSteps(1,1); bg_top->setExclusive(TRUE); me_text->setFocusPolicy(QWidget::StrongFocus); // read hotlist config->readListEntry( "Hotlist", hotlist ); while( hotlist.count() > HOT_LIST_SIZE ) hotlist.removeLast(); // read list of folders config->readListEntry( "Folders", folder_list ); QString temp; folders = new QPopupMenu; int i = 0; QPushButton *temp_button; for( temp = folder_list.first(); !temp.isEmpty(); temp = folder_list.next(), i++ ) { folders->insertItem(temp, i); if( hotlist.contains(temp) ) { temp_button = new QPushButton(temp, bg_top); temp_button->setFocusPolicy(QWidget::ClickFocus); temp_button->setToggleButton(TRUE); temp_button->setFixedSize(BUTTON_WIDTH,24); bg_top->insert(temp_button, i); button_list.append(temp_button); } } unique_id = i+1; connect( folders, SIGNAL(activated(int)), this, SLOT(openFolder(int)) ); connect( bg_top, SIGNAL(clicked(int)), this, SLOT(openFolder(int)) ); updateConfiguration(); // creat keyboard shortcuts // CTRL+Key_J := previous page // CTRL+Key_K := next page // CTRL+Key_L := show subject list // CTRL+Key_A := add new page // CTRL+Key_M := move focus keys = new KAccel( this ); keys->insertStdItem( KAccel::New, klocale->translate("New Book") ); keys->connectItem( KAccel::New, this, SLOT(createFolder()) ); keys->connectItem( KAccel::Save , this, SLOT(saveFolder()) ); keys->connectItem( KAccel::Quit, qApp, SLOT(quit()) ); keys->connectItem( KAccel::Cut , me_text, SLOT(cut()) ); keys->connectItem( KAccel::Copy , me_text, SLOT(copyText()) ); keys->connectItem( KAccel::Paste , me_text, SLOT(paste()) ); keys->insertItem(i18n("PreviousPage"), "PreviousPage", CTRL+Key_J); keys->insertItem(i18n("NextPage"), "NextPage", CTRL+Key_K); keys->insertItem(i18n("ShowSubjectList"), "ShowSubjectList", CTRL+Key_L); keys->insertItem(i18n("AddNewPage"), "AddNewPage", CTRL+Key_A); keys->insertItem(i18n("MoveFocus"), "MoveFocus", CTRL+Key_M); keys->insertItem(i18n("CopySelection"), "CopySelection", CTRL+Key_Y); keys->connectItem( "PreviousPage", this, SLOT(prevEntry()) ); keys->connectItem( "NextPage", this, SLOT(nextEntry()) ); keys->connectItem( "ShowSubjectList", this, SLOT(toggleSubjList()) ); keys->connectItem( "AddNewPage", this, SLOT(newEntry()) ); keys->connectItem( "MoveFocus", this, SLOT(moveFocus()) ); keys->connectItem( "CopySelection", this, SLOT(copySelection()) ); keys->readSettings(); // create menu int id; QPopupMenu *file = new QPopupMenu; id = file->insertItem(klocale->translate("&New Book"), this, SLOT(createFolder())); keys->changeMenuAccel(file, id, KAccel::New); file->insertSeparator(); id = file->insertItem(klocale->translate("Save current book"), this, SLOT(saveFolder()) ); keys->changeMenuAccel(file, id, KAccel::Save); id = file->insertItem(klocale->translate("Save book to ascii file"), this, SLOT(writeBook()) ); id = file->insertItem(klocale->translate("Save page to ascii file"), this, SLOT(writePage()) ); file->insertSeparator(); id = file->insertItem(klocale->translate("Delete current book"), this, SLOT(deleteFolder()) ); file->insertSeparator(); id = file->insertItem(klocale->translate("&Quit"), qApp, SLOT( quit() )); keys->changeMenuAccel(file, id, KAccel::Quit); QPopupMenu *edit_menu = new QPopupMenu; id = edit_menu->insertItem(klocale->translate("C&ut"),me_text, SLOT(cut())); keys->changeMenuAccel(edit_menu, id, KAccel::Cut); id = edit_menu->insertItem(klocale->translate("&Copy") , me_text, SLOT(copyText()) ); keys->changeMenuAccel(edit_menu, id, KAccel::Copy); id = edit_menu->insertItem(klocale->translate("&Paste"), me_text, SLOT(paste())); keys->changeMenuAccel(edit_menu, id, KAccel::Paste); edit_menu->insertSeparator(); id = edit_menu->insertItem(klocale->translate("&New Page"), this, SLOT(newEntry()) ); keys->changeMenuAccel(edit_menu, id, "AddNewPage"); id = edit_menu->insertItem(klocale->translate("&Delete Page"), this, SLOT(deleteEntry()) ); QPopupMenu *options = new QPopupMenu; options->insertItem(klocale->translate("&Config"), this, SLOT(configure()) ); options->insertItem(klocale->translate("Configure &Keys"), this, SLOT(configureKeys()) ); QPopupMenu *hotlist = new QPopupMenu; hotlist->insertItem(klocale->translate("Add current book to hotlist"), this, SLOT(addToHotlist()) ); hotlist->insertItem(klocale->translate("Remove current book from hotlist"), this, SLOT(removeFromHotlist()) ); menubar->insertItem( klocale->translate("&File"), file ); menubar->insertItem( klocale->translate("&Edit"), edit_menu ); menubar->insertItem( klocale->translate("Hot&list"), hotlist ); menubar->insertItem( klocale->translate("&Options"), options ); menubar->insertItem( klocale->translate("&Books"), folders ); menubar->insertSeparator(); QString about = "KJots 0.3.1\n\r(C) "; about += (QString) klocale->translate("by") + " Christoph Neerfeld\n\[email protected]"; menubar->insertItem( klocale->translate("&Help"), KApplication::getKApplication()->getHelpMenu(TRUE, about ) ); config->setGroup("kjots"); // create toolbar toolbar = new KToolBar(this); QPixmap temp_pix; temp_pix = global_pix_loader->loadIcon("filenew.xpm"); toolbar->insertButton(temp_pix, 0, SIGNAL(clicked()), this, SLOT(newEntry()), TRUE, i18n("New")); temp_pix = global_pix_loader->loadIcon("filedel.xpm"); toolbar->insertButton(temp_pix, 1, SIGNAL(clicked()), this, SLOT(deleteEntry()), TRUE, i18n("Delete")); temp_pix = global_pix_loader->loadIcon("back.xpm"); toolbar->insertButton(temp_pix, 2, SIGNAL(clicked()), this, SLOT(prevEntry()), TRUE, i18n("Previous")); temp_pix = global_pix_loader->loadIcon("forward.xpm"); toolbar->insertButton(temp_pix, 3, SIGNAL(clicked()), this, SLOT(nextEntry()), TRUE, i18n("Next")); toolbar->insertSeparator(); temp_pix = global_pix_loader->loadIcon("openbook.xpm"); toolbar->insertButton(temp_pix, 4, SIGNAL(clicked()), this, SLOT(toggleSubjList()), TRUE, i18n("Subject List")); toolbar->insertSeparator(); temp_pix = global_pix_loader->loadIcon("exit.xpm"); toolbar->setBarPos( (KToolBar::BarPosition) config->readNumEntry("ToolBarPos") ); addToolBar(toolbar); setView(f_main, FALSE); setMenu(menubar); enableToolBar(KToolBar::Show); QString last_folder = config->readEntry("LastOpenFolder"); int nr; if( (nr = folder_list.find(last_folder)) >= 0 ) openFolder(nr); int width, height; width = config->readNumEntry("Width"); height = config->readNumEntry("Height"); if( width < minimumSize().width() ) width = minimumSize().width(); if( height < minimumSize().height() ) height = minimumSize().height(); resize(width, height); }
void MainWindow::run() { // Allow the user to enable or disable debugging // We handle this before the other parameters, as it may affect some // early debug messages QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, parser->isSet("debug")); readSettings(); setAttribute(Qt::WA_DeleteOnClose, true); // menu structure QMenuBar *menuBar = QMainWindow::menuBar(); collection = new KActionCollection(this); QMenu *menu = new QMenu(i18n("&File"), this); menuBar->addMenu(menu); QAction *action = KStandardAction::open(this, SLOT(open()), collection); menu->addAction(collection->addAction(QLatin1String("file_open"), action)); action = new QAction(QIcon::fromTheme(QLatin1String("text-html"), QIcon(":text-html")), i18nc("@action:inmenu", "Open URL..."), collection); action->setShortcut(Qt::CTRL | Qt::Key_U); connect(action, SIGNAL(triggered(bool)), this, SLOT(openUrl())); menu->addAction(collection->addAction(QLatin1String("file_open_url"), action)); actionOpenRecent = KStandardAction::openRecent(this, SLOT(openUrl(QUrl)), collection); actionOpenRecent->loadEntries(KSharedConfig::openConfig()->group("Recent Files")); menu->addAction(collection->addAction(QLatin1String("file_open_recent"), actionOpenRecent)); menu->addSeparator(); action = new QAction(QIcon::fromTheme(QLatin1String("media-optical-audio"), QIcon(":media-optical-audio")), i18n("Play Audio CD"), collection); connect(action, SIGNAL(triggered(bool)), this, SLOT(openAudioCd())); menu->addAction(collection->addAction(QLatin1String("file_play_audiocd"), action)); action = new QAction(QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), i18n("Play Video CD"), collection); connect(action, SIGNAL(triggered(bool)), this, SLOT(openVideoCd())); menu->addAction(collection->addAction(QLatin1String("file_play_videocd"), action)); action = new QAction(QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), i18n("Play DVD"), collection); connect(action, SIGNAL(triggered(bool)), this, SLOT(openDvd())); menu->addAction(collection->addAction(QLatin1String("file_play_dvd"), action)); action = new QAction(QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), i18nc("@action:inmenu", "Play DVD Folder"), collection); connect(action, SIGNAL(triggered()), this, SLOT(playDvdFolder())); menu->addAction(collection->addAction(QLatin1String("file_play_dvd_folder"), action)); menu->addSeparator(); action = KStandardAction::quit(this, SLOT(close()), collection); menu->addAction(collection->addAction(QLatin1String("file_quit"), action)); QMenu *playerMenu = new QMenu(i18n("&Playback"), this); menuBar->addMenu(playerMenu); QMenu *playlistMenu = new QMenu(i18nc("menu bar", "Play&list"), this); menuBar->addMenu(playlistMenu); #if HAVE_DVB == 1 QMenu *dvbMenu = new QMenu(i18n("&Television"), this); menuBar->addMenu(dvbMenu); #endif /* HAVE_DVB == 1 */ menu = new QMenu(i18n("&Settings"), this); menuBar->addMenu(menu); action = KStandardAction::keyBindings(this, SLOT(configureKeys()), collection); menu->addAction(collection->addAction(QLatin1String("settings_keys"), action)); action = KStandardAction::preferences(this, SLOT(configureKaffeine()), collection); menu->addAction(collection->addAction(QLatin1String("settings_kaffeine"), action)); menuBar->addSeparator(); KHelpMenu *helpMenu = new KHelpMenu(this, *aboutData); menuBar->addMenu(helpMenu->menu()); // navigation bar - keep in sync with TabIndex enum! navigationBar = new QToolBar(QLatin1String("navigation_bar")); this->addToolBar(Qt::LeftToolBarArea, navigationBar); connect(navigationBar, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(navigationBarOrientationChanged(Qt::Orientation))); tabBar = new QTabBar(navigationBar); tabBar->addTab(QIcon::fromTheme(QLatin1String("start-here-kde"), QIcon(":start-here-kde")), i18n("Start")); tabBar->addTab(QIcon::fromTheme(QLatin1String("kaffeine"), QIcon(":kaffeine")), i18n("Playback")); tabBar->addTab(QIcon::fromTheme(QLatin1String("view-media-playlist"), QIcon(":view-media-playlist")), i18n("Playlist")); #if HAVE_DVB == 1 tabBar->addTab(QIcon::fromTheme(QLatin1String("video-television"), QIcon(":video-television")), i18n("Television")); #endif /* HAVE_DVB == 1 */ tabBar->setShape(QTabBar::RoundedWest); tabBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(activateTab(int))); navigationBar->addWidget(tabBar); // control bar controlBar = new QToolBar(QLatin1String("control_bar")); this->addToolBar(Qt::BottomToolBarArea, controlBar); controlBar->setToolButtonStyle(Qt::ToolButtonIconOnly); autoHideControlBar = false; cursorHideTimer = new QTimer(this); cursorHideTimer->setInterval(1500); cursorHideTimer->setSingleShot(true); connect(cursorHideTimer, SIGNAL(timeout()), this, SLOT(hideCursor())); // main area QWidget *widget = new QWidget(this); stackedLayout = new StackedLayout(widget); setCentralWidget(widget); mediaWidget = new MediaWidget(playerMenu, controlBar, collection, widget); connect(mediaWidget, SIGNAL(displayModeChanged()), this, SLOT(displayModeChanged())); connect(mediaWidget, SIGNAL(changeCaption(QString)), this, SLOT(setWindowTitle(QString))); connect(mediaWidget, SIGNAL(resizeToVideo(MediaWidget::ResizeFactor)), this, SLOT(resizeToVideo(MediaWidget::ResizeFactor))); // tabs - keep in sync with TabIndex enum! TabBase *startTab = new StartTab(this); tabs.append(startTab); stackedLayout->addWidget(startTab); playerTab = new PlayerTab(mediaWidget); playerTab->activate(); tabs.append(playerTab); stackedLayout->addWidget(playerTab); playlistTab = new PlaylistTab(playlistMenu, collection, mediaWidget); tabs.append(playlistTab); stackedLayout->addWidget(playlistTab); #if HAVE_DVB == 1 dvbTab = new DvbTab(dvbMenu, collection, mediaWidget); connect(this, SIGNAL(mayCloseApplication(bool*,QWidget*)), dvbTab, SLOT(mayCloseApplication(bool*,QWidget*))); tabs.append(dvbTab); stackedLayout->addWidget(dvbTab); #endif /* HAVE_DVB == 1 */ currentTabIndex = StartTabId; // actions also have to work if the menu bar is hidden (fullscreen) collection->addAssociatedWidget(this); // restore custom key bindings collection->readSettings(); // Tray menu menu = new QMenu(i18n("Kaffeine"), this); action = new QAction(i18n("Play &File"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(open())); menu->addAction(action); action = new QAction(i18n("Play &Audio CD"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(openAudioCd())); menu->addAction(action); action = new QAction(i18n("Play &Video CD"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(openVideoCd())); menu->addAction(action); action = new QAction(i18n("Play &DVD"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(openDvd())); menu->addAction(action); #if HAVE_DVB == 1 action = new QAction(i18n("&Watch Digital TV"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(playDvb())); menu->addAction(action); #endif action = new QAction(i18n("&Quit"), this); connect(action, SIGNAL(triggered(bool)), this, SLOT(close())); menu->addAction(action); // Tray Icon and its menu QMenu *trayMenu = new QMenu(this); trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayMenu); trayIcon->setIcon(QIcon::fromTheme(QLatin1String("kaffeine"), QIcon(":kaffeine"))); trayIcon->setToolTip(i18n("Kaffeine")); trayIcon->setContextMenu(menu); // make sure that the bars are visible (fullscreen -> quit -> restore -> hidden) menuBar->show(); navigationBar->show(); controlBar->show(); trayIcon->show(); // workaround setAutoSaveSettings() which doesn't accept "IconOnly" as initial state controlBar->setToolButtonStyle(Qt::ToolButtonIconOnly); // initialize random number generator qsrand(QTime(0, 0, 0).msecsTo(QTime::currentTime())); // initialize dbus objects QDBusConnection::sessionBus().registerObject(QLatin1String("/"), new MprisRootObject(this), QDBusConnection::ExportAllContents); QDBusConnection::sessionBus().registerObject(QLatin1String("/Player"), new MprisPlayerObject(this, mediaWidget, playlistTab, this), QDBusConnection::ExportAllContents); QDBusConnection::sessionBus().registerObject(QLatin1String("/TrackList"), new MprisTrackListObject(playlistTab, this), QDBusConnection::ExportAllContents); #if HAVE_DVB == 1 QDBusConnection::sessionBus().registerObject(QLatin1String("/Television"), new DBusTelevisionObject(dvbTab, this), QDBusConnection::ExportAllContents); #endif /* HAVE_DVB == 1 */ QDBusConnection::sessionBus().registerService(QLatin1String("org.mpris.kaffeine")); show(); // set display mode switch (Configuration::instance()->getStartupDisplayMode()) { case Configuration::StartupNormalMode: // nothing to do break; case Configuration::StartupMinimalMode: mediaWidget->setDisplayMode(MediaWidget::MinimalMode); break; case Configuration::StartupFullScreenMode: mediaWidget->setDisplayMode(MediaWidget::FullScreenMode); break; case Configuration::StartupRememberLastSetting: { int value = KSharedConfig::openConfig()->group("MainWindow").readEntry("DisplayMode", 0); switch (value) { case 0: // nothing to do break; case 1: mediaWidget->setDisplayMode(MediaWidget::MinimalMode); break; case 2: mediaWidget->setDisplayMode(MediaWidget::FullScreenMode); break; } break; } } parseArgs(); }