void DkTransferToolBar::applyImageMode(int mode) { // At first check if the right mode is already set. If so, don't do nothing. if (mode == imageMode) return; if (imageMode == mode_invalid_format) { enableToolBar(true); emit channelChanged(0); } imageMode = mode; if (imageMode == mode_invalid_format) { enableToolBar(false); return; } enableTFCheckBox->setEnabled(true); disconnect(channelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChannel(int))); channelComboBox->clear(); if (mode == mode_gray) { channelComboBox->addItem(tr("Gray")); } else if (mode == mode_rgb) { channelComboBox->addItem(tr("RGB")); channelComboBox->addItem(tr("Red")); channelComboBox->addItem(tr("Green")); channelComboBox->addItem(tr("Blue")); } channelComboBox->setCurrentIndex(0); connect(channelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChannel(int))); };
void DkTransferToolBar::enableTFCheckBoxClicked(int state) { bool enabled; if (state == Qt::Checked) enabled = true; else enabled = false; enableToolBar(enabled); // At this point the checkbox is disabled, hence enable it... enableTFCheckBox->setEnabled(true); if (enabled) enableTFCheckBox->setStatusTip(tr("Disables the Pseudo Color function")); else enableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function")); emit tFEnabled(enabled); emit gradientChanged(); }
void QDBase::setOverrideFlags(const OverrideFlags & flags) { bool do_layout=false; OverrideFlags old_flags=override_flags; override_flags=flags; if (old_flags.toolbar != flags.toolbar) enableToolBar(flags.toolbar && prefs.toolBarOn); if (flags.toolbaropts & OverrideFlags::TOOLBAR_ALWAYS) stickToolBar(); else if (flags.toolbaropts & OverrideFlags::TOOLBAR_AUTO) unStickToolBar(); else if (prefs.toolBarAlwaysVisible) stickToolBar(); else unStickToolBar(); if (flags.thumbnails) showThumbnails(); else hideThumbnails(); if (old_flags.hilite_rects.size()!=flags.hilite_rects.size() || old_flags.url!=flags.url) { createMapAreas(true); } if (old_flags.hor_align!=flags.hor_align || old_flags.ver_align!=flags.ver_align) do_layout = true; if (toolbar && old_flags.toolbaropts != flags.toolbaropts) { toolbar->setOptions(override_flags.toolbaropts); do_layout = true; } if (do_layout) layout(); setCursor(); }
DkTransferToolBar::DkTransferToolBar(QWidget * parent) : QToolBar(tr("Pseudo Color Toolbar"), parent) { loadSettings(); enableTFCheckBox = new QCheckBox(tr("Enable")); enableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function")); this->addWidget(enableTFCheckBox); // >DIR: more compact gui [2.3.2012 markus] this->addSeparator(); //this->addWidget(new QLabel(tr("Active channel:"))); channelComboBox = new QComboBox(this); channelComboBox->setStatusTip(tr("Changes the displayed color channel")); this->addWidget(channelComboBox); historyCombo = new QComboBox(this); QAction* delGradientAction = new QAction(tr("Delete"), historyCombo); connect(delGradientAction, SIGNAL(triggered()), this, SLOT(deleteGradient())); historyCombo->addAction(delGradientAction); historyCombo->setContextMenuPolicy(Qt::ActionsContextMenu); updateGradientHistory(); connect(historyCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(switchGradient(int))); connect(historyCombo, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(deleteGradientMenu(QPoint))); this->addWidget(historyCombo); createIcons(); gradient = new DkGradient(this); gradient->setStatusTip(tr("Click into the field for a new slider")); this->addWidget(gradient); effect = new QGraphicsOpacityEffect(gradient); effect->setOpacity(1); gradient->setGraphicsEffect(effect); // Disable the entire transfer toolbar: //enableTF(Qt::Unchecked); // Initialize the combo box for color images: imageMode = mode_uninitialized; applyImageMode(mode_rgb); enableToolBar(false); enableTFCheckBox->setEnabled(true); connect(enableTFCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableTFCheckBoxClicked(int))); connect(gradient, SIGNAL(gradientChanged()), this, SLOT(applyTF())); // needed for initialization connect(this, SIGNAL(gradientChanged()), gradient, SIGNAL(gradientChanged())); if (!oldGradients.empty()) gradient->setGradient(oldGradients.first()); };
void HexWidget::menuCallback(int item) { switch (item) { HexWidget *dummy; case ID_FILE_NEWWIN: { dummy = new HexWidget(); break; } case ID_FILE_OPEN: { if (CurrentFile->isModified()) if (QMessageBox::warning(0, i18n("Warning"), i18n("The current file has been modified.\nDo you want to save it?"), i18n("Yes"), i18n("No"))) CurrentFile->save(); QString fileName = KFileDialog::getOpenFileName(); open(fileName, READWRITE); break; } case ID_FILE_SAVE: if (CurrentFile->isModified()) CurrentFile->save(); break; case ID_FILE_SAVEAS: { QString fileName = KFileDialog::getSaveFileName(); CurrentFile->setFileName(fileName.data()); CurrentFile->save(); break; } case ID_FILE_CLOSE: { if (CurrentFile->isModified()) { if (!QMessageBox::warning(0, i18n("Warning"), i18n("The current file has been modified.\nDiscard your changes?"), i18n("No"), i18n("Yes"))) return; } close(); break; } case ID_FILE_QUIT: { for (HexWidget *w = windowList.first(); w ; w = windowList.next()) w->close(); kapp->exit(); break; } case ID_EDIT_COPY: { CurrentFile->copyClipBoard(); break; } case ID_VIEW_TOOLBAR: enableToolBar(KToolBar::Toggle); break; case ID_VIEW_STATUSBAR: enableStatusBar(); break; } }
KHelpMain::KHelpMain(const char *name) :KTopLevelWidget(name) { helpwin = new KHelpWindow(this, name); CHECK_PTR(helpwin); DOCS_PATH = kapp->kde_htmldir() + "/default/kdehelp/"; createMenu(); createLocationbar(); createToolbar(); createStatusbar(); setMenu(menu); setStatusBar(statusbar); addToolBar(toolbar); addToolBar(location); setView(helpwin); readConfig(); menu->show(); if (showStatusBar) enableStatusBar(KStatusBar::Show); else enableStatusBar(KStatusBar::Hide); if (showToolBar) enableToolBar(KToolBar::Show); else enableToolBar(KToolBar::Hide); helpwin->show(); helpWindowList.setAutoDelete(FALSE); helpWindowList.append( this ); helpWindowList.first()->enableMenuItems(); enableMenuItems(); if ( optionsDialog ) { connect( optionsDialog->fontOptions, SIGNAL(fontSize( int )), helpwin, SLOT(slotFontSize( int )) ); connect( optionsDialog->fontOptions, SIGNAL(standardFont( const char * )), helpwin, SLOT(slotStandardFont( const char * )) ); connect( optionsDialog->fontOptions, SIGNAL(fixedFont( const char * )), helpwin, SLOT(slotFixedFont( const char * )) ); connect( optionsDialog->colorOptions, SIGNAL(colorsChanged(const QColor&, const QColor&, const QColor&, const QColor&, const bool, const bool )), helpwin, SLOT(slotColorsChanged(const QColor&, const QColor&, const QColor&, const QColor&, const bool, const bool)) ); } setMinimumSize( 200, 100 ); connect (helpwin, SIGNAL ( enableMenuItems() ), this, SLOT ( slotEnableMenuItems() ) ); connect (helpwin, SIGNAL ( openNewWindow(const char *) ), this, SLOT ( slotNewWindow(const char *) ) ); connect (helpwin, SIGNAL ( setURL(const char *) ), this, SLOT ( slotSetStatusText(const char *) ) ); connect (helpwin, SIGNAL ( setLocation(const char *) ), this, SLOT ( slotSetLocation(const char *) ) ); connect (helpwin, SIGNAL ( bookmarkChanged(KBookmark *) ), this, SLOT ( slotBookmarkChanged(KBookmark *) ) ); connect( helpwin, SIGNAL( setTitle(const char *) ), this, SLOT( slotSetTitle(const char *) ) ); optionsMenu->setItemChecked( optionsMenu->idAt( 2 ), showToolBar ); optionsMenu->setItemChecked( optionsMenu->idAt( 3 ), showLocationBar); optionsMenu->setItemChecked( optionsMenu->idAt( 4 ), showStatusBar ); if (showLocationBar) location->enable(KToolBar::Show); else location->enable(KToolBar::Hide); // restore geometry settings KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "Appearance" ); QString geom = config->readEntry( "Geometry" ); if ( !geom.isEmpty() ) { int width, height; sscanf( geom, "%dx%d", &width, &height ); resize( width, height ); } // put bookmarks into boormark menu helpwin->slotBookmarkChanged(); }
KfindTop::KfindTop(const char *searchPath) : KTopLevelWidget() { // setCaption(QString("KFind ")+KFIND_VERSION); _toolBar = new KToolBar( this, "_toolBar" ); _toolBar->setBarPos( KToolBar::Top ); _toolBar->show(); enableToolBar( KToolBar::Show, addToolBar( _toolBar ) ); _kfind = new Kfind(this,"dialog",searchPath); setView( _kfind, FALSE ); _kfind->show(); menuInit(); toolBarInit(); setMenu(_mainMenu); _mainMenu->show(); //_mainMenu->enableMoving(false); _statusBar = new KStatusBar( this, "_statusBar"); _statusBar->insertItem("0 file(s) found", 0); _statusBar->enable(KStatusBar::Hide); setStatusBar( _statusBar ); connect(_kfind,SIGNAL(haveResults(bool)), this,SLOT(enableSaveResults(bool))); connect(_kfind,SIGNAL(resultSelected(bool)), this,SLOT(enableMenuItems(bool))); connect(this,SIGNAL(deleteFile()), _kfind,SIGNAL(deleteFile())); connect(this,SIGNAL(properties()), _kfind,SIGNAL(properties())); connect(this,SIGNAL(openFolder()), _kfind,SIGNAL(openFolder())); connect(this,SIGNAL(saveResults()), _kfind,SIGNAL(saveResults())); connect(this,SIGNAL(addToArchive()), _kfind,SIGNAL(addToArchive())); connect(this,SIGNAL(open()), _kfind,SIGNAL(open())); connect(_kfind ,SIGNAL(statusChanged(const char *)), this,SLOT(statusChanged(const char *))); connect(_kfind ,SIGNAL(enableSearchButton(bool)), this,SLOT(enableSearchButton(bool))); connect(_kfind ,SIGNAL(enableStatusBar(bool)), this,SLOT(enableStatusBar(bool))); // No, No, No!!! This is pointless! (sven) // connect(_mainMenu ,SIGNAL(moved(menuPosition)), // this,SLOT(resizeOnFloating())); // connect(_toolBar ,SIGNAL(moved(BarPosition)), // this,SLOT(resizeOnFloating())); //_width=(440>_toolBar->width())?440:_toolBar->width(); _width=520; //_height=(_kfind->sizeHint()).height(); // Unused as far as I can tell // Fixed and Y-fixed guys: Please, please, please stop setting fixed size // on KTW! Fix it on your main view! // sven this->enableStatusBar(false); // _kfile emited before connected (sven) }; // and what's this semi-colon for? Grrrr!!!! (sven, too)
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 kdvi::applyShowButtons() { enableToolBar( hideButtons ? KToolBar::Hide : KToolBar::Show ); optionsmenu->setItemChecked( optionsmenu->idAt(ID_OPT_BB), !hideButtons ); config->writeEntry( "HideButtons", hideButtons ); }