DiagramDialog::DiagramDialog(Diagram *d, const QString& _DataSet, QWidget *parent, Graph *currentGraph) : QDialog(parent, 0, TRUE, Qt::WDestructiveClose) { Diag = d; Graphs.setAutoDelete(true); copyDiagramGraphs(); // make a copy of all graphs defaultDataSet = _DataSet; setCaption(tr("Edit Diagram Properties")); changed = false; transfer = false; // have changes be applied ? (used by "Cancel") toTake = false; // double-clicked variable be inserted into graph list ? Expr.setPattern("[^\"]+"); Validator = new QRegExpValidator(Expr, this); ValInteger = new QIntValidator(0, 360, this); ValDouble = new QDoubleValidator(-1e200, 1e200, 6, this); QString NameY, NameZ; if((Diag->Name == "Rect") || (Diag->Name == "Curve")) { NameY = tr("left Axis"); NameZ = tr("right Axis"); } else if(Diag->Name == "Polar") { NameY = tr("y-Axis"); } else if((Diag->Name == "Smith") || (Diag->Name == "ySmith")) { NameY = tr("y-Axis"); } else if(Diag->Name == "PS") { NameY = tr("smith Axis"); NameZ = tr("polar Axis"); } else if(Diag->Name == "SP") { NameY = tr("polar Axis"); NameZ = tr("smith Axis"); } else if(Diag->Name == "Rect3D") { NameY = tr("y-Axis"); NameZ = tr("z-Axis"); } all = new QVBoxLayout(this); // to provide neccessary size QTabWidget *t = new QTabWidget(this); all->addWidget(t); // ........................................................... QVBox *Tab1 = new QVBox(this); Tab1->setSpacing(5); Label4 = 0; // different types with same content yrLabel = 0; yAxisBox = 0; Property2 = 0; ColorButt = 0; hideInvisible = 0; rotationX = rotationY = rotationZ = 0; QVButtonGroup *InputGroup = new QVButtonGroup(tr("Graph Input"), Tab1); GraphInput = new QLineEdit(InputGroup); GraphInput->setValidator(Validator); connect(GraphInput, SIGNAL(textChanged(const QString&)), SLOT(slotResetToTake(const QString&))); QHBox *Box2 = new QHBox(InputGroup); Box2->setSpacing(5); if(Diag->Name == "Tab") { Label1 = new QLabel(tr("Number Notation: "), Box2); PropertyBox = new QComboBox(Box2); PropertyBox->insertItem(tr("real/imaginary")); PropertyBox->insertItem(tr("magnitude/angle (degree)")); PropertyBox->insertItem(tr("magnitude/angle (radian)")); PropertyBox->setCurrentItem(1); connect(PropertyBox, SIGNAL(activated(int)), SLOT(slotSetNumMode(int))); Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder Label2 = new QLabel(tr("Precision:"), Box2); Property2 = new QLineEdit(Box2); Property2->setValidator(ValInteger); Property2->setMaxLength(2); Property2->setMaximumWidth(25); Property2->setText("3"); } else if(Diag->Name != "Truth") { Label1 = new QLabel(tr("Color:"),Box2); ColorButt = new QPushButton(" ",Box2); ColorButt->setMinimumWidth(50); ColorButt->setEnabled(false); connect(ColorButt, SIGNAL(clicked()), SLOT(slotSetColor())); Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder Label3 = new QLabel(tr("Style:"),Box2); Label3->setEnabled(false); PropertyBox = new QComboBox(Box2); PropertyBox->insertItem(tr("solid line")); PropertyBox->insertItem(tr("dash line")); PropertyBox->insertItem(tr("dot line")); if(Diag->Name != "Time") { PropertyBox->insertItem(tr("long dash line")); PropertyBox->insertItem(tr("stars")); PropertyBox->insertItem(tr("circles")); PropertyBox->insertItem(tr("arrows")); } connect(PropertyBox, SIGNAL(activated(int)), SLOT(slotSetGraphStyle(int))); Box2->setStretchFactor(new QWidget(Box2), 5); // stretchable placeholder Label2 = new QLabel(tr("Thickness:"),Box2); Property2 = new QLineEdit(Box2); Property2->setValidator(ValInteger); Property2->setMaximumWidth(25); Property2->setMaxLength(2); Property2->setText("0"); if((Diag->Name=="Rect") || (Diag->Name=="PS") || (Diag->Name=="SP") || (Diag->Name=="Curve")) { QHBox *Box3 = new QHBox(InputGroup); Box3->setSpacing(5); Label4 = new QLabel(tr("y-Axis:"),Box3); Label4->setEnabled(false); yAxisBox = new QComboBox(Box3); yAxisBox->insertItem(NameY); yAxisBox->insertItem(NameZ); yAxisBox->setEnabled(false); connect(yAxisBox, SIGNAL(activated(int)), SLOT(slotSetYAxis(int))); Box3->setStretchFactor(new QWidget(Box3), 5); // stretchable placeholder } } if(Property2) { connect(Property2, SIGNAL(textChanged(const QString&)), SLOT(slotSetProp2(const QString&))); Label1->setEnabled(false); PropertyBox->setEnabled(false); Label2->setEnabled(false); Property2->setEnabled(false); } QHBox *Box1 = new QHBox(Tab1); Box1->setSpacing(5); QVButtonGroup *DataGroup = new QVButtonGroup(tr("Dataset"), Box1); ChooseData = new QComboBox(false, DataGroup); ChooseData->setMinimumWidth(200); connect(ChooseData, SIGNAL(activated(int)), SLOT(slotReadVars(int))); ChooseVars = new QListView(DataGroup); ChooseVars->addColumn(tr("Name")); ChooseVars->addColumn(tr("Type")); ChooseVars->addColumn(tr("Size")); connect(ChooseVars, SIGNAL(doubleClicked(QListViewItem*)), SLOT(slotTakeVar(QListViewItem*))); QVButtonGroup *GraphGroup = new QVButtonGroup(tr("Graph"), Box1); GraphList = new QListBox(GraphGroup); connect(GraphList, SIGNAL(clicked(QListBoxItem*)), SLOT(slotSelectGraph(QListBoxItem*))); QPushButton *NewButt = new QPushButton(tr("New Graph"), GraphGroup); connect(NewButt, SIGNAL(clicked()), SLOT(slotNewGraph())); QPushButton *DelButt = new QPushButton(tr("Delete Graph"), GraphGroup); connect(DelButt, SIGNAL(clicked()), SLOT(slotDeleteGraph())); t->addTab(Tab1, tr("Data")); // ........................................................... int Row = 0; if(Diag->Name.at(0) != 'T') { // not tabular or timing diagram QWidget *Tab2 = new QWidget(t); QGridLayout *gp = new QGridLayout(Tab2,13,3,5,5); gp->addMultiCellWidget(new QLabel(tr("x-Axis Label:"), Tab2), Row,Row,0,0); xLabel = new QLineEdit(Tab2); xLabel->setValidator(Validator); gp->addMultiCellWidget(xLabel, Row,Row,1,2); Row++; gp->addMultiCellWidget( new QLabel(NameY+" "+tr("Label:"), Tab2), Row,Row,0,0); ylLabel = new QLineEdit(Tab2); ylLabel->setValidator(Validator); gp->addMultiCellWidget(ylLabel, Row,Row,1,2); Row++; if((Diag->Name != "Smith") && (Diag->Name != "Polar")) { gp->addMultiCellWidget( new QLabel(NameZ +" "+tr("Label:"), Tab2), Row,Row,0,0); yrLabel = new QLineEdit(Tab2); yrLabel->setValidator(Validator); gp->addMultiCellWidget(yrLabel, Row,Row,1,2); Row++; } gp->addMultiCellWidget(new QLabel( tr("<b>Label text</b>: Use LaTeX style for special characters, e.g. \\tau"), Tab2), Row,Row,0,2); Row++; if(Diag->Name != "Rect3D") { GridOn = new QCheckBox(tr("show Grid"), Tab2); gp->addMultiCellWidget(GridOn, Row,Row,0,2); Row++; GridLabel1 = new QLabel(tr("Grid Color:"),Tab2); gp->addMultiCellWidget(GridLabel1, Row,Row,0,0); GridColorButt = new QPushButton(" ",Tab2); connect(GridColorButt, SIGNAL(clicked()), SLOT(slotSetGridColor())); gp->addMultiCellWidget(GridColorButt, Row,Row,1,2); Row++; GridColorButt->setPaletteBackgroundColor(Diag->GridPen.color()); GridLabel2 = new QLabel(tr("Grid Style: "), Tab2); gp->addMultiCellWidget(GridLabel2, Row,Row,0,0); GridStyleBox = new QComboBox(Tab2); GridStyleBox->insertItem(tr("solid line")); GridStyleBox->insertItem(tr("dash line")); GridStyleBox->insertItem(tr("dot line")); GridStyleBox->insertItem(tr("dash dot line")); GridStyleBox->insertItem(tr("dash dot dot line")); gp->addMultiCellWidget(GridStyleBox, Row,Row,1,2); Row++; GridStyleBox->setCurrentItem(Diag->GridPen.style()-1); GridOn->setChecked(Diag->xAxis.GridOn); if(!Diag->xAxis.GridOn) slotSetGridBox(QButton::Off); connect(GridOn, SIGNAL(stateChanged(int)), SLOT(slotSetGridBox(int))); } else { GridOn = 0; GridColorButt = 0; GridStyleBox = 0; } // ........................................................... xLabel->setText(Diag->xAxis.Label); ylLabel->setText(Diag->yAxis.Label); if(yrLabel) yrLabel->setText(Diag->zAxis.Label); if((Diag->Name.left(4) == "Rect") || (Diag->Name == "Curve")) { GridLogX = new QCheckBox(tr("logarithmical X Axis Grid"), Tab2); gp->addMultiCellWidget(GridLogX, Row,Row,0,2); Row++; GridLogY = new QCheckBox(tr("logarithmical")+" "+NameY+" "+tr("Grid"), Tab2); gp->addMultiCellWidget(GridLogY, Row,Row,0,2); Row++; GridLogZ = new QCheckBox(tr("logarithmical")+" "+NameZ+" "+tr("Grid"), Tab2); gp->addMultiCellWidget(GridLogZ, Row,Row,0,2); Row++; // ........................................................... // transfer the diagram properties to the dialog GridLogX->setChecked(Diag->xAxis.log); GridLogY->setChecked(Diag->yAxis.log); GridLogZ->setChecked(Diag->zAxis.log); if(Diag->Name == "Rect3D") { hideInvisible = new QCheckBox(tr("hide invisible lines"), Tab2); gp->addMultiCellWidget(hideInvisible, Row,Row,0,2); Row++; QLabel *LabelRotX = new QLabel(tr("Rotation around x-Axis:"), Tab2); LabelRotX->setPaletteForegroundColor(Qt::red); gp->addWidget(LabelRotX, Row,0); SliderRotX = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotX, Qt::Horizontal, Tab2); gp->addWidget(SliderRotX, Row,1); connect(SliderRotX, SIGNAL(valueChanged(int)), SLOT(slotNewRotX(int))); rotationX = new QLineEdit(Tab2); rotationX->setValidator(ValInteger); rotationX->setMaxLength(3); rotationX->setMaximumWidth(40); gp->addWidget(rotationX, Row,2); connect(rotationX, SIGNAL(textChanged(const QString&)), SLOT(slotEditRotX(const QString&))); Row++; QLabel *LabelRotY = new QLabel(tr("Rotation around y-Axis:"), Tab2); LabelRotY->setPaletteForegroundColor(Qt::green); gp->addWidget(LabelRotY, Row,0); SliderRotY = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotY, Qt::Horizontal, Tab2); gp->addWidget(SliderRotY, Row,1); connect(SliderRotY, SIGNAL(valueChanged(int)), SLOT(slotNewRotY(int))); rotationY = new QLineEdit(Tab2); rotationY->setValidator(ValInteger); rotationY->setMaxLength(3); rotationY->setMaximumWidth(40); gp->addWidget(rotationY, Row,2); connect(rotationY, SIGNAL(textChanged(const QString&)), SLOT(slotEditRotY(const QString&))); Row++; QLabel *LabelRotZ = new QLabel(tr("Rotation around z-Axis:"), Tab2); LabelRotZ->setPaletteForegroundColor(Qt::blue); gp->addWidget(LabelRotZ, Row,0); SliderRotZ = new QSlider(0,360,20, ((Rect3DDiagram*)Diag)->rotZ, Qt::Horizontal, Tab2); gp->addWidget(SliderRotZ, Row,1); connect(SliderRotZ, SIGNAL(valueChanged(int)), SLOT(slotNewRotZ(int))); rotationZ = new QLineEdit(Tab2); rotationZ->setValidator(ValInteger); rotationZ->setMaxLength(3); rotationZ->setMaximumWidth(40); gp->addWidget(rotationZ, Row,2); connect(rotationZ, SIGNAL(textChanged(const QString&)), SLOT(slotEditRotZ(const QString&))); Row++; gp->addWidget(new QLabel(tr("2D-projection:"), Tab2), Row,0); DiagCross = new Cross3D(((Rect3DDiagram*)Diag)->rotX, ((Rect3DDiagram*)Diag)->rotY, ((Rect3DDiagram*)Diag)->rotZ, Tab2); gp->addWidget(DiagCross, Row,1); // transfer the diagram properties to the dialog hideInvisible->setChecked(Diag->hideLines); rotationX->setText(QString::number(((Rect3DDiagram*)Diag)->rotX)); rotationY->setText(QString::number(((Rect3DDiagram*)Diag)->rotY)); rotationZ->setText(QString::number(((Rect3DDiagram*)Diag)->rotZ)); } } else GridLogX = GridLogY = GridLogZ = 0; t->addTab(Tab2, tr("Properties")); // ........................................................... QVBox *Tab3 = new QVBox(this); Tab1->setSpacing(5); QHGroupBox *axisX = new QHGroupBox(tr("x-Axis"), Tab3); QVBox *VBox1 = new QVBox(axisX); VBox1->setStretchFactor(new QWidget(VBox1),5); // stretchable placeholder manualX = new QCheckBox(tr("manual"), VBox1); connect(manualX, SIGNAL(stateChanged(int)), SLOT(slotManualX(int))); QVBox *VBox2 = new QVBox(axisX); new QLabel(tr("start"), VBox2); startX = new QLineEdit(VBox2); startX->setValidator(ValDouble); QVBox *VBox3 = new QVBox(axisX); new QLabel(tr("step"), VBox3); stepX = new QLineEdit(VBox3); stepX->setValidator(ValDouble); QVBox *VBox4 = new QVBox(axisX); new QLabel(tr("stop"), VBox4); stopX = new QLineEdit(VBox4); stopX->setValidator(ValDouble); QHGroupBox *axisY; axisY = new QHGroupBox(NameY, Tab3); QVBox *VBox5 = new QVBox(axisY); VBox5->setStretchFactor(new QWidget(VBox5),5); // stretchable placeholder manualY = new QCheckBox(tr("manual"), VBox5); connect(manualY, SIGNAL(stateChanged(int)), SLOT(slotManualY(int))); QVBox *VBox6 = new QVBox(axisY); new QLabel(tr("start"), VBox6); startY = new QLineEdit(VBox6); startY->setValidator(ValDouble); QVBox *VBox7 = new QVBox(axisY); if((Diag->Name=="Smith") || (Diag->Name=="ySmith") || (Diag->Name=="PS")) new QLabel(tr("number"), VBox7); else new QLabel(tr("step"), VBox7); stepY = new QLineEdit(VBox7); stepY->setValidator(ValDouble); QVBox *VBox8 = new QVBox(axisY); new QLabel(tr("stop"), VBox8); stopY = new QLineEdit(VBox8); stopY->setValidator(ValDouble); QHGroupBox *axisZ; axisZ = new QHGroupBox(NameZ, Tab3); QVBox *VBox9 = new QVBox(axisZ); VBox9->setStretchFactor(new QWidget(VBox9),5); // stretchable placeholder manualZ = new QCheckBox(tr("manual"), VBox9); connect(manualZ, SIGNAL(stateChanged(int)), SLOT(slotManualZ(int))); QVBox *VBox10 = new QVBox(axisZ); new QLabel(tr("start"), VBox10); startZ = new QLineEdit(VBox10); startZ->setValidator(ValDouble); QVBox *VBox11 = new QVBox(axisZ); if(Diag->Name == "SP") new QLabel(tr("number"), VBox11); else new QLabel(tr("step"), VBox11); stepZ = new QLineEdit(VBox11); stepZ->setValidator(ValDouble); QVBox *VBox12 = new QVBox(axisZ); new QLabel(tr("stop"), VBox12); stopZ = new QLineEdit(VBox12); stopZ->setValidator(ValDouble); Tab3->setStretchFactor(new QWidget(Tab3),5); // stretchable placeholder t->addTab(Tab3, tr("Limits")); // ........................................................... // transfer the diagram properties to the dialog if(Diag->xAxis.autoScale) slotManualX(QButton::Off); else manualX->setChecked(true); if(Diag->yAxis.autoScale) slotManualY(QButton::Off); else manualY->setChecked(true); if(Diag->zAxis.autoScale) slotManualZ(QButton::Off); else manualZ->setChecked(true); Diag->calcLimits(); // inserts auto-scale values if not manual startX->setText(QString::number(Diag->xAxis.limit_min)); stepX->setText(QString::number(Diag->xAxis.step)); stopX->setText(QString::number(Diag->xAxis.limit_max)); startY->setText(QString::number(Diag->yAxis.limit_min)); stepY->setText(QString::number(Diag->yAxis.step)); stopY->setText(QString::number(Diag->yAxis.limit_max)); startZ->setText(QString::number(Diag->zAxis.limit_min)); stepZ->setText(QString::number(Diag->zAxis.step)); stopZ->setText(QString::number(Diag->zAxis.limit_max)); if((Diag->Name == "Smith") || (Diag->Name == "ySmith") || (Diag->Name == "Polar")) { axisZ->setEnabled(false); } if(Diag->Name.left(4) != "Rect") // cartesian 2D and 3D if(Diag->Name != "Curve") { axisX->setEnabled(false); startY->setEnabled(false); startZ->setEnabled(false); } } else stepX = 0; connect(t, SIGNAL(currentChanged(QWidget*)), SLOT(slotChangeTab(QWidget*))); // ........................................................... QHBox *Butts = new QHBox(this); Butts->setSpacing(5); Butts->setMargin(5); all->addWidget(Butts); QPushButton *OkButt = new QPushButton(tr("OK"), Butts); connect(OkButt, SIGNAL(clicked()), SLOT(slotOK())); QPushButton *ApplyButt = new QPushButton(tr("Apply"), Butts); connect(ApplyButt, SIGNAL(clicked()), SLOT(slotApply())); QPushButton *CancelButt = new QPushButton(tr("Cancel"), Butts); connect(CancelButt, SIGNAL(clicked()), SLOT(slotCancel())); OkButt->setDefault(true); // ........................................................... // put all data files into ComboBox QFileInfo Info(defaultDataSet); QDir ProjDir(Info.dirPath()); QStringList Elements = ProjDir.entryList("*.dat", QDir::Files, QDir::Name); QStringList::iterator it; for(it = Elements.begin(); it != Elements.end(); ++it) { ChooseData->insertItem((*it).left((*it).length()-4)); if((*it) == Info.fileName()) // default dataset should be the current ChooseData->setCurrentItem(ChooseData->count()-1); } slotReadVars(0); // put variables into the ListView // ........................................................... // put all graphs into the ListBox Row = 0; for(Graph *pg = Diag->Graphs.first(); pg != 0; pg = Diag->Graphs.next()) { GraphList->insertItem(pg->Var); if(pg == currentGraph) { GraphList->setCurrentItem(Row); // select current graph SelectGraph(currentGraph); } Row++; } if(ColorButt) if(!currentGraph) ColorButt->setPaletteBackgroundColor (QColor(DefaultColors[GraphList->count()])); }
BasicTab::BasicTab(QWidget *parent, const char *name) : QWidget(parent, name) { _menuFolderInfo = 0; _menuEntryInfo = 0; QGridLayout *layout = new QGridLayout(this, 6, 2, KDialog::marginHint(), KDialog::spacingHint()); // general group QGroupBox *general_group = new QGroupBox(this); QGridLayout *grid = new QGridLayout(general_group, 5, 2, KDialog::marginHint(), KDialog::spacingHint()); general_group->setAcceptDrops(false); // setup line inputs _nameEdit = new KLineEdit(general_group); _nameEdit->setAcceptDrops(false); _descriptionEdit = new KLineEdit(general_group); _descriptionEdit->setAcceptDrops(false); _commentEdit = new KLineEdit(general_group); _commentEdit->setAcceptDrops(false); _execEdit = new KURLRequester(general_group); _execEdit->lineEdit()->setAcceptDrops(false); QWhatsThis::add(_execEdit, i18n("Following the command, you can have several place holders which will be replaced " "with the actual values when the actual program is run:\n" "%f - a single file name\n" "%F - a list of files; use for applications that can open several local files at once\n" "%u - a single URL\n" "%U - a list of URLs\n" "%d - the folder of the file to open\n" "%D - a list of folders\n" "%i - the icon\n" "%m - the mini-icon\n" "%c - the caption")); _launchCB = new QCheckBox(i18n("Enable &launch feedback"), general_group); _systrayCB = new QCheckBox(i18n("&Place in system tray"), general_group); // setup labels _nameLabel = new QLabel(_nameEdit, i18n("&Name:"), general_group); _descriptionLabel = new QLabel(_descriptionEdit, i18n("&Description:"), general_group); _commentLabel = new QLabel(_commentEdit, i18n("&Comment:"), general_group); _execLabel = new QLabel(_execEdit, i18n("Co&mmand:"), general_group); grid->addWidget(_nameLabel, 0, 0); grid->addWidget(_descriptionLabel, 1, 0); grid->addWidget(_commentLabel, 2, 0); grid->addWidget(_execLabel, 3, 0); // connect line inputs connect(_nameEdit, SIGNAL(textChanged(const QString &)), SLOT(slotChanged())); connect(_descriptionEdit, SIGNAL(textChanged(const QString &)), SLOT(slotChanged())); connect(_commentEdit, SIGNAL(textChanged(const QString &)), SLOT(slotChanged())); connect(_execEdit, SIGNAL(textChanged(const QString &)), SLOT(slotChanged())); connect(_execEdit, SIGNAL(urlSelected(const QString &)), SLOT(slotExecSelected())); connect(_launchCB, SIGNAL(clicked()), SLOT(launchcb_clicked())); connect(_systrayCB, SIGNAL(clicked()), SLOT(systraycb_clicked())); // add line inputs to the grid grid->addMultiCellWidget(_nameEdit, 0, 0, 1, 1); grid->addMultiCellWidget(_descriptionEdit, 1, 1, 1, 1); grid->addMultiCellWidget(_commentEdit, 2, 2, 1, 2); grid->addMultiCellWidget(_execEdit, 3, 3, 1, 2); grid->addMultiCellWidget(_launchCB, 4, 4, 0, 2); grid->addMultiCellWidget(_systrayCB, 5, 5, 0, 2); // setup icon button _iconButton = new KIconButton(general_group); _iconButton->setFixedSize(56, 56); _iconButton->setIconSize(48); connect(_iconButton, SIGNAL(iconChanged(QString)), SLOT(slotChanged())); grid->addMultiCellWidget(_iconButton, 0, 1, 2, 2); // add the general group to the main layout layout->addMultiCellWidget(general_group, 0, 0, 0, 1); // path group _path_group = new QGroupBox(this); QVBoxLayout *vbox = new QVBoxLayout(_path_group, KDialog::marginHint(), KDialog::spacingHint()); QHBox *hbox = new QHBox(_path_group); hbox->setSpacing(KDialog::spacingHint()); _pathLabel = new QLabel(i18n("&Work path:"), hbox); _pathEdit = new KURLRequester(hbox); _pathEdit->setMode(KFile::Directory | KFile::LocalOnly); _pathEdit->lineEdit()->setAcceptDrops(false); _pathLabel->setBuddy(_pathEdit); connect(_pathEdit, SIGNAL(textChanged(const QString &)), SLOT(slotChanged())); vbox->addWidget(hbox); layout->addMultiCellWidget(_path_group, 1, 1, 0, 1); // terminal group _term_group = new QGroupBox(this); vbox = new QVBoxLayout(_term_group, KDialog::marginHint(), KDialog::spacingHint()); _terminalCB = new QCheckBox(i18n("Run in term&inal"), _term_group); connect(_terminalCB, SIGNAL(clicked()), SLOT(termcb_clicked())); vbox->addWidget(_terminalCB); hbox = new QHBox(_term_group); hbox->setSpacing(KDialog::spacingHint()); _termOptLabel = new QLabel(i18n("Terminal &options:"), hbox); _termOptEdit = new KLineEdit(hbox); _termOptEdit->setAcceptDrops(false); _termOptLabel->setBuddy(_termOptEdit); connect(_termOptEdit, SIGNAL(textChanged(const QString &)), SLOT(slotChanged())); vbox->addWidget(hbox); layout->addMultiCellWidget(_term_group, 2, 2, 0, 1); _termOptEdit->setEnabled(false); // uid group _uid_group = new QGroupBox(this); vbox = new QVBoxLayout(_uid_group, KDialog::marginHint(), KDialog::spacingHint()); _uidCB = new QCheckBox(i18n("&Run as a different user"), _uid_group); connect(_uidCB, SIGNAL(clicked()), SLOT(uidcb_clicked())); vbox->addWidget(_uidCB); hbox = new QHBox(_uid_group); hbox->setSpacing(KDialog::spacingHint()); _uidLabel = new QLabel(i18n("&Username:"******"" ); // QPushButton* _keyButton = new QPushButton( i18n( "Change" ), // general_group_keybind ); // connect( _keyButton, SIGNAL( clicked()), this, SLOT( keyButtonPressed())); _keyEdit = new KKeyButton(general_group_keybind); grid_keybind->addWidget(new QLabel(_keyEdit, i18n("Current shortcut &key:"), general_group_keybind), 0, 0); connect(_keyEdit, SIGNAL(capturedShortcut(const KShortcut &)), this, SLOT(slotCapturedShortcut(const KShortcut &))); grid_keybind->addWidget(_keyEdit, 0, 1); // grid_keybind->addWidget(_keyButton, 0, 2 ); if(!KHotKeys::present()) general_group_keybind->hide(); slotDisableAction(); }
/* Constructor setups the GUI. */ QucsLib::QucsLib() { // set application icon setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Library Tool " PACKAGE_VERSION); QMenuBar * menuBar = new QMenuBar (this); // create file menu QPopupMenu * fileMenu = new QPopupMenu (); QAction * manageLib = new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this); manageLib->addTo (fileMenu); connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib())); fileMenu->insertSeparator(); QAction * fileQuit = new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this); fileQuit->addTo (fileMenu); connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit())); // create help menu QPopupMenu * helpMenu = new QPopupMenu (); QAction * helpHelp = new QAction (tr("Help"), tr("&Help"), Key_F1, this); helpHelp->addTo (helpMenu); connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp())); QAction * helpAbout = new QAction (tr("About"), tr("About"), 0, helpMenu); helpAbout->addTo (helpMenu); connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout())); // setup menu bar menuBar->insertItem (tr("&File"), fileMenu); menuBar->insertSeparator (); menuBar->insertItem (tr("&Help"), helpMenu); // main box QVBoxLayout * all = new QVBoxLayout (this); all->setSpacing (0); all->setMargin (0); // reserve space for menubar QWidget * Space = new QWidget (this); Space->setFixedSize(5, menuBar->height() + 2); all->addWidget (Space); // main layout QHBox * h = new QHBox (this); h->setSpacing (5); h->setMargin (3); all->addWidget (h); // library and component choice QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h); Library = new QComboBox (LibGroup); connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int))); CompList = new QListBox(LibGroup); connect(CompList, SIGNAL(highlighted(QListBoxItem*)), SLOT(slotShowComponent(QListBoxItem*))); QHBox * h1 = new QHBox (LibGroup); QPushButton * SearchButton = new QPushButton (tr("Search..."), h1); connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent())); h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder // component display QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h); CompDescr = new QTextEdit(CompGroup); CompDescr->setTextFormat(Qt::PlainText); CompDescr->setReadOnly(true); CompDescr->setWordWrap(QTextEdit::NoWrap); Symbol = new SymbolWidget (CompGroup); QHBox * h2 = new QHBox (CompGroup); QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2); connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard())); QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2); connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel())); // ...................................................... putLibrariesIntoCombobox(); }
GeneralSettingsPage::GeneralSettingsPage(QWidget* parent) : SettingsPageBase(parent), m_homeURL(0), m_startSplit(0), m_startEditable(0) { QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint()); const int spacing = KDialog::spacingHint(); const int margin = KDialog::marginHint(); const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); DolphinSettings& settings = DolphinSettings::instance(); QVBox* vBox = new QVBox(parent); vBox->setSizePolicy(sizePolicy); vBox->setSpacing(spacing); vBox->setMargin(margin); vBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); // create 'Home URL' editor QGroupBox* homeGroup = new QGroupBox(1, Qt::Horizontal, i18n("Home URL"), vBox); homeGroup->setSizePolicy(sizePolicy); homeGroup->setMargin(margin); QHBox* homeURLBox = new QHBox(homeGroup); homeURLBox->setSizePolicy(sizePolicy); homeURLBox->setSpacing(spacing); new QLabel(i18n("Location:"), homeURLBox); m_homeURL = new QLineEdit(settings.homeURL().prettyURL(), homeURLBox); QPushButton* selectHomeURLButton = new QPushButton(SmallIcon("folder"), QString::null, homeURLBox); connect(selectHomeURLButton, SIGNAL(clicked()), this, SLOT(selectHomeURL())); QHBox* buttonBox = new QHBox(homeGroup); buttonBox->setSizePolicy(sizePolicy); buttonBox->setSpacing(spacing); QPushButton* useCurrentButton = new QPushButton(i18n("Use current location"), buttonBox); connect(useCurrentButton, SIGNAL(clicked()), this, SLOT(useCurrentLocation())); QPushButton* useDefaultButton = new QPushButton(i18n("Use default location"), buttonBox); connect(useDefaultButton, SIGNAL(clicked()), this, SLOT(useDefaulLocation())); // create 'Default View Mode' group QButtonGroup* buttonGroup = new QButtonGroup(3, Qt::Vertical, i18n("Default View Mode"), vBox); buttonGroup->setSizePolicy(sizePolicy); buttonGroup->setMargin(margin); m_iconsView = new QRadioButton(i18n("Icons"), buttonGroup); m_detailsView = new QRadioButton(i18n("Details"), buttonGroup); m_previewsView = new QRadioButton(i18n("Previews"), buttonGroup); switch (settings.defaultViewMode()) { case DolphinView::IconsView: m_iconsView->setChecked(true); break; case DolphinView::DetailsView: m_detailsView->setChecked(true); break; case DolphinView::PreviewsView: m_previewsView->setChecked(true); break; } // create 'Start with split view' checkbox m_startSplit = new QCheckBox(i18n("Start with split view"), vBox); m_startSplit->setChecked(settings.isViewSplit()); // create 'Start with editable navigation bar' checkbox m_startEditable = new QCheckBox(i18n("Start with editable navigation bar"), vBox); m_startEditable->setChecked(settings.isURLEditable()); // create 'Save view properties for each folder' checkbox m_saveView = new QCheckBox(i18n("Save view properties for each folder"), vBox); m_saveView->setChecked(settings.isSaveView()); // Add a dummy widget with no restriction regarding // a vertical resizing. This assures that the dialog layout // is not stretched vertically. new QWidget(vBox); topLayout->addWidget(vBox); }
void SimpleUI::setupCentralWidget() { QVBox *npWidget = new QVBox( this ); npWidget->setMargin( 0 ); npWidget->setSpacing( 0 ); positionLabel = new QLabel( statusBar() ); positionLabel->setAlignment( AlignVCenter | AlignCenter ); positionLabel->setFixedSize( fontMetrics().size( 0, " 00:00/00:00 " ) ); statusBar()->addWidget( positionLabel, 0, true ); video = new VideoFrame( npWidget ); connect( video, SIGNAL(adaptSize(int,int)), SLOT(slotAdaptSize(int,int)) ); connect( video, SIGNAL(rightButtonPressed(const QPoint &)), SLOT(slotContextMenu(const QPoint &)) ); QHBox *ctlFrame = new QHBox( npWidget ); ctlFrame->setFixedHeight( 38 ); ctlFrame->setFrameShape( QFrame::StyledPanel ); ctlFrame->setFrameShadow( QFrame::Raised ); ctlFrame->setMargin( 6 ); ctlFrame->setSpacing( 6 ); QPushButton *backButton = new QPushButton( ctlFrame ); backButton->setFixedSize( 24, 24 ); backButton->setPixmap( QPixmap( back_xpm ) ); QToolTip::add( backButton, i18n("Back") ); connect( backButton, SIGNAL(clicked()), napp->player(), SLOT(back()) ); stopButton = new QPushButton( ctlFrame ); stopButton->setFixedSize( 24, 24 ); stopButton->setPixmap( QPixmap( stop_xpm ) ); QToolTip::add( stopButton, i18n("Stop") ); connect( stopButton, SIGNAL(clicked()), napp->player(), SLOT(stop()) ); playButton = new QPushButton( ctlFrame ); playButton->setFixedSize( 24, 24 ); playButton->setPixmap( QPixmap( play_xpm ) ); QToolTip::add( playButton, i18n("Play / Pause") ); connect( playButton, SIGNAL(clicked()), napp->player(), SLOT(playpause()) ); QPushButton *forwButton = new QPushButton( ctlFrame ); forwButton->setFixedSize( 24, 24 ); forwButton->setPixmap( QPixmap( forward_xpm ) ); QToolTip::add( forwButton, i18n("Forward") ); connect( forwButton, SIGNAL(clicked()), napp->player(), SLOT(forward()) ); slider = new L33tSlider( 0, 1000, 10, 0, L33tSlider::Horizontal, ctlFrame ); slider->setFixedHeight( 24 ); slider->setMinimumWidth( 100 ); slider->setTickmarks( QSlider::NoMarks ); connect( slider, SIGNAL(userChanged(int)), SLOT(slotSkipTo(int)) ); connect( slider, SIGNAL(sliderMoved(int)), SLOT(slotSliderMoved(int)) ); QPushButton *playlistButton = new QPushButton( ctlFrame ); playlistButton->setFixedSize( 24, 24 ); playlistButton->setPixmap( QPixmap( playlist_xpm ) ); QToolTip::add( playlistButton, i18n("Playlist") ); connect( playlistButton, SIGNAL(clicked()), napp->player(), SLOT(toggleListView()) ); volumeButton = new QPushButton( ctlFrame ); volumeButton->setFixedSize( 24, 24 ); volumeButton->setPixmap( QPixmap( volume_xpm ) ); QToolTip::add( volumeButton, i18n("Volume") ); volumeFrame = new QVBox( this, "Volume", WStyle_Customize | WType_Popup ); volumeFrame->setFrameStyle( QFrame::PopupPanel ); volumeFrame->setMargin( 4 ); volumeLabel = new QLabel( volumeFrame ); volumeLabel->setText( "100%" ); volumeLabel->setAlignment( AlignCenter ); volumeLabel->setFixedSize( volumeLabel->sizeHint() ); QHBox *volumeSubFrame = new QHBox( volumeFrame ); volumeSlider = new L33tSlider( 0, 100, 10, 0, Vertical, volumeSubFrame ); volumeSlider->setValue( 100 - napp->player()->volume() ); volumeSlider->setFixedSize( volumeSlider->sizeHint() ); volumeFrame->resize( volumeFrame->sizeHint() ); connect( volumeSlider, SIGNAL(sliderMoved(int)), SLOT(slotVolumeSliderMoved(int)) ); connect( volumeSlider, SIGNAL(userChanged(int)), SLOT(slotVolumeSliderMoved(int)) ); connect( volumeButton, SIGNAL(clicked()), SLOT(slotVolumeFrame()) ); setCentralWidget( npWidget ); video->setMinimumSize( minimumSizeHint().width(), 1 ); // Create properties dialog propertiesDialog = new PropertiesDialog( this ); propertiesDialog->resize( 375, 285 ); }
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent) { // set application icon setIcon (QPixmap(":/bitmaps/big.qucs.xpm")); setCaption("Qucs Filter " PACKAGE_VERSION); all = new QVBoxLayout(this); // -------- create menubar ------------------- QPopupMenu *fileMenu = new QPopupMenu(); fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q); QPopupMenu *helpMenu = new QPopupMenu(); helpMenu->insertItem( tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0); helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0); QMenuBar *bar = new QMenuBar(this); bar->insertItem(tr("&File"), fileMenu); bar->insertSeparator (); bar->insertItem(tr("&Help"), helpMenu); all->addWidget(bar); // reserve space for menubar all->addSpacing (bar->height() + 2); QTabWidget *t = new QTabWidget(this); all->addWidget(t); // ........................................................... QWidget *Tab1 = new QWidget(t); QGridLayout *gp1 = new QGridLayout(Tab1,12,6,5,5); FilterName = new QComboBox(false, Tab1); gp1->addWidget(FilterName,0,0); TformName = new QComboBox(false, Tab1); gp1->addWidget(TformName,0,1); OrderBox = new QCheckBox(tr("Specify order"), Tab1); gp1->addWidget(OrderBox,1,0); QHBox *h1 = new QHBox(Tab1); h1->setSpacing (5); OrderCombo = new QComboBox(false, h1); OrderCombo->setEnabled(true); SubOrderCombo = new QComboBox(false, h1); SubOrderCombo->setEnabled(false); SubOrderCombo->insertItem( tr( "b" ) ); SubOrderCombo->insertItem( tr( "c" ) ); gp1->addWidget(h1,1,1); CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1); gp1->addWidget(CutoffLabel,2,0); EnterCutoff = new QLineEdit(Tab1); gp1->addWidget(EnterCutoff,2,1); CutoffCombo = new QComboBox(Tab1); CutoffCombo->insertItem( tr( "Hz" ) ); CutoffCombo->insertItem( tr( "kHz" ) ); CutoffCombo->insertItem( tr( "MHz" ) ); CutoffCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(CutoffCombo,2,2); RippleLabel = new QLabel(tr("Ripple"),Tab1); gp1->addWidget(RippleLabel,3,0); EnterRipple = new QLineEdit(Tab1); gp1->addWidget(EnterRipple,3,1); RippleUnitLabel = new QLabel(tr("dB"),Tab1); gp1->addWidget(RippleUnitLabel,3,2); AngleLabel = new QLabel(tr("Angle"),Tab1); gp1->addWidget(AngleLabel,3,3); EnterAngle = new QLineEdit(Tab1); gp1->addWidget(EnterAngle,3,4); AngleUnitLabel = new QLabel(tr("°"),Tab1); gp1->addWidget(AngleUnitLabel,3,5); ZinLabel = new QLabel(tr("Zin"),Tab1); gp1->addWidget(ZinLabel,7,0); EnterZin = new QLineEdit(Tab1); gp1->addWidget(EnterZin,7,1); OhmLabel = new QLabel(tr("Ohm"),Tab1); gp1->addWidget(OhmLabel,7,2); ZoutLabel = new QLabel(tr("Zout"),Tab1); ZoutLabel->setEnabled(false); gp1->addWidget(ZoutLabel,7,3); EnterZout = new QLineEdit(Tab1); gp1->addWidget(EnterZout,7,4); OhmLabel_2 = new QLabel(tr("Ohm"),Tab1); gp1->addWidget(OhmLabel_2,7,5); StopbandLabel = new QLabel(tr("Stopband corner"),Tab1); gp1->addWidget(StopbandLabel,5,0); EnterStopband = new QLineEdit(Tab1); gp1->addWidget(EnterStopband,5,1); StopbandCombo = new QComboBox(false, Tab1); StopbandCombo->insertItem( tr( "Hz" ) ); StopbandCombo->insertItem( tr( "kHz" ) ); StopbandCombo->insertItem( tr( "MHz" ) ); StopbandCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(StopbandCombo,5,2); BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1); BandwidthLabel->setEnabled(false); gp1->addWidget(BandwidthLabel,4,0); EnterBandwidth = new QLineEdit(Tab1); gp1->addWidget(EnterBandwidth,4,1); BandwidthCombo = new QComboBox(false, Tab1); BandwidthCombo->setEnabled(false); BandwidthCombo->insertItem( tr( "Hz" ) ); BandwidthCombo->insertItem( tr( "kHz" ) ); BandwidthCombo->insertItem( tr( "MHz" ) ); BandwidthCombo->insertItem( tr( "GHz" ) ); gp1->addWidget(BandwidthCombo,4,2); AttenuationLabel = new QLabel(tr("Attenuation"),Tab1); gp1->addWidget(AttenuationLabel,6,0); EnterAttenuation = new QLineEdit(Tab1); gp1->addWidget(EnterAttenuation,6,1); dBLabel = new QLabel(tr("dB"),Tab1); gp1->addWidget(dBLabel,6,2); DualBox = new QCheckBox(tr("dual"),Tab1); gp1->addMultiCellWidget(DualBox,8,8,0,2); CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1); CauerPoleBox->setEnabled(false); gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2); OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1); OptimizeCauerBox->setEnabled(false); gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2); EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1); EqualInductorBox->setEnabled(false); gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5); UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1); UseCrossBox->setEnabled(false); gp1->addMultiCellWidget(UseCrossBox,9,9,3,5); Cboxes = new QVButtonGroup(tr("Optimize C"),Tab1); Cmin = new QRadioButton(tr("Cmin"),Cboxes); Cmax = new QRadioButton(tr("Cmax"),Cboxes); NoC = new QRadioButton(tr("noC"),Cboxes); gp1->addMultiCellWidget(Cboxes,11,11,0,2); Lboxes = new QVButtonGroup(tr("Optimize L"),Tab1); Lmin = new QRadioButton(tr("Lmin"),Lboxes); Lmax = new QRadioButton(tr("Lmax"),Lboxes); NoL = new QRadioButton(tr("noL"),Lboxes); gp1->addMultiCellWidget(Lboxes,11,11,3,5); t->addTab(Tab1, tr("LC Filters")); // ........................................................... QWidget *Tab2 = new QWidget(t); t->addTab(Tab2, tr("Microstrip Filters")); // ........................................................... QWidget *Tab3 = new QWidget(t); t->addTab(Tab3, tr("Active Filters")); // reserve space for vertical resizing all->addStretch(); // ........................................................... // buttons on the bottom of the dialog (independent of the TabWidget) QHBox *Butts = new QHBox(this); Butts->setSpacing(3); Butts->setMargin(3); all->addWidget(Butts); cancelButton = new QPushButton(tr("Exit"),Butts); okButton = new QPushButton(tr("Calculate"),Butts); okButton->setEnabled(false); // signals and slots connections connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); }
///////////////////////////////////////////////////////////////////////////////////////////////// // Trade dialog class ///////////////////////////////////////////////////////////////////////////////////////////////// TradeDialog::TradeDialog(net::GameState *gamestate, const PlayerState* me, const PlayerState* other, QWidget *parent, const char * name) : QDialog(parent, name, TRUE) { setCaption("Make a trade!"); QGridLayout *grid = new QGridLayout(this, 4, 2, 5, 10, "grid"); const Game_Base & base = gamestate->get_base(); QLabel * lbl = NULL; // titles lbl = new QLabel("Your inventory", this); grid->addWidget( lbl, 0, 0, Qt::AlignCenter ); lbl = new QLabel( other->get_name() + QString("'s inventory") , this); grid->addWidget( lbl , 0, 1, Qt::AlignCenter ); // buttons QPushButton *okbtn = new QPushButton ("Request Trade", this); connect( okbtn, SIGNAL(clicked()), SLOT(accept())); grid->addWidget( okbtn, 3, 0, Qt::AlignCenter ); QPushButton *cancelbtn = new QPushButton( "Cancel", this); connect(cancelbtn, SIGNAL(clicked()), SLOT(reject())); grid->addWidget( cancelbtn, 3, 1, Qt::AlignCenter ); // money spinboxes QHBox * lhbox = new QHBox(this); lhbox->setSpacing(5); new QLabel("Money:", lhbox); _my_spin = new QSpinBox( 0, me->get_money(), 1, lhbox); grid->addWidget(lhbox, 2, 0, Qt::AlignCenter ); QHBox * rhbox = new QHBox(this); rhbox->setSpacing(5); new QLabel("Money:", rhbox); _their_spin = new QSpinBox( 0, other->get_money(), 1, rhbox); grid->addWidget(rhbox, 2, 1, Qt::AlignCenter ); net::PropertyList_t::const_iterator it; // current player's inventory QListBox* llbox = _my_list = new QListBox(this); llbox->setSelectionMode( QListBox::Multi ); llbox->setMinimumHeight(100); const net::PropertyList_t & props = me->get_owned_properties(); for(it = props.begin(); it != props.end(); ++it) { net::Property_t id = *it; if(id == 255 || id == 254) { _my_trans.push_back(id); llbox->insertItem( QString("Get out of Jail card - ") + QString::number(id - 253) ); } else { const std::string* name = base.name(id); if(name != NULL) { _my_trans.push_back(id); llbox->insertItem( *name ); } } } grid->addWidget(llbox, 1, 0, Qt::AlignHCenter | Qt::AlignTop ); QListBox* rlbox = _their_list = new QListBox(this); rlbox->setSelectionMode( QListBox::Multi ); rlbox->setMinimumHeight(100); const net::PropertyList_t tprops = other->get_owned_properties(); for(it = tprops.begin(); it != tprops.end(); ++it) { net::Property_t id = *it; if(id == 255 || id == 254) { _their_trans.push_back(id); rlbox->insertItem( QString("Get out of Jail card - ") + QString::number(id - 253) ); } else { const std::string* name = base.name(id); if(name != NULL) { _their_trans.push_back(id); rlbox->insertItem( *name ); } } } grid->addWidget(rlbox, 1, 1, Qt::AlignHCenter | Qt::AlignTop ); }
BatteryConfig::BatteryConfig (QWidget * parent, const char *name) : KCModule(parent, name), editPoll(0), iconloader(0), buttonNoBattery(0), buttonNoCharge(0), buttonCharge(0) { KGlobal::locale()->insertCatalogue("klaptopdaemon"); // For translation of klaptopdaemon messages apm = laptop_portable::has_power_management(); config = new KConfig("kcmlaptoprc"); instance = new KInstance("klaptopdaemon"); QVBoxLayout *top_layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() ); // do we show the monitor runMonitor = new QCheckBox( i18n("&Show battery monitor"), this ); top_layout->addWidget( runMonitor ); QToolTip::add( runMonitor, i18n( "This box enables the battery state icon in the panel" ) ); connect( runMonitor, SIGNAL(clicked()), this, SLOT(configChanged()) ); connect( runMonitor, SIGNAL(clicked()), this, SLOT(runMonitorChanged()) ); // show also the battery level percentage showLevel = new QCheckBox( i18n("Show battery level percentage"), this ); top_layout->addWidget( showLevel ); QToolTip::add( showLevel, i18n( "This box enables a text message near the battery state icon containing battery level percentage" ) ); connect( showLevel, SIGNAL(clicked()), this, SLOT(configChanged()) ); notifyMe = new QCheckBox( i18n("&Notify me whenever my battery becomes fully charged"), this ); top_layout->addWidget( notifyMe ); QToolTip::add( notifyMe, i18n( "This box enables a dialog box that pops up when your battery becomes fully charged" ) ); connect( notifyMe, SIGNAL(clicked()), this, SLOT(configChanged()) ); blankSaver = new QCheckBox( i18n("&Use a blank screen saver when running on battery"), this ); top_layout->addWidget( blankSaver ); connect( blankSaver, SIGNAL(clicked()), this, SLOT(configChanged()) ); if (!apm) { top_layout->addWidget( laptop_portable::no_power_management_explanation(this) ); } else { iconloader = new KIconLoader("klaptopdaemon"); // the poll time (in seconds) QHBox *hb = new QHBox( this ); hb->setSpacing( KDialog::spacingHint() ); top_layout->addWidget( hb ); QLabel* poll_label = new QLabel( i18n("&Check status every:"), hb ); editPoll = new QSpinBox( 1, 3600, 1, hb ); // min,max,step QToolTip::add( editPoll, i18n( "Choose how responsive the laptop software will be when it checks the battery status" ) ); editPoll->setSuffix( i18n("keep short, unit in spinbox", "sec") ); poll_label->setBuddy( editPoll ); connect( editPoll, SIGNAL(valueChanged(int)), this, SLOT(configChanged()) ); QWidget* spacer = new QWidget( hb ); hb->setStretchFactor( spacer, 1 ); // group box to hold the icons together QVGroupBox* icons_groupbox = new QVGroupBox( i18n("Select Battery Icons"), this ); icons_groupbox->layout()->setSpacing( KDialog::spacingHint() ); top_layout->addWidget( icons_groupbox, 0, Qt::AlignLeft ); // layout to hold the icons inside the groupbox QGrid *icon_grid = new QGrid( 3 /*cols*/, icons_groupbox ); icon_grid->setSpacing( KDialog::spacingHint() ); buttonNoBattery = new KIconButton( iconloader, icon_grid ); buttonNoCharge = new KIconButton( iconloader, icon_grid ); buttonCharge = new KIconButton( iconloader, icon_grid ); (void)new QLabel( buttonNoBattery, i18n("No &battery"), icon_grid); (void)new QLabel( buttonNoCharge, i18n("&Not charging"), icon_grid); (void)new QLabel( buttonCharge, i18n("Char&ging"), icon_grid); buttonNoBattery->setIconType( KIcon::NoGroup, KIcon::Any, 1); buttonNoCharge->setIconType( KIcon::NoGroup, KIcon::Any, 1); buttonCharge->setIconType( KIcon::NoGroup, KIcon::Any, 1); connect(buttonNoBattery, SIGNAL(iconChanged(QString)), this, SLOT(iconChanged())); connect(buttonNoCharge, SIGNAL(iconChanged(QString)), this, SLOT(iconChanged())); connect(buttonCharge, SIGNAL(iconChanged(QString)), this, SLOT(configChanged())); int num_batteries; QStringList battery_names, battery_states, battery_values; laptop_portable::get_battery_status(num_batteries, battery_names, battery_states, battery_values); if (num_batteries > 0) { QHBoxLayout *hl = new QHBoxLayout(); top_layout->addLayout(hl); QHGroupBox *hb = new QHGroupBox(i18n("Current Battery Status"), this); for (int i = 0; i < num_batteries; i++) { QWidget *wp; if (num_batteries == 1) { wp = new QWidget(hb); } else { wp = new QVGroupBox(battery_names[i], hb); } QVBoxLayout *vb = new QVBoxLayout(wp); QLabel *l; l = new QLabel(wp); // icon indicating state vb->addWidget(l); batt_label_1.append(l); l = new QLabel(QString(""), wp); vb->addWidget(l); batt_label_2.append(l); l = new QLabel(QString(""), wp); vb->addWidget(l); batt_label_3.append(l); } hl->addWidget(hb); hl->addStretch(1); (void)startTimer(30*1000); // update 2x every minute } // TODO: remove linefeed from string, can't do it right now coz we have a string freeze QLabel* explain = new KRichTextLabel( i18n("This panel controls whether the battery status monitor\nappears in the system tray and what it looks like.").replace("\n"," "), this); top_layout->addWidget(explain, 0); laptop_portable::extra_config(this, config, top_layout); } top_layout->addStretch(1); startMonitor = new QPushButton( i18n("&Start Battery Monitor"), this); connect(startMonitor, SIGNAL(clicked()), this, SLOT(slotStartMonitor())); top_layout->addWidget( startMonitor, 0, Qt::AlignRight ); load(); }
Themes::Themes( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ) { appFont = QApplication::font(); tabwidget = new QTabWidget( this ); tabwidget->addTab( new ButtonsGroups( tabwidget ), "Buttons/Groups" ); QHBox *hbox = new QHBox( tabwidget ); hbox->setMargin( 5 ); (void)new LineEdits( hbox ); (void)new ProgressBar( hbox ); tabwidget->addTab( hbox, "Lineedits/Progressbar" ); tabwidget->addTab( new ListBoxCombo( tabwidget ), "Listboxes/Comboboxes" ); tabwidget->addTab( new CheckLists( tabwidget ), "Listviews" ); tabwidget->addTab( new RangeControls( tabwidget ), "Rangecontrols" ); tabwidget->addTab( new MyRichText( tabwidget ), "Fortune" ); setCentralWidget( tabwidget ); QPopupMenu *style = new QPopupMenu( this ); style->setCheckable( TRUE ); menuBar()->insertItem( "&Style" , style ); style->setCheckable( TRUE ); QActionGroup *ag = new QActionGroup( this, 0 ); ag->setExclusive( TRUE ); QSignalMapper *styleMapper = new QSignalMapper( this ); connect( styleMapper, SIGNAL( mapped( const QString& ) ), this, SLOT( makeStyle( const QString& ) ) ); QStringList list = QStyleFactory::keys(); list.sort(); #ifndef QT_NO_STYLE_WINDOWS list.insert(list.begin(), "Norwegian Wood"); list.insert(list.begin(), "Metal"); #endif QDict<int> stylesDict( 17, FALSE ); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QString styleStr = *it; QString styleAccel = styleStr; if ( stylesDict[styleAccel.left(1)] ) { for ( uint i = 0; i < styleAccel.length(); i++ ) { if ( !stylesDict[styleAccel.mid( i, 1 )] ) { stylesDict.insert(styleAccel.mid( i, 1 ), (const int *)1); styleAccel = styleAccel.insert( i, '&' ); break; } } } else { stylesDict.insert(styleAccel.left(1), (const int *)1); styleAccel = "&"+styleAccel; } QAction *a = new QAction( styleStr, QIconSet(), styleAccel, 0, ag, 0, ag->isExclusive() ); connect( a, SIGNAL( activated() ), styleMapper, SLOT(map()) ); styleMapper->setMapping( a, a->text() ); } ag->addTo(style); style->insertSeparator(); style->insertItem("&Quit", qApp, SLOT( quit() ), CTRL | Key_Q ); QPopupMenu * help = new QPopupMenu( this ); menuBar()->insertSeparator(); menuBar()->insertItem( "&Help", help ); help->insertItem( "&About", this, SLOT(about()), Key_F1); help->insertItem( "About &Qt", this, SLOT(aboutQt())); #ifndef QT_NO_STYLE_WINDOWS qApp->setStyle( new NorwegianWoodStyle ); #endif }
FileBrowser::FileBrowser( const char * name, Medium * medium ) : QVBox( 0, name ) { KActionCollection *actionCollection; SearchPane *searchPane; KURL *location; // Try to keep filebrowser working even if not in a medium context // so if a medium object not passed in, keep earlier behavior if (!medium) { m_medium = 0; location = new KURL( Pana::config( "Filebrowser" )->readPathEntry( "Location", QDir::homeDirPath() ) ); KFileItem *currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location ); //KIO sucks, NetAccess::exists puts up a dialog and has annoying error message boxes //if there is a problem so there is no point in using it anyways. //so... setting the diroperator to ~ is the least sucky option if ( !location->isLocalFile() || !currentFolder->isReadable() ) { delete location; location = new KURL( QDir::homeDirPath() ) ; } } else{ m_medium = medium; location = new KURL( m_medium->mountPoint() ); } KActionCollection* ac = new KActionCollection( this ); KStdAction::selectAll( this, SLOT( selectAll() ), ac, "filebrowser_select_all" ); KToolBar *toolbar = new Browser::ToolBar( this ); { //Filter LineEdit KToolBar* searchToolBar = new Browser::ToolBar( this ); KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar ); m_filter = new ClickLineEdit( i18n( "Enter search terms here" ), searchToolBar ); searchToolBar->setStretchableWidget( m_filter ); connect( button, SIGNAL(clicked()), m_filter, SLOT(clear()) ); QToolTip::add( button, i18n( "Clear search field" ) ); QToolTip::add( m_filter, i18n( "Enter space-separated terms to search in the directory-listing" ) ); } { //Directory Listing QVBox *container; QHBox *box; container = new QVBox( this ); container->setFrameStyle( m_filter->frameStyle() ); container->setMargin( 3 ); container->setSpacing( 2 ); container->setBackgroundMode( Qt::PaletteBase ); box = new QHBox( container ); box->setMargin( 3 ); box->setBackgroundMode( Qt::PaletteBase ); //folder selection combo box m_combo = new KURLComboBox( KURLComboBox::Directories, true, box, "path combo" ); if (!m_medium){ m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) ); m_combo->setAutoDeleteCompletionObject( true ); } m_combo->setMaxItems( 9 ); m_combo->setURLs( Pana::config( "Filebrowser" )->readPathListEntry( "Dir History" ) ); if (!m_medium) m_combo->lineEdit()->setText( location->path() ); else m_combo->lineEdit()->setText( "/" ); //The main widget with file listings and that m_dir = new MyDirOperator( *location, container, m_medium ); m_dir->setEnableDirHighlighting( true ); m_dir->setMode( KFile::Mode((int)KFile::Files | (int)KFile::Directory) ); //allow selection of multiple files + dirs m_dir->setOnlyDoubleClickSelectsFiles( true ); //Pana type settings m_dir->readConfig( Pana::config( "Filebrowser" ) ); m_dir->setView( KFile::Default ); //will set userconfigured view, will load URL m_dir->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); m_dir->setAcceptDrops( true ); //Automatically open folder after hovering above it...probably a good thing //but easily disabled by commenting this line out //Disabled for now because can't show . and .. folders. //TODO: Find out a way to fix this? //m_dir->setDropOptions( KFileView::AutoOpenDirs ); static_cast<QFrame*>(m_dir->viewWidget())->setFrameStyle( QFrame::NoFrame ); static_cast<QIconView*>(m_dir->viewWidget())->setSpacing( 1 ); actionCollection = m_dir->actionCollection(); searchPane = new SearchPane( this ); setStretchFactor( container, 2 ); } { QPopupMenu* const menu = static_cast<KActionMenu*>(actionCollection->action("popupMenu"))->popupMenu(); menu->clear(); menu->insertItem( SmallIconSet( Pana::icon( "files" ) ), i18n( "&Load" ), MakePlaylist ); menu->insertItem( SmallIconSet( Pana::icon( "add_playlist" ) ), i18n( "&Append to Playlist" ), AppendToPlaylist ); menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Track" ), QueueTrack ); menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Tracks" ), QueueTracks ); menu->insertItem( SmallIconSet( Pana::icon( "save" ) ), i18n( "&Save as Playlist..." ), SavePlaylist ); menu->insertSeparator(); if (!m_medium) menu->insertItem( SmallIconSet( Pana::icon( "device" ) ), i18n( "&Transfer to Media Device" ), MediaDevice ); menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Organize Files..." ), OrganizeFiles ); menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Copy Files to Collection..." ), CopyToCollection ); menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Move Files to Collection..." ), MoveToCollection ); menu->insertItem( SmallIconSet( Pana::icon( "burn" ) ), i18n("Burn to CD..."), BurnCd ); menu->insertSeparator(); menu->insertItem( i18n( "&Select All Files" ), SelectAllFiles ); menu->insertSeparator(); actionCollection->action( "delete" )->setIcon( Pana::icon( "remove" ) ); actionCollection->action( "delete" )->plug( menu ); menu->insertSeparator(); menu->insertItem( SmallIconSet( Pana::icon( "info" ) ), i18n( "Edit Track &Information..." ), EditTags ); actionCollection->action( "properties" )->plug( menu ); menu->setItemEnabled( BurnCd, K3bExporter::isAvailable() ); connect( menu, SIGNAL(aboutToShow()), SLOT(prepareContextMenu()) ); connect( menu, SIGNAL(activated( int )), SLOT(contextMenuActivated( int )) ); } { KActionMenu *a; a = static_cast<KActionMenu*>( actionCollection->action( "sorting menu" ) ); a->setIcon( Pana::icon( "configure" ) ); a->setDelayed( false ); //TODO should be done by KDirOperator actionCollection->action( "delete" )->setShortcut( KShortcut( SHIFT + Key_Delete ) ); a = new KActionMenu( i18n("Bookmarks"), "bookmark", actionCollection, "bookmarks" ); a->setDelayed( false ); new KBookmarkHandler( m_dir, a->popupMenu() ); } { if ( KAction *a = actionCollection->action( "up" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "back" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "forward" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "home" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "reload" ) ) { a->setIcon( Pana::icon( "refresh" ) ); a->plug( toolbar ); } toolbar->insertLineSeparator(); if ( KAction *a = actionCollection->action( "short view" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "detailed view" ) ) a->plug( toolbar ); toolbar->insertLineSeparator(); if ( KAction *a = actionCollection->action( "sorting menu" ) ) a->plug( toolbar ); if ( KAction *a = actionCollection->action( "bookmarks" ) ) a->plug( toolbar ); KAction *gotoCurrent = new KAction( i18n("Go To Current Track Folder"), Pana::icon( "music" ), 0, this, SLOT( gotoCurrentFolder() ), actionCollection ); gotoCurrent->plug( toolbar ); disconnect( actionCollection->action( "up" ), SIGNAL( activated() ), m_dir, SLOT( cdUp() ) ); connect( actionCollection->action( "up" ), SIGNAL( activated() ), m_dir, SLOT( myCdUp() ) ); disconnect( actionCollection->action( "home" ), SIGNAL( activated() ), m_dir, SLOT( home() ) ); connect( actionCollection->action( "home" ), SIGNAL( activated() ), m_dir, SLOT( myHome() ) ); } connect( m_filter, SIGNAL(textChanged( const QString& )), SLOT(setFilter( const QString& )) ); connect( m_combo, SIGNAL(urlActivated( const KURL& )), SLOT(setUrl( const KURL& )) ); connect( m_combo, SIGNAL(returnPressed( const QString& )), SLOT(setUrl( const QString& )) ); connect( m_dir, SIGNAL(viewChanged( KFileView* )), SLOT(slotViewChanged( KFileView* )) ); connect( m_dir, SIGNAL(fileSelected( const KFileItem* )), SLOT(activate( const KFileItem* )) ); connect( m_dir, SIGNAL(urlEntered( const KURL& )), SLOT(urlChanged( const KURL& )) ); connect( m_dir, SIGNAL(urlEntered( const KURL& )), searchPane, SLOT(urlChanged( const KURL& )) ); connect( m_dir, SIGNAL(dropped( const KFileItem*, QDropEvent*, const KURL::List& )), SLOT(dropped( const KFileItem*, QDropEvent*, const KURL::List& )) ); setSpacing( 4 ); setFocusProxy( m_dir ); //so the dirOperator is focused when we get focus events // Toolbar is more than 250px wide, BrowserBar doesn't allow that. -> Resizing issues. setMinimumWidth( 250 /* toolbar->sizeHint().width() */ ); }
void AddresseeEditorWidget::setupTab1() { // This is the General tab QWidget *tab1 = new QWidget( mTabWidget ); QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); layout->setMargin( KDialogBase::marginHint() ); layout->setSpacing( KDialogBase::spacingHint() ); QLabel *label; KSeparator* bar; QPushButton *button; ////////////////////////////////// // Upper left group (person info) // Person icon label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 0, 1, 0, 0 ); // First name button = new QPushButton( i18n( "Edit Name..." ), tab1 ); QToolTip::add( button, i18n( "Edit the contact's name" ) ); mNameEdit = new KLineEdit( tab1, "mNameEdit" ); connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( nameTextChanged( const QString& ) ) ); connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); mNameLabel = new KSqueezedTextLabel( tab1 ); if ( KABPrefs::instance()->automaticNameParsing() ) { mNameLabel->hide(); mNameEdit->show(); } else { mNameEdit->hide(); mNameLabel->show(); } layout->addWidget( button, 0, 1 ); layout->addWidget( mNameEdit, 0, 2 ); layout->addWidget( mNameLabel, 0, 2 ); label = new QLabel( i18n( "<roleLabel>:", "%1:" ).arg( KABC::Addressee::roleLabel() ), tab1 ); mRoleEdit = new KLineEdit( tab1 ); connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); label->setBuddy( mRoleEdit ); layout->addWidget( label, 1, 1 ); layout->addWidget( mRoleEdit, 1, 2 ); // Organization label = new QLabel( i18n( "<organizationLabel>:", "%1:" ).arg( KABC::Addressee::organizationLabel() ), tab1 ); mOrgEdit = new KLineEdit( tab1 ); label->setBuddy( mOrgEdit ); connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), SLOT( organizationTextChanged( const QString& ) ) ); layout->addWidget( label, 2, 1 ); layout->addWidget( mOrgEdit, 2, 2 ); // File as (formatted name) label = new QLabel( i18n( "Formatted name:" ), tab1 ); mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); layout->addWidget( label, 3, 1 ); layout->addWidget( mFormattedNameLabel, 3, 2 ); // Left hand separator. This separator doesn't go all the way // across so the dialog still flows from top to bottom bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); ////////////////////////////////////// // Phone numbers (upper right) label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 0, 1, 3, 3 ); mPhoneEditWidget = new PhoneEditWidget( tab1 ); connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); ////////////////////////////////////// // Addresses (lower left) label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "kfm_home", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 5, 6, 0, 0 ); mAddressEditWidget = new AddressEditWidget( tab1 ); connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mAddressEditWidget, 5, 10, 1, 2 ); ////////////////////////////////////// // Email / Web (lower right) label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 5, 6, 3, 3 ); mEmailWidget = new EmailEditWidget( tab1 ); connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); // add the separator bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); QHBoxLayout *homePageLayout = new QHBoxLayout( 0, 11, 7 ); label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, KIcon::SizeMedium ) ); homePageLayout->addWidget( label ); label = new QLabel( i18n( "<urlLabel>:", "%1:" ).arg( KABC::Addressee::urlLabel() ), tab1 ); mURLEdit = new KLineEdit( tab1 ); connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); label->setBuddy( mURLEdit ); homePageLayout->addWidget( label ); homePageLayout->addWidget( mURLEdit ); layout->addMultiCellLayout( homePageLayout, 8, 8, 3, 6 ); QHBoxLayout *blogLayout = new QHBoxLayout( 0, 11, 7 ); label = new QLabel( i18n("Blog feed:"), tab1 ); blogLayout->addWidget( label ); mBlogEdit = new KLineEdit( tab1 ); blogLayout->addWidget( mBlogEdit ); connect( mBlogEdit, SIGNAL( textChanged( const QString & ) ), SLOT( textChanged( const QString & ) ) ); label->setBuddy( mBlogEdit ); layout->addMultiCellLayout( blogLayout, 9, 9, 4, 6 ); mIMWidget = new IMEditWidget( tab1, mAddressee ); connect( mIMWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mIMWidget, 10, 10, 4, 6 ); layout->addColSpacing( 6, 50 ); bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 11, 11, 0, 6 ); /////////////////////////////////////// QHBox *categoryBox = new QHBox( tab1 ); categoryBox->setSpacing( KDialogBase::spacingHint() ); // Categories mCategoryButton = new QPushButton( i18n( "Select Categories..." ), categoryBox ); connect( mCategoryButton, SIGNAL( clicked() ), SLOT( selectCategories() ) ); mCategoryEdit = new KLineEdit( categoryBox ); mCategoryEdit->setReadOnly( true ); connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); mSecrecyWidget = new SecrecyWidget( categoryBox ); connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( categoryBox, 12, 12, 0, 6 ); // Build the layout and add to the tab widget layout->activate(); // required mTabWidget->addTab( tab1, i18n( "&General" ) ); }
QWidget* MyFracWindow::createDisplayDock(QWidget* parent) { QVBox* wrapper = new QVBox(parent); wrapper->setSpacing(0); QGrid* propDisplay = new QGrid(2, wrapper); propDisplay->setMargin(7); propDisplay->setSpacing(5); new QLabel(i18n("Color gradient:"), propDisplay); GradientButton* gradButton = new GradientButton(propDisplay); connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double))); connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit())); QToolTip::add(gradButton, i18n("Gradient used to display the fractal")); new QLabel(i18n("Color scale:"), propDisplay); _sliderScale = new QSlider(QSlider::Horizontal, propDisplay); _sliderScale->setRange(0, 100); connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int))); QToolTip::add(_sliderScale, i18n("Scale of the color gradient")); new QLabel(i18n("Color offset:"), propDisplay); _sliderOffset = new QSlider(QSlider::Horizontal, propDisplay); _sliderOffset->setRange(0, 100); connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int))); QToolTip::add(_sliderOffset, i18n("Offset of the color gradient")); new QLabel(i18n("Scroll colors:"), propDisplay); QHBox* box = new QHBox(propDisplay); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); box->setSpacing(5); QComboBox* combo = new QComboBox(box); combo->insertItem(i18n("scroll direction", "Off")); combo->insertItem(i18n("scroll direction", "Left")); combo->insertItem(i18n("scroll direction", "Right")); connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int))); _sliderScroll = new QSlider(QSlider::Horizontal, box); _sliderScroll->setRange(0, 100); _sliderScroll->setEnabled(false); connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int))); QToolTip::add(combo, i18n("Scrolling direction")); QToolTip::add(_sliderScroll, i18n("Scrolling speed")); new QLabel(i18n("Background:"), propDisplay); _colorButton = new KColorButton(_backgroundColor, propDisplay); connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&))); QToolTip::add(_colorButton, i18n("Color of the background area")); new QLabel(i18n("3D grid size:"), propDisplay); _comboGrid = new QComboBox(propDisplay); for (int i = 64; i <= 1024; i *= 2) _comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i)); _comboGrid->setEnabled(false); connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int))); QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh")); new QLabel(i18n("Height scale:"), propDisplay); _sliderHeight = new QSlider(QSlider::Horizontal, propDisplay); _sliderHeight->setRange(0, 100); _sliderHeight->setEnabled(false); connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int))); QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh")); wrapper->setStretchFactor(new QWidget(wrapper), 1); return wrapper; }
void MyFracWindow::onFileSave() { QHBox* box = new QHBox(NULL); box->setSpacing(10); new QLabel(i18n("Image Size:"), box); QLineEdit* editResX = new QLineEdit(box); editResX->setValidator(new QIntValidator(1, 32768, editResX)); box->setStretchFactor(editResX, 0); new QLabel(i18n("x"), box); QLineEdit* editResY = new QLineEdit(box); editResY->setValidator(new QIntValidator(1, 32768, editResY)); box->setStretchFactor(editResY, 0); box->setStretchFactor(new QWidget(box), 1); editResX->setText(QString::number(_imageSize.width())); editResY->setText(QString::number(_imageSize.height())); KFileDialog imageDlg(_imagePath, QString::null, this, "file_dlg", true, box); imageDlg.setCaption(i18n("Save Image")); imageDlg.setOperationMode(KFileDialog::Saving); imageDlg.setMimeFilter(KImageIO::mimeTypes(KImageIO::Writing), _imageMime); if (imageDlg.exec() == KFileDialog::Accepted) { QString fileName = imageDlg.selectedFile(); _imagePath = QFileInfo(fileName).dirPath(); _imageMime = imageDlg.currentMimeFilter(); if (editResX->hasAcceptableInput() && editResY->hasAcceptableInput()) { _imageSize.setWidth(editResX->text().toInt()); _imageSize.setHeight(editResY->text().toInt()); } else { KMessageBox::sorry(this, i18n("An invalid image size was entered.")); return; } emit previewEnabled(false); _progressDialog = new QProgressDialog(this, NULL, true); _progressDialog->setCaption(i18n("Save Image")); _progressDialog->setLabelText(i18n("Generating Image...")); _progressDialog->setTotalSteps(100); _progressDialog->setMinimumDuration(0); _generator.setSize(_imageSize); _generator.setPosition(_posX, _posY, _zoom, _angle); if (_juliaMode) _generator.setJuliaMode(_juliaX, _juliaY); _generator.setQuality(_maxIter, _threshold); _generator.setBackground(_backgroundColor.rgb()); _generator.setGradient(_gradientData, _gradientScale, _gradientOffset); _generator.addToQueue(); _progressDialog->exec(); if (!_progressDialog->wasCanceled()) { if (!_generator.isValid()) { KMessageBox::sorry(this, i18n("Not enough memory to generate the fractal.")); } else { _progressDialog->setLabelText(i18n("Saving Image...")); _progressDialog->setProgress(0); qApp->processEvents(); _generator.repaintImage(); QString format = KImageIO::typeForMime(_imageMime); bool result = _generator.getImage().save(fileName, format.ascii()); _progressDialog->setProgress(100); if (!result) { KMessageBox::sorry(this, i18n("Failed to save the image file.")); } } } else _generator.abort(); delete _progressDialog; _progressDialog = NULL; _generator.freeData(); if (!_juliaMode) emit previewEnabled(true); } }
OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) : QWidget( parent ), m_sel( sel ) { m_all = false; QVBoxLayout* lay = new QVBoxLayout( this ); m_currentDir = startDir; /* * now we add a special bar * One Button For Up * Home * Doc * And a dropdown menu with FileSystems * FUTURE: one to change dir with lineedit * Bookmarks * Create Dir */ QHBox* box = new QHBox(this ); box->setBackgroundMode( PaletteButton ); box->setSpacing( 0 ); QToolButton *btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("up") ); connect(btn, SIGNAL(clicked() ), this, SLOT( cdUP() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("home") ); connect(btn, SIGNAL(clicked() ), this, SLOT( cdHome() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("DocsIcon") ); connect(btn, SIGNAL(clicked() ), this, SLOT(cdDoc() ) ); m_btnNew = new QToolButton( box ); m_btnNew->setIconSet( Resource::loadIconSet("new") ); connect(m_btnNew, SIGNAL(clicked() ), this, SLOT(slotNew() ) ); m_btnClose = new QToolButton( box ); m_btnClose->setIconSet( Resource::loadIconSet("close") ); connect(m_btnClose, SIGNAL(clicked() ), selector(), SIGNAL(closeMe() ) ); btn = new QToolButton( box ); btn->setIconSet( Resource::loadIconSet("pcmcia") ); /* let's fill device parts */ QPopupMenu* pop = new QPopupMenu(this); connect(pop, SIGNAL( activated(int) ), this, SLOT(slotFSActivated(int) ) ); StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it(fs); for ( ; it.current(); ++it ) { const QString disk = (*it)->name(); const QString path = (*it)->path(); m_dev.insert( disk, path ); pop->insertItem( disk ); } m_fsPop = pop; btn->setPopup( pop ); lay->addWidget( box ); m_view = new QListView( this ); m_view->installEventFilter(this); QPEApplication::setStylusOperation( m_view->viewport(), QPEApplication::RightOnHold); m_view->addColumn(" " ); m_view->addColumn(tr("Name"), 135 ); m_view->addColumn(tr("Size"), -1 ); m_view->addColumn(tr("Date"), 60 ); m_view->addColumn(tr("Mime Type"), -1 ); m_view->setSorting( 1 ); m_view->setAllColumnsShowFocus( TRUE ); lay->addWidget( m_view, 1000 ); connectSlots(); }
SubdeptMaster::SubdeptMaster(MainWindow* main, Id subdept_id) : DataWindow(main, "SubdeptMaster", subdept_id) { _helpSource = "subdept_master.html"; // Create widgets QLabel* nameLabel = new QLabel(tr("&Name:"), _frame); _name = new LineEdit(30, _frame); nameLabel->setBuddy(_name); QLabel* numberLabel = new QLabel(tr("Number:"), _frame); _number = new LineEdit(5, _frame); numberLabel->setBuddy(_number); QLabel* deptLabel = new QLabel(tr("&Department:"), _frame); _dept = new LookupEdit(new DeptLookup(main, this), _frame); _dept->setLength(30); deptLabel->setBuddy(_dept); QGroupBox* flags = new QGroupBox(tr("Type"), _frame); QGridLayout* f_grid = new QGridLayout(flags, 2, 2, flags->frameWidth() * 2); f_grid->addRowSpacing(0, flags->fontMetrics().height()); _purchased = new QCheckBox(tr("Purchased?"), flags); _sold = new QCheckBox(tr("Sold?"), flags); _inventoried = new QCheckBox(tr("Inventoried?"), flags); _expenseLabel = new QLabel(tr("COGS Account:"), flags); _expenseLookup = new AccountLookup(main, this, Account::COGS); _expense_acct = new LookupEdit(_expenseLookup, flags); _expense_acct->setLength(30); _expenseLabel->setBuddy(_expense_acct); QLabel* incomeLabel = new QLabel(tr("Income Account:"), flags); AccountLookup* il = new AccountLookup(main, this, Account::Income); _income_acct = new LookupEdit(il, flags); _income_acct->setLength(30); incomeLabel->setBuddy(_income_acct); QLabel* assetLabel = new QLabel(tr("Asset Account:"), flags); AccountLookup* al = new AccountLookup(main, this, Account::Inventory); _asset_acct = new LookupEdit(al, flags); _asset_acct->setLength(30); assetLabel->setBuddy(_asset_acct); connect(_purchased, SIGNAL(toggled(bool)), SLOT(flagsChanged())); connect(_sold, SIGNAL(toggled(bool)), SLOT(flagsChanged())); connect(_inventoried, SIGNAL(toggled(bool)), SLOT(flagsChanged())); f_grid->setColStretch(1, 1); f_grid->addWidget(_purchased, 1, 0, AlignLeft | AlignVCenter); f_grid->addWidget(_sold, 2, 0, AlignLeft | AlignVCenter); f_grid->addWidget(_inventoried, 3, 0, AlignLeft | AlignVCenter); f_grid->addWidget(_expenseLabel, 1, 1, AlignRight | AlignVCenter); f_grid->addWidget(_expense_acct, 1, 2, AlignLeft | AlignVCenter); f_grid->addWidget(incomeLabel, 2, 1, AlignRight | AlignVCenter); f_grid->addWidget(_income_acct, 2, 2, AlignLeft | AlignVCenter); f_grid->addWidget(assetLabel, 3, 1, AlignRight | AlignVCenter); f_grid->addWidget(_asset_acct, 3, 2, AlignLeft | AlignVCenter); QHBox* box = new QHBox(_frame); box->setSpacing(3); QGroupBox* purchase = new QGroupBox(tr("Purchase Information"), box); QGridLayout* p_grid = new QGridLayout(purchase, 2, 2, purchase->frameWidth() * 2); p_grid->addRowSpacing(0, purchase->fontMetrics().height()); QLabel* purchLabel = new QLabel(tr("Purchase Tax:"), purchase); _purch_tax = new LookupEdit(new TaxLookup(main, this), purchase); _purch_tax->setLength(6); purchLabel->setBuddy(_purch_tax); p_grid->setColStretch(1, 1); p_grid->setRowStretch(3, 1); p_grid->addWidget(purchLabel, 1, 0, AlignLeft | AlignVCenter); p_grid->addWidget(_purch_tax, 1, 1, AlignLeft | AlignVCenter); QGroupBox* sales = new QGroupBox(tr("Sales Information"), box); QGridLayout* s_grid = new QGridLayout(sales, 2, 2, sales->frameWidth() * 2); s_grid->addRowSpacing(0, sales->fontMetrics().height()); QLabel* targetLabel = new QLabel(tr("Target GM:"), sales); _target_gm = new PercentEdit(sales); _target_gm->setLength(10); targetLabel->setBuddy(_target_gm); QLabel* allowLabel = new QLabel(tr("Variance:"), sales); _allowed_var = new PercentEdit(sales); _allowed_var->setLength(10); allowLabel->setBuddy(_allowed_var); QLabel* sellLabel = new QLabel(tr("Selling Tax:"), sales); _sell_tax = new LookupEdit(new TaxLookup(main, this), sales); _sell_tax->setLength(6); sellLabel->setBuddy(_sell_tax); _discountable = new QCheckBox(tr("Discountable?"), sales); s_grid->setRowStretch(3, 1); s_grid->setColStretch(1, 1); s_grid->addWidget(targetLabel, 1, 0, AlignLeft | AlignVCenter); s_grid->addWidget(_target_gm, 1, 1, AlignLeft | AlignVCenter); s_grid->addWidget(allowLabel, 1, 2, AlignLeft | AlignVCenter); s_grid->addWidget(_allowed_var, 1, 3, AlignLeft | AlignVCenter); s_grid->addWidget(sellLabel, 2, 0, AlignLeft | AlignVCenter); s_grid->addWidget(_sell_tax, 2, 1, AlignLeft | AlignVCenter); s_grid->addMultiCellWidget(_discountable, 2, 2, 2, 3, AlignLeft | AlignVCenter); QGridLayout* grid = new QGridLayout(_frame); grid->setMargin(3); grid->setSpacing(3); grid->setColStretch(2, 1); grid->addWidget(nameLabel, 0, 0); grid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter); grid->addWidget(numberLabel, 0, 3); grid->addWidget(_number, 0, 4, AlignLeft | AlignVCenter); grid->addWidget(deptLabel, 1, 0); grid->addWidget(_dept, 1, 1, AlignLeft | AlignVCenter); grid->addMultiCellWidget(flags, 2, 2, 0, 4); grid->addMultiCellWidget(box, 3, 3, 0, 4); setCaption(tr("Subdepartment Master")); finalize(); }
KateFileSelector::KateFileSelector( KateMainWindow *mainWindow, KateViewManager *viewManager, QWidget * parent, const char * name ) : QVBox (parent, name), mainwin(mainWindow), viewmanager(viewManager) { mActionCollection = new KActionCollection( this ); QtMsgHandler oldHandler = qInstallMsgHandler( silenceQToolBar ); KateFileSelectorToolBarParent *tbp=new KateFileSelectorToolBarParent(this); toolbar = new KateFileSelectorToolBar(tbp); tbp->setToolBar(toolbar); toolbar->setMovingEnabled(false); toolbar->setFlat(true); qInstallMsgHandler( oldHandler ); cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" ); cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion); cmbPath->setCompletionObject( cmpl ); cmbPath->setAutoDeleteCompletionObject( true ); cmbPath->listBox()->installEventFilter( this ); dir = new KDirOperator(KURL(), this, "operator"); dir->setView(KFile::/* Simple */Detail); dir->view()->setSelectionMode(KFile::Extended); connect ( dir, SIGNAL( viewChanged(KFileView *) ), this, SLOT( selectorViewChanged(KFileView *) ) ); setStretchFactor(dir, 2); KActionCollection *coll = dir->actionCollection(); // some shortcuts of diroperator that clashes with Kate coll->action( "delete" )->setShortcut( KShortcut( ALT + Key_Delete ) ); coll->action( "reload" )->setShortcut( KShortcut( ALT + Key_F5 ) ); coll->action( "back" )->setShortcut( KShortcut( ALT + SHIFT + Key_Left ) ); coll->action( "forward" )->setShortcut( KShortcut( ALT + SHIFT + Key_Right ) ); // some consistency - reset up for dir too coll->action( "up" )->setShortcut( KShortcut( ALT + SHIFT + Key_Up ) ); coll->action( "home" )->setShortcut( KShortcut( CTRL + ALT + Key_Home ) ); // bookmarks action! KActionMenu *acmBookmarks = new KActionMenu( i18n("Bookmarks"), "bookmark", mActionCollection, "bookmarks" ); acmBookmarks->setDelayed( false ); bookmarkHandler = new KBookmarkHandler( this, acmBookmarks->popupMenu() ); QHBox* filterBox = new QHBox(this); btnFilter = new QToolButton( filterBox ); btnFilter->setIconSet( SmallIconSet("filter" ) ); btnFilter->setToggleButton( true ); filter = new KHistoryCombo( true, filterBox, "filter"); filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); filterBox->setStretchFactor(filter, 2); connect( btnFilter, SIGNAL( clicked() ), this, SLOT( btnFilterClick() ) ); connect( filter, SIGNAL( activated(const QString&) ), SLOT( slotFilterChange(const QString&) ) ); connect( filter, SIGNAL( returnPressed(const QString&) ), filter, SLOT( addToHistory(const QString&) ) ); // kaction for the dir sync method acSyncDir = new KAction( i18n("Current Document Folder"), "curfiledir", 0, this, SLOT( setActiveDocumentDir() ), mActionCollection, "sync_dir" ); toolbar->setIconText( KToolBar::IconOnly ); toolbar->setIconSize( 16 ); toolbar->setEnableContextMenu( false ); connect( cmbPath, SIGNAL( urlActivated( const KURL& )), this, SLOT( cmbPathActivated( const KURL& ) )); connect( cmbPath, SIGNAL( returnPressed( const QString& )), this, SLOT( cmbPathReturnPressed( const QString& ) )); connect(dir, SIGNAL(urlEntered(const KURL&)), this, SLOT(dirUrlEntered(const KURL&)) ); connect(dir, SIGNAL(finishedLoading()), this, SLOT(dirFinishedLoading()) ); // enable dir sync button if current doc has a valid URL connect ( viewmanager, SIGNAL( viewChanged() ), this, SLOT( kateViewChanged() ) ); // Connect the bookmark handler connect( bookmarkHandler, SIGNAL( openURL( const QString& )), this, SLOT( setDir( const QString& ) ) ); waitingUrl = QString::null; // whatsthis help QWhatsThis::add( cmbPath, i18n("<p>Here you can enter a path for a folder to display." "<p>To go to a folder previously entered, press the arrow on " "the right and choose one. <p>The entry has folder " "completion. Right-click to choose how completion should behave.") ); QWhatsThis::add( filter, i18n("<p>Here you can enter a name filter to limit which files are displayed." "<p>To clear the filter, toggle off the filter button to the left." "<p>To reapply the last filter used, toggle on the filter button." ) ); QWhatsThis::add( btnFilter, i18n("<p>This button clears the name filter when toggled off, or " "reapplies the last filter used when toggled on.") ); }
AddressEditDialog::AddressEditDialog( const KABC::Address::List &list, int selected, QWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "street/postal", "Edit Address" ), Ok | Cancel, Ok, parent, name, true, true ), mPreviousAddress( 0 ) { mAddressList = list; QWidget *page = plainPage(); QGridLayout *topLayout = new QGridLayout( page, 8, 2 ); topLayout->setSpacing( spacingHint() ); mTypeCombo = new AddressTypeCombo( mAddressList, page ); topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 ); QLabel *label = new QLabel( i18n( "<streetLabel>:", "%1:" ).arg( KABC::Address::streetLabel() ), page ); label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); topLayout->addWidget( label, 1, 0 ); mStreetTextEdit = new QTextEdit( page ); mStreetTextEdit->setTextFormat( Qt::PlainText ); label->setBuddy( mStreetTextEdit ); topLayout->addWidget( mStreetTextEdit, 1, 1 ); TabPressEater *eater = new TabPressEater( this ); mStreetTextEdit->installEventFilter( eater ); label = new QLabel( i18n( "<postOfficeBoxLabel>:", "%1:" ).arg( KABC::Address::postOfficeBoxLabel() ), page ); topLayout->addWidget( label, 2 , 0 ); mPOBoxEdit = new KLineEdit( page ); label->setBuddy( mPOBoxEdit ); topLayout->addWidget( mPOBoxEdit, 2, 1 ); label = new QLabel( i18n( "<localityLabel>:", "%1:" ).arg( KABC::Address::localityLabel() ), page ); topLayout->addWidget( label, 3, 0 ); mLocalityEdit = new KLineEdit( page ); label->setBuddy( mLocalityEdit ); topLayout->addWidget( mLocalityEdit, 3, 1 ); label = new QLabel( i18n( "<regionLabel>:", "%1:" ).arg( KABC::Address::regionLabel() ), page ); topLayout->addWidget( label, 4, 0 ); mRegionEdit = new KLineEdit( page ); label->setBuddy( mRegionEdit ); topLayout->addWidget( mRegionEdit, 4, 1 ); label = new QLabel( i18n( "<postalCodeLabel>:", "%1:" ).arg( KABC::Address::postalCodeLabel() ), page ); topLayout->addWidget( label, 5, 0 ); mPostalCodeEdit = new KLineEdit( page ); label->setBuddy( mPostalCodeEdit ); topLayout->addWidget( mPostalCodeEdit, 5, 1 ); label = new QLabel( i18n( "<countryLabel>:", "%1:" ).arg( KABC::Address::countryLabel() ), page ); topLayout->addWidget( label, 6, 0 ); mCountryCombo = new KComboBox( page ); mCountryCombo->setEditable( true ); mCountryCombo->setDuplicatesEnabled( false ); #if KDE_IS_VERSION(3,3,0) QPushButton *labelButton = new QPushButton( i18n( "Edit Label..." ), page ); topLayout->addMultiCellWidget( labelButton, 7, 7, 0, 1 ); connect( labelButton, SIGNAL( clicked() ), SLOT( editLabel() ) ); #endif fillCountryCombo(); label->setBuddy( mCountryCombo ); topLayout->addWidget( mCountryCombo, 6, 1 ); mPreferredCheckBox = new QCheckBox( i18n( "street/postal", "This is the preferred address" ), page ); topLayout->addMultiCellWidget( mPreferredCheckBox, 8, 8, 0, 1 ); KSeparator *sep = new KSeparator( KSeparator::HLine, page ); topLayout->addMultiCellWidget( sep, 9, 9, 0, 1 ); QHBox *buttonBox = new QHBox( page ); buttonBox->setSpacing( spacingHint() ); topLayout->addMultiCellWidget( buttonBox, 10, 10, 0, 1 ); QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox ); connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) ); mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox ); connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) ); mChangeTypeButton = new QPushButton( i18n( "Change Type..." ), buttonBox ); connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) ); mTypeCombo->updateTypes(); mTypeCombo->setCurrentItem( selected ); updateAddressEdits(); connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( updateAddressEdits() ) ); connect( mStreetTextEdit, SIGNAL( textChanged() ), SLOT( modified() ) ); connect( mPOBoxEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mLocalityEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mRegionEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mPostalCodeEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mCountryCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); connect( mPreferredCheckBox, SIGNAL( toggled( bool ) ), SLOT( modified() ) ); KAcceleratorManager::manage( this ); mChanged = false; bool state = (mAddressList.count() > 0); mRemoveButton->setEnabled( state ); mChangeTypeButton->setEnabled( state ); }
/* * Constructs a KBabelDictView which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ KBabelDictView::KBabelDictView( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(KDialog::spacingHint()); mainLayout->setMargin(KDialog::marginHint()); splitter = new QSplitter(this); mainLayout->addWidget(splitter); QWidget *w = new QWidget(splitter); QVBoxLayout *wLayout= new QVBoxLayout(w); wLayout->setSpacing(KDialog::spacingHint()); wLayout->setMargin(KDialog::marginHint()); QHBoxLayout *hbox = new QHBoxLayout(wLayout); QLabel *label = new QLabel(i18n("Search in module:"), w); hbox->addWidget(label); moduleCombo = new KComboBox(w); hbox->addWidget(moduleCombo); QWidget *temp = new QWidget(w); hbox->addWidget(temp); hbox->setStretchFactor(temp,2); editButton = new QPushButton(i18n("&Edit"),w); editButton->setEnabled(false); hbox->addWidget(editButton); // added a button "clear search" here hbox = new QHBoxLayout(wLayout); QPushButton* clearButton = new QPushButton(w); clearButton->setFlat(true); clearButton->setPixmap(SmallIcon("locationbar_erase")); hbox->addWidget(clearButton); textEdit = new KLineEdit(w,"textedit"); textEdit->setFocus(); hbox->addWidget(textEdit); hbox = new QHBoxLayout(wLayout); startButton = new QPushButton(i18n("&Start Search"),w); hbox->addWidget(startButton); inTransButton = new QCheckBox(i18n("Sea&rch in translations"),w); hbox->addWidget(inTransButton); hbox->addStretch(1); stopButton = new QPushButton(i18n("S&top"),w); stopButton->setEnabled(false); hbox->addWidget(stopButton); KSeparator *sep = new KSeparator(w); wLayout->addWidget(sep); dictBox = new KBabelDictBox(w,"kbabeldictbox"); wLayout->addWidget(dictBox); prefWidget = new QWidget(splitter); QVBoxLayout *tempLayout= new QVBoxLayout(prefWidget); tempLayout->setSpacing(KDialog::spacingHint()); tempLayout->setMargin(KDialog::marginHint()); label = new QLabel(i18n("Settings:"),prefWidget); tempLayout->addWidget(label); prefStack = new QWidgetStack(prefWidget); tempLayout->addWidget(prefStack); tempLayout->addStretch(1); KConfig *config = KGlobal::config(); dictBox->readSettings(config); dictBox->setAutoUpdateOptions(true); QStringList modules = dictBox->moduleNames(); moduleCombo->insertStringList(modules); QPtrList<PrefWidget> prefs = dictBox->modPrefWidgets(prefStack); prefs.setAutoDelete(false); PrefWidget *p; int i=0; for(p = prefs.first(); p != 0; p=prefs.next()) { prefStack->addWidget(p,i); i++; } int active=dictBox->activeModule(); prefStack->raiseWidget(active); moduleCombo->setCurrentItem(active); QHBox *h = new QHBox(this); h->setSpacing(KDialog::spacingHint()); mainLayout->addWidget(h); progressLabel = new QLabel(h); progressBar = new KProgress(h); connect(textEdit,SIGNAL(returnPressed()),startButton,SLOT(animateClick())); connect(startButton,SIGNAL(clicked()),this, SLOT(startSearch())); connect(stopButton, SIGNAL(clicked()), dictBox,SLOT(slotStopSearch())); connect(editButton, SIGNAL(clicked()), dictBox, SLOT(edit())); connect(dictBox, SIGNAL(searchStarted()), this, SLOT(searchStarted())); connect(dictBox, SIGNAL(searchStopped()), this, SLOT(searchStopped())); connect(dictBox, SIGNAL(progressed(int)), progressBar, SLOT(setProgress(int))); connect(dictBox, SIGNAL(activeModuleChanged(bool)) , editButton, SLOT(setEnabled(bool))); connect(dictBox, SIGNAL(progressStarts(const QString&)) , this, SLOT(progressStarted(const QString&))); connect(dictBox, SIGNAL(progressEnds()), this, SLOT(progressStopped())); connect(moduleCombo, SIGNAL(activated(int)), dictBox, SLOT(setActiveModule(int))); connect(dictBox, SIGNAL(activeModuleChanged(int)) , this, SLOT(switchModule(int))); connect(clearButton, SIGNAL(clicked()), this, SLOT(slotClearSearch())); }
//-----Constructor------------------------------------------------------------ CFileDlg::CFileDlg(const char *szId, unsigned long nPPID, CICQDaemon *daemon, QWidget* parent) : QWidget(parent, "FileDialog", WDestructiveClose) { // If we are the server, then we are receiving a file m_szId = szId ? strdup(szId) : 0; m_nPPID = nPPID; licqDaemon = daemon; setCaption(tr("Licq - File Transfer (%1)").arg(m_szId)); unsigned short CR = 0; QGridLayout* lay = new QGridLayout(this, 8, 3, 8, 8); lay->setColStretch(1, 2); lblTransferFileName = new QLabel(tr("Current:"), this); lay->addWidget(lblTransferFileName, CR, 0); nfoTransferFileName = new CInfoField(this, true); nfoTransferFileName->setMinimumWidth(nfoTransferFileName->sizeHint().width()*2); lay->addWidget(nfoTransferFileName, CR, 1); nfoTotalFiles = new CInfoField(this, true); nfoTotalFiles->setMinimumWidth((nfoTotalFiles->sizeHint().width()*3)/2); lay->addWidget(nfoTotalFiles, CR, 2); lblLocalFileName = new QLabel(tr("File name:"), this); lay->addWidget(lblLocalFileName, ++CR, 0); nfoLocalFileName = new CInfoField(this, true); lay->addMultiCellWidget(nfoLocalFileName, CR, CR, 1, 2); lay->addRowSpacing(++CR, 10); // Information stuff about the current file lblTrans = new QLabel(tr("File:"), this); lay->addWidget(lblTrans, ++CR, 0); barTransfer = new QProgressBar(this); lay->addWidget(barTransfer, CR, 1); nfoFileSize = new CInfoField(this, true); lay->addWidget(nfoFileSize, CR, 2); // Information about the batch file transfer lblBatch = new QLabel(tr("Batch:"), this); lay->addWidget(lblBatch, ++CR, 0); barBatchTransfer = new QProgressBar(this); lay->addWidget(barBatchTransfer, CR, 1); nfoBatchSize = new CInfoField(this, true); lay->addWidget(nfoBatchSize, CR, 2); lblTime = new QLabel(tr("Time:"), this); lay->addWidget(lblTime, ++CR, 0); QHBox* hbox = new QHBox(this); hbox->setSpacing(8); lay->addMultiCellWidget(hbox, CR, CR, 0, 1); nfoTime = new CInfoField(hbox, true); nfoBPS = new CInfoField(hbox, true); lblETA = new QLabel(tr("ETA:"), hbox); nfoETA = new CInfoField(this, true); lay->addWidget(nfoETA, CR++, 2); lay->addRowSpacing(++CR, 10); mleStatus = new MLEditWrap(true, this); ++CR; lay->addMultiCellWidget(mleStatus, CR, CR, 0, 2); mleStatus->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); lay->setRowStretch(++CR, 3); hbox = new QHBox(this); hbox->setSpacing(8); lay->addMultiCellWidget(hbox, CR, CR, 0, 2); btnCancel = new QPushButton(tr("&Cancel Transfer"), hbox); btnCancel->setMinimumWidth(75); connect(btnCancel, SIGNAL(clicked()), this, SLOT(close())); //TODO fix this ftman = new CFileTransferManager(licqDaemon, strtoul(m_szId, (char **)NULL, 10)); ftman->SetUpdatesEnabled(2); sn = new QSocketNotifier(ftman->Pipe(), QSocketNotifier::Read); connect(sn, SIGNAL(activated(int)), SLOT(slot_ft())); #ifdef USE_KDE btnOpen = new QPushButton(tr("&Open"), hbox); btnOpenDir = new QPushButton(tr("O&pen Dir"), hbox); btnOpen->hide(); btnOpenDir->hide(); connect(btnOpen, SIGNAL(clicked()), SLOT(slot_open())); connect(btnOpenDir, SIGNAL(clicked()), SLOT(slot_opendir())); #else btnOpen = 0; btnOpenDir = 0; #endif }
kpEffectsDialog::kpEffectsDialog (bool actOnSelection, kpMainWindow *parent, const char *name) : kpToolPreviewDialog (kpToolPreviewDialog::Preview, true/*reserve top row*/, QString::null/*caption*/, QString::null/*afterActionText (no Dimensions Group Box)*/, actOnSelection, parent, name), m_delayedUpdateTimer (new QTimer (this)), m_effectsComboBox (0), m_settingsGroupBox (0), m_settingsLayout (0), m_colorEffectWidget (0) { #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "kpEffectsDialog::kpEffectsDialog()" << endl; #endif if (actOnSelection) setCaption (i18n ("More Image Effects (Selection)")); else setCaption (i18n ("More Image Effects")); connect (m_delayedUpdateTimer, SIGNAL (timeout ()), this, SLOT (slotUpdateWithWaitCursor ())); QHBox *effectContainer = new QHBox (mainWidget ()); effectContainer->setSpacing (spacingHint () * 4 /*need more space for QGroupBox titles*/); effectContainer->setMargin (0); QLabel *label = new QLabel (i18n ("&Effect:"), effectContainer); m_effectsComboBox = new KComboBox (effectContainer); m_effectsComboBox->insertItem (i18n ("Balance")); m_effectsComboBox->insertItem (i18n ("Emboss")); m_effectsComboBox->insertItem (i18n ("Flatten")); m_effectsComboBox->insertItem (i18n ("Invert")); m_effectsComboBox->insertItem (i18n ("Reduce Colors")); m_effectsComboBox->insertItem (i18n ("Soften & Sharpen")); label->setBuddy (m_effectsComboBox); effectContainer->setStretchFactor (m_effectsComboBox, 1); addCustomWidgetToFront (effectContainer); m_settingsGroupBox = new QGroupBox (mainWidget ()); m_settingsLayout = new QVBoxLayout (m_settingsGroupBox, marginHint () * 2, spacingHint ()); addCustomWidgetToBack (m_settingsGroupBox); connect (m_effectsComboBox, SIGNAL (activated (int)), this, SLOT (selectEffect (int))); selectEffect (0); resize (s_lastWidth, s_lastHeight); #if DEBUG_KP_EFFECTS_DIALOG kdDebug () << "\tabout to slotUpdate()" << endl; #endif slotUpdate (); }
/** This is a generic class for importing line-oriented data from text files. It provides a dialog for file selection, preview, separator selection and column assignment as well as generic conversion routines. For conversion to special data objects, this class has to be inherited by a special class, which reimplements the convertRow() function. */ KImportDialog::KImportDialog(QWidget *parent) : KDialogBase(parent, "importdialog", true, i18n("Import Text File"), Ok | Cancel), mSeparator(","), mCurrentRow(0) { mData.setAutoDelete(true); QVBox *topBox = new QVBox(this); setMainWidget(topBox); topBox->setSpacing(spacingHint()); QHBox *fileBox = new QHBox(topBox); fileBox->setSpacing(spacingHint()); new QLabel(i18n("File to import:"), fileBox); KURLRequester *urlRequester = new KURLRequester(fileBox); urlRequester->setFilter("*.csv"); connect(urlRequester, SIGNAL(returnPressed(const QString &)), SLOT(setFile(const QString &))); connect(urlRequester, SIGNAL(urlSelected(const QString &)), SLOT(setFile(const QString &))); connect(urlRequester->lineEdit(), SIGNAL(textChanged(const QString &)), SLOT(slotUrlChanged(const QString &))); mTable = new QTable(5, 5, topBox); mTable->setMinimumHeight(150); connect(mTable, SIGNAL(selectionChanged()), SLOT(tableSelected())); QHBox *separatorBox = new QHBox(topBox); separatorBox->setSpacing(spacingHint()); new QLabel(i18n("Separator:"), separatorBox); mSeparatorCombo = new KComboBox(separatorBox); mSeparatorCombo->insertItem(","); mSeparatorCombo->insertItem(i18n("Tab")); mSeparatorCombo->insertItem(i18n("Space")); mSeparatorCombo->insertItem("="); mSeparatorCombo->insertItem(";"); connect(mSeparatorCombo, SIGNAL(activated(int)), this, SLOT(separatorClicked(int))); mSeparatorCombo->setCurrentItem(0); QHBox *rowsBox = new QHBox(topBox); rowsBox->setSpacing(spacingHint()); new QLabel(i18n("Import starts at row:"), rowsBox); mStartRow = new QSpinBox(rowsBox); mStartRow->setMinValue(1); /* new QLabel( i18n( "And ends at row:" ), rowsBox ); mEndRow = new QSpinBox( rowsBox ); mEndRow->setMinValue( 1 ); */ QVBox *assignBox = new QVBox(topBox); assignBox->setSpacing(spacingHint()); QHBox *listsBox = new QHBox(assignBox); listsBox->setSpacing(spacingHint()); mHeaderList = new QListView(listsBox); mHeaderList->addColumn(i18n("Header")); connect(mHeaderList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(headerSelected(QListViewItem *))); connect(mHeaderList, SIGNAL(doubleClicked(QListViewItem *)), SLOT(assignColumn(QListViewItem *))); mFormatCombo = new KComboBox(listsBox); mFormatCombo->setDuplicatesEnabled(false); QPushButton *assignButton = new QPushButton(i18n("Assign to Selected Column"), assignBox); connect(assignButton, SIGNAL(clicked()), SLOT(assignColumn())); QPushButton *removeButton = new QPushButton(i18n("Remove Assignment From Selected Column"), assignBox); connect(removeButton, SIGNAL(clicked()), SLOT(removeColumn())); QPushButton *assignTemplateButton = new QPushButton(i18n("Assign with Template..."), assignBox); connect(assignTemplateButton, SIGNAL(clicked()), SLOT(assignTemplate())); QPushButton *saveTemplateButton = new QPushButton(i18n("Save Current Template"), assignBox); connect(saveTemplateButton, SIGNAL(clicked()), SLOT(saveTemplate())); resize(500, 300); connect(this, SIGNAL(okClicked()), SLOT(applyConverter())); connect(this, SIGNAL(applyClicked()), SLOT(applyConverter())); enableButtonOK(!urlRequester->lineEdit()->text().isEmpty()); }
Dialog::Dialog(QCString & path, QCString & encoding, QCString & nomodel, QCString & genview, QCString & uml20, QCString & pk, QCString & vis, QCString & primitivetype, QCString & genextension, QCString & geneclipse, QCString & commentexporter, QCString & linefeed, Language & lang) : QDialog(0, 0, TRUE), _path(path), _encoding(encoding), _nomodel(nomodel), _genview(genview), _uml20(uml20), _pk(pk), _vis(vis), _primitivetype(primitivetype), _genextension(genextension), _geneclipse(geneclipse), _commentexporter(commentexporter), _linefeed(linefeed), _lang(lang) { QVBoxLayout * vbox = new QVBoxLayout(this); QHBox * htab; vbox->setMargin(5); // get xmi pathname htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); new QLabel("generated \nXMI file : ", htab); ed = new QLineEdit(htab); ed->setText(_path); new QLabel(" ", htab); SmallPushButton * br = new SmallPushButton("browse", htab); connect(br, SIGNAL(clicked ()), this, SLOT(browse())); // to choose encoding htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); new QLabel("Encoding : ", htab); QString charset = getenv("BOUML_CHARSET"); int index = 0; while ((index = charset.find('_')) != -1) { charset[index] = '-'; index += 1; } encoding_cb = new QComboBox(TRUE, htab); htab->setStretchFactor(encoding_cb, 1000); if (_encoding.isEmpty()) _encoding = "UTF-8"; encoding_cb->insertItem(QString(_encoding)); if (!charset.isEmpty() && (_encoding != (const char *) charset)) encoding_cb->insertItem(charset); if (_encoding != "UTF-8") encoding_cb->insertItem("UTF-8"); #ifdef WIN32 if ((_encoding != "windows-1252") && (charset != "windows-1252")) encoding_cb->insertItem("windows-1252"); if ((_encoding != "ISO-8859-1") && (charset != "ISO-8859-1")) encoding_cb->insertItem("ISO-8859-1"); #else if ((_encoding != "ISO-8859-1") && (charset != "ISO-8859-1")) encoding_cb->insertItem("ISO-8859-1"); if ((_encoding != "windows-1252") && (charset != "windows-1252")) encoding_cb->insertItem("windows-1252"); #endif // uml 2.0 or uml2.1 htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); QButtonGroup * bg = new QButtonGroup(2, Qt::Horizontal, "Uml", htab); uml20_rb = new QRadioButton("uml 2.0", bg); uml21_rb = new QRadioButton("uml 2.1", bg); if (uml20 == "yes") uml20_rb->setChecked(TRUE); else uml21_rb->setChecked(TRUE); // generate model htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); nomodel_cb = new QCheckBox("Don't generate model level", htab); if (_nomodel == "yes") nomodel_cb->setChecked(TRUE); // generate view checkbox htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); genview_cb = new QCheckBox("Generate views as package (not compatible with profile generation)", htab); if (_genview == "yes") genview_cb->setChecked(TRUE); // generate pk_ prefix htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); pk_cb = new QCheckBox("Generate 'pk_' prefix for parameter direction", htab); if (_pk == "yes") pk_cb->setChecked(TRUE); // generate vis_ prefix htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); vis_cb = new QCheckBox("Generate 'vis_' prefix for visibility", htab); if (_vis == "yes") vis_cb->setChecked(TRUE); // use PrimitiveType rather than DataType htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); primitivetype_cb = new QCheckBox("Use PrimitiveType rather than DataType", htab); if (_primitivetype == "yes") primitivetype_cb->setChecked(TRUE); // generate extension htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); genextension_cb = new QCheckBox("Generate extensions", htab); if (_genextension == "yes") genextension_cb->setChecked(TRUE); // generate for Eclipse htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); geneclipse_cb = new QCheckBox("Generate for Eclipse (aggregation set on other relation side)", htab); if (_geneclipse == "yes") geneclipse_cb->setChecked(TRUE); // comment exporter htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); commentexporter_cb = new QCheckBox("Comment exporter indication (needed to import in some tools like Rsa)", htab); if (_commentexporter == "yes") commentexporter_cb->setChecked(TRUE); // generate rather than linefeed htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); linefeed_cb = new QCheckBox("Generate lf and cr characters in string rather than '& ' and '& '", htab); if (_linefeed == "yes") linefeed_cb->setChecked(TRUE); // uml , c++, java, cancel buttons htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); new QLabel(htab); QPushButton * uml = new QPushButton("&Uml", htab); new QLabel(htab); QPushButton * cpp = new QPushButton("&C++", htab); new QLabel(htab); QPushButton * java = new QPushButton("&Java", htab); new QLabel(htab); QPushButton * cancel = new QPushButton("&Cancel", htab); new QLabel(htab); QSize bs(cancel->sizeHint()); uml->setFixedSize(bs); cpp->setFixedSize(bs); java->setFixedSize(bs); connect(uml, SIGNAL(clicked()), this, SLOT(accept_uml())); connect(cpp, SIGNAL(clicked()), this, SLOT(accept_cpp())); connect(java, SIGNAL(clicked()), this, SLOT(accept_java())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); // help htab = new QHBox(this); htab->setMargin(5); vbox->addWidget(htab); new QLabel(htab); new QLabel("Remark : to help Eclipse to import the generated file,\n" "choose Uml 2.1 and name the file with the extension '.xmi'", htab); new QLabel(htab); }
void KPrPgConfDia::setupPageSlides() { QFrame* slidesPage = addPage( i18n("&Slides") ); QWhatsThis::add( slidesPage, i18n("<p>This dialog allows you to configure which slides " "are used in the presentation. Slides that are not " "selected will not be displayed during the slide " "show.</p>") ); QGridLayout *slidesLayout = new QGridLayout( slidesPage,7 , 2, 0, KDialog::spacingHint()); QButtonGroup *group=new QVButtonGroup( slidesPage ); group->setRadioButtonExclusive( true ); m_customSlide = new QRadioButton( i18n( "Custom slide show" ), group, "customslide" ); connect( m_customSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) ); QHBox *box = new QHBox( group ); m_labelCustomSlide = new QLabel( i18n( "Custom slide:" ),box ); m_customSlideCombobox = new QComboBox( box ); m_customSlideCombobox->insertStringList( m_doc->presentationList() ); m_selectedSlide = new QRadioButton( i18n( "Selected pages:" ), group, "selectedslide" ); slidesLayout->addMultiCellWidget( group, 0,2,0,1 ); connect( m_selectedSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) ); slides = new QListView( slidesPage ); slidesLayout->addMultiCellWidget( slides, 3, 3, 0, 1 ); slidesLayout->setRowStretch( 3, 10 ); slides->addColumn( i18n("Slide") ); slides->setSorting( -1 ); slides->header()->hide(); for ( int i = m_doc->getPageNums() - 1; i >= 0; --i ) { KPrPage *page=m_doc->pageList().at( i ); QCheckListItem* item = new QCheckListItem( slides, page->pageTitle(), QCheckListItem::CheckBox ); item->setOn( page->isSlideSelected() ); } QHBox* buttonGroup = new QHBox( slidesPage ); buttonGroup->setSpacing( KDialog::spacingHint() ); QPushButton* selectAllButton = new QPushButton( i18n( "Select &All" ), buttonGroup ); connect( selectAllButton, SIGNAL( clicked() ), this, SLOT( selectAllSlides() ) ); QPushButton* deselectAllButton = new QPushButton( i18n( "&Deselect All" ), buttonGroup ); connect( deselectAllButton, SIGNAL( clicked() ), this, SLOT( deselectAllSlides() ) ); QWidget* spacer = new QWidget( buttonGroup ); spacer->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); slidesLayout->addMultiCellWidget( buttonGroup, 4, 4, 0, 1 ); if ( !m_doc->presentationName().isEmpty() ) { m_customSlide->setChecked( true ); m_customSlideCombobox->setCurrentText( m_doc->presentationName() ); } else m_selectedSlide->setChecked( true ); if ( m_customSlideCombobox->count()==0 ) { m_customSlide->setEnabled( false ); m_labelCustomSlide->setEnabled( false ); m_customSlideCombobox->setEnabled( false ); } radioButtonClicked(); }
PlayerBox::PlayerBox(bool playerOne, QWidget* parent, const char* name) : QGroupBox(parent, name) { QHBoxLayout* l = new QHBoxLayout(this, PLAYERBOX_BORDERS, PLAYERBOX_HDISTANCEOFWIDGETS); // The card and "held" label arrays. m_cardWidgets = new CardWidget *[PokerHandSize]; m_heldLabels = new QLabel *[PokerHandSize]; QFont myFixedFont; myFixedFont.setPointSize(12); // Generate the 5 cards for (int i = 0; i < PokerHandSize; i++) { QVBoxLayout* vl = new QVBoxLayout(0); l->addLayout(vl, 0); QHBox* cardBox = new QHBox(this); vl->addWidget(cardBox, 0); cardBox->setFrameStyle(Box | Sunken); m_cardWidgets[i] = new CardWidget(cardBox); cardBox->setFixedSize(cardBox->sizeHint()); // Only add the "held" labels if this is the first player (the human one). if (playerOne) { QHBox* b = new QHBox(this); m_heldLabels[i] = new QLabel(b); m_heldLabels[i]->setText(i18n("Held")); b->setFrameStyle(Box | Sunken); b->setFixedSize(b->sizeHint()); m_cardWidgets[i]->heldLabel = m_heldLabels[i]; QHBoxLayout* heldLayout = new QHBoxLayout(0); heldLayout->addWidget(b, 0, AlignCenter); vl->insertLayout(0, heldLayout, 0); vl->insertStretch(0, 1); vl->addStretch(1); } } // Add the cash and bet labels. { QVBoxLayout* vl = new QVBoxLayout; l->addLayout(vl); vl->addStretch(); m_cashLabel = new QLabel(this); m_cashLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); m_cashLabel->setFont(myFixedFont); vl->addWidget(m_cashLabel, 0, AlignHCenter); vl->addStretch(); m_betLabel = new QLabel(this); m_betLabel->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); m_betLabel->setFont(myFixedFont); vl->addWidget(m_betLabel, 0, AlignHCenter); vl->addStretch(); } QToolTip::add(m_cashLabel, i18n("Money of %1").arg("Player"));//change via showName() // Assume that we have a multiplayer game. m_singlePlayer = false; }
KateConfigDialog::KateConfigDialog(KateMainWindow *parent, Kate::View *view) : KDialogBase(KDialogBase::TreeList, i18n("Configure"), KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel | KDialogBase::Help, KDialogBase::Ok, parent, "configdialog") { KConfig *config = KateApp::self()->config(); KWin::setIcons(winId(), KateApp::self()->icon(), KateApp::self()->miniIcon()); actionButton(KDialogBase::Apply)->setEnabled(false); mainWindow = parent; setMinimumSize(600, 400); v = view; pluginPages.setAutoDelete(false); editorPages.setAutoDelete(false); QStringList path; setShowIconsInTreeList(true); path.clear(); path << i18n("Application"); setFolderIcon(path, SmallIcon("kate", KIcon::SizeSmall)); path.clear(); // BEGIN General page path << i18n("Application") << i18n("General"); QFrame *frGeneral = addPage(path, i18n("General Options"), BarIcon("gohome", KIcon::SizeSmall)); QVBoxLayout *lo = new QVBoxLayout(frGeneral); lo->setSpacing(KDialog::spacingHint()); config->setGroup("General"); // GROUP with the one below: "Appearance" QButtonGroup *bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Appearance"), frGeneral); lo->addWidget(bgStartup); // show full path in title config->setGroup("General"); cb_fullPath = new QCheckBox(i18n("&Show full path in title"), bgStartup); cb_fullPath->setChecked(mainWindow->viewManager()->getShowFullPath()); QWhatsThis::add(cb_fullPath, i18n("If this option is checked, the full document path will be shown in the window caption.")); connect(cb_fullPath, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // GROUP with the one below: "Behavior" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("&Behavior"), frGeneral); lo->addWidget(bgStartup); // sync the konsole ? cb_syncKonsole = new QCheckBox(bgStartup); cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document")); cb_syncKonsole->setChecked(parent->syncKonsole); QWhatsThis::add(cb_syncKonsole, i18n("If this is checked, the built in Konsole will <code>cd</code> to the directory " "of the active document when started and whenever the active document changes, " "if the document is a local file.")); connect(cb_syncKonsole, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // modified files notification cb_modNotifications = new QCheckBox(i18n("Wa&rn about files modified by foreign processes"), bgStartup); cb_modNotifications->setChecked(parent->modNotification); QWhatsThis::add(cb_modNotifications, i18n("If enabled, when Kate receives focus you will be asked what to do with " "files that have been modified on the hard disk. If not enabled, you will " "be asked what to do with a file that has been modified on the hard disk only " "when that file gains focus inside Kate.")); connect(cb_modNotifications, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // GROUP with the one below: "Meta-informations" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Meta-Information"), frGeneral); lo->addWidget(bgStartup); // save meta infos cb_saveMetaInfos = new QCheckBox(bgStartup); cb_saveMetaInfos->setText(i18n("Keep &meta-information past sessions")); cb_saveMetaInfos->setChecked(KateDocManager::self()->getSaveMetaInfos()); QWhatsThis::add(cb_saveMetaInfos, i18n("Check this if you want document configuration like for example " "bookmarks to be saved past editor sessions. The configuration will be " "restored if the document has not changed when reopened.")); connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); // meta infos days QHBox *hbDmf = new QHBox(bgStartup); hbDmf->setEnabled(KateDocManager::self()->getSaveMetaInfos()); QLabel *lDmf = new QLabel(i18n("&Delete unused meta-information after:"), hbDmf); sb_daysMetaInfos = new QSpinBox(0, 180, 1, hbDmf); sb_daysMetaInfos->setSpecialValueText(i18n("(never)")); sb_daysMetaInfos->setSuffix(i18n(" day(s)")); sb_daysMetaInfos->setValue(KateDocManager::self()->getDaysMetaInfos()); lDmf->setBuddy(sb_daysMetaInfos); connect(cb_saveMetaInfos, SIGNAL(toggled(bool)), hbDmf, SLOT(setEnabled(bool))); connect(sb_daysMetaInfos, SIGNAL(valueChanged(int)), this, SLOT(slotChanged())); lo->addStretch(1); // :-] works correct without autoadd // END General page path.clear(); // BEGIN Session page path << i18n("Application") << i18n("Sessions"); QFrame *frSessions = addPage(path, i18n("Session Management"), BarIcon("history", KIcon::SizeSmall)); lo = new QVBoxLayout(frSessions); lo->setSpacing(KDialog::spacingHint()); // GROUP with the one below: "Startup" bgStartup = new QButtonGroup(1, Qt::Horizontal, i18n("Elements of Sessions"), frSessions); lo->addWidget(bgStartup); // restore view config cb_restoreVC = new QCheckBox(bgStartup); cb_restoreVC->setText(i18n("Include &window configuration")); config->setGroup("General"); cb_restoreVC->setChecked(config->readBoolEntry("Restore Window Configuration", true)); QWhatsThis::add(cb_restoreVC, i18n("Check this if you want all your views and frames restored each time you open Kate")); connect(cb_restoreVC, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); QRadioButton *rb1, *rb2, *rb3; sessions_start = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Startup"), frSessions); lo->add(sessions_start); sessions_start->setRadioButtonExclusive(true); sessions_start->insert(rb1 = new QRadioButton(i18n("&Start new session"), sessions_start), 0); sessions_start->insert(rb2 = new QRadioButton(i18n("&Load last-used session"), sessions_start), 1); sessions_start->insert(rb3 = new QRadioButton(i18n("&Manually choose a session"), sessions_start), 2); config->setGroup("General"); QString sesStart(config->readEntry("Startup Session", "manual")); if(sesStart == "new") sessions_start->setButton(0); else if(sesStart == "last") sessions_start->setButton(1); else sessions_start->setButton(2); connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); sessions_exit = new QButtonGroup(1, Qt::Horizontal, i18n("Behavior on Application Exit or Session Switch"), frSessions); lo->add(sessions_exit); sessions_exit->setRadioButtonExclusive(true); sessions_exit->insert(rb1 = new QRadioButton(i18n("&Do not save session"), sessions_exit), 0); sessions_exit->insert(rb2 = new QRadioButton(i18n("&Save session"), sessions_exit), 1); sessions_exit->insert(rb3 = new QRadioButton(i18n("&Ask user"), sessions_exit), 2); config->setGroup("General"); QString sesExit(config->readEntry("Session Exit", "save")); if(sesExit == "discard") sessions_exit->setButton(0); else if(sesExit == "save") sessions_exit->setButton(1); else sessions_exit->setButton(2); connect(rb1, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb2, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); connect(rb3, SIGNAL(toggled(bool)), this, SLOT(slotChanged())); lo->addStretch(1); // :-] works correct without autoadd // END Session page path.clear(); // file selector page path << i18n("Application") << i18n("File Selector"); QVBox *page = addVBoxPage(path, i18n("File Selector Settings"), BarIcon("fileopen", KIcon::SizeSmall)); fileSelConfigPage = new KFSConfigPage(page, "file selector config page", mainWindow->fileselector); connect(fileSelConfigPage, SIGNAL(changed()), this, SLOT(slotChanged())); path.clear(); path << i18n("Application") << i18n("Document List"); page = addVBoxPage(path, i18n("Document List Settings"), BarIcon("view_text", KIcon::SizeSmall)); filelistConfigPage = new KFLConfigPage(page, "file list config page", mainWindow->filelist); connect(filelistConfigPage, SIGNAL(changed()), this, SLOT(slotChanged())); path.clear(); path << i18n("Application") << i18n("Plugins"); /*QVBox **/ page = addVBoxPage(path, i18n("Plugin Manager"), BarIcon("connect_established", KIcon::SizeSmall)); KateConfigPluginPage *configPluginPage = new KateConfigPluginPage(page, this); connect(configPluginPage, SIGNAL(changed()), this, SLOT(slotChanged())); // Tools->External Tools menu path.clear(); path << i18n("Application") << i18n("External Tools"); page = addVBoxPage(path, i18n("External Tools"), BarIcon("configure", KIcon::SizeSmall)); configExternalToolsPage = new KateExternalToolsConfigWidget(page, "external tools config page"); connect(configExternalToolsPage, SIGNAL(changed()), this, SLOT(slotChanged())); // editor widgets from kwrite/kwdialog path.clear(); path << i18n("Editor"); setFolderIcon(path, SmallIcon("edit", KIcon::SizeSmall)); for(uint i = 0; i < KTextEditor::configInterfaceExtension(v->document())->configPages(); i++) { path.clear(); path << i18n("Editor") << KTextEditor::configInterfaceExtension(v->document())->configPageName(i); /*QVBox **/ page = addVBoxPage(path, KTextEditor::configInterfaceExtension(v->document())->configPageFullName(i), KTextEditor::configInterfaceExtension(v->document())->configPagePixmap(i, KIcon::SizeSmall)); KTextEditor::ConfigPage *cPage = KTextEditor::configInterfaceExtension(v->document())->configPage(i, page); connect(cPage, SIGNAL(changed()), this, SLOT(slotChanged())); editorPages.append(cPage); } KatePluginList &pluginList(KatePluginManager::self()->pluginList()); for(unsigned int i = 0; i < pluginList.size(); ++i) { if(pluginList[i].load && Kate::pluginConfigInterfaceExtension(pluginList[i].plugin)) addPluginPage(pluginList[i].plugin); } enableButtonSeparator(true); dataChanged = false; unfoldTreeList(); }
void K3bVideoCdRippingDialog::setupGui() { QWidget * frame = mainWidget(); QGridLayout* MainLayout = new QGridLayout( frame ); MainLayout->setSpacing( KDialog::spacingHint() ); MainLayout->setMargin( 0 ); // ---------------------------------------------------- Directory group --- QGroupBox* groupDirectory = new QGroupBox( 0, Qt::Vertical, i18n( "Destination Directory" ), frame ); groupDirectory->layout() ->setSpacing( KDialog::spacingHint() ); groupDirectory->layout() ->setMargin( KDialog::marginHint() ); QGridLayout* groupDirectoryLayout = new QGridLayout( groupDirectory->layout() ); groupDirectoryLayout->setAlignment( Qt::AlignTop ); QLabel* rippathLabel = new QLabel( i18n( "Rip files to:" ), groupDirectory ); m_editDirectory = new KURLRequester( groupDirectory, "m_editDirectory" ); m_editDirectory->setURL( QDir::homeDirPath() ); m_editDirectory->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); rippathLabel->setBuddy( m_editDirectory ); QHBox* freeSpaceBox = new QHBox( groupDirectory ); freeSpaceBox->setSpacing( KDialog::spacingHint() ); ( void ) new QLabel( i18n( "Free space in directory:" ), freeSpaceBox, "FreeSpaceLabel" ); m_labelFreeSpace = new QLabel( " ", freeSpaceBox, "m_labelFreeSpace" ); m_labelFreeSpace->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); QHBox* necessarySizeBox = new QHBox( groupDirectory ); necessarySizeBox->setSpacing( KDialog::spacingHint() ); ( void ) new QLabel( i18n( "Necessary storage size:" ), necessarySizeBox, "StorSize" ); m_labelNecessarySize = new QLabel( " ", necessarySizeBox, "m_labelNecessarySize" ); m_labelNecessarySize->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); groupDirectoryLayout->addWidget( rippathLabel, 0, 0 ); groupDirectoryLayout->addWidget( m_editDirectory, 0, 1 ); groupDirectoryLayout->addWidget( freeSpaceBox, 1, 1 ); groupDirectoryLayout->addWidget( necessarySizeBox, 2, 1 ); // ---------------------------------------------------- Options group --- QGroupBox* groupOptions = new QGroupBox( 4, Qt::Vertical, i18n( "Settings" ), frame ); m_ignoreExt = new QCheckBox( i18n( "Ignore /EXT/PSD_X.VCD" ), groupOptions ); m_sector2336 = new QCheckBox( i18n( "Use 2336 byte sector mode for image file" ), groupOptions ); // Only available for image file ripping m_sector2336->setEnabled( false ); m_sector2336->setChecked( false ); m_extractXML = new QCheckBox( i18n( "Extract XML structure" ), groupOptions ); MainLayout->addWidget( groupDirectory, 0, 0 ); MainLayout->addWidget( groupOptions, 1, 0 ); MainLayout->setRowStretch( 0, 1 ); setStartButtonText( i18n( "Start Ripping" ), i18n( "Starts extracting the selected VideoCd tracks" ) ); // ---------------------------------------------------------------------------------- connect( m_editDirectory, SIGNAL(textChanged(const QString&)), this, SLOT(slotUpdateFreeSpace()) ); m_labelNecessarySize ->setText( KIO::convertSize( m_videooptions ->getVideoCdSize() ) ); }
FontColourChooser::FontColourChooser(QWidget *parent, const char *name, bool onlyFixed, const QStringList &fontList, const QString &frameLabel, bool editColours, bool fg, bool defaultFont, int visibleListSize) : QWidget(parent, name), mFgColourButton(0), mRemoveColourButton(0), mColourList(Preferences::messageColours()), mReadOnly(false) { QVBoxLayout *topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint()); QWidget *page = this; if(!frameLabel.isNull()) { page = new QGroupBox(frameLabel, this); topLayout->addWidget(page); topLayout = new QVBoxLayout(page, KDialog::marginHint(), KDialog::spacingHint()); topLayout->addSpacing(fontMetrics().height() - KDialog::marginHint() + KDialog::spacingHint()); } QHBoxLayout *hlayout = new QHBoxLayout(topLayout); QVBoxLayout *colourLayout = new QVBoxLayout(hlayout); if(fg) { QHBox *box = new QHBox(page); // to group widgets for QWhatsThis text box->setSpacing(KDialog::spacingHint() / 2); colourLayout->addWidget(box); QLabel *label = new QLabel(i18n("&Foreground color:"), box); box->setStretchFactor(new QWidget(box), 0); mFgColourButton = new ColourCombo(box); connect(mFgColourButton, SIGNAL(activated(const QString &)), SLOT(setSampleColour())); label->setBuddy(mFgColourButton); QWhatsThis::add(box, i18n("Select the alarm message foreground color")); } QHBox *box = new QHBox(page); // to group widgets for QWhatsThis text box->setSpacing(KDialog::spacingHint() / 2); colourLayout->addWidget(box); QLabel *label = new QLabel(i18n("&Background color:"), box); box->setStretchFactor(new QWidget(box), 0); mBgColourButton = new ColourCombo(box); connect(mBgColourButton, SIGNAL(activated(const QString &)), SLOT(setSampleColour())); label->setBuddy(mBgColourButton); QWhatsThis::add(box, i18n("Select the alarm message background color")); hlayout->addStretch(); if(editColours) { QHBoxLayout *layout = new QHBoxLayout(topLayout); QPushButton *button = new QPushButton(i18n("Add Co&lor..."), page); button->setFixedSize(button->sizeHint()); connect(button, SIGNAL(clicked()), SLOT(slotAddColour())); QWhatsThis::add(button, i18n("Choose a new color to add to the color selection list.")); layout->addWidget(button); mRemoveColourButton = new QPushButton(i18n("&Remove Color"), page); mRemoveColourButton->setFixedSize(mRemoveColourButton->sizeHint()); connect(mRemoveColourButton, SIGNAL(clicked()), SLOT(slotRemoveColour())); QWhatsThis::add(mRemoveColourButton, i18n("Remove the color currently shown in the background color chooser, from the color selection list.")); layout->addWidget(mRemoveColourButton); } if(defaultFont) { QHBoxLayout *layout = new QHBoxLayout(topLayout); mDefaultFont = new CheckBox(i18n("Use &default font"), page); mDefaultFont->setMinimumSize(mDefaultFont->sizeHint()); connect(mDefaultFont, SIGNAL(toggled(bool)), SLOT(slotDefaultFontToggled(bool))); QWhatsThis::add(mDefaultFont, i18n("Check to use the default font current at the time the alarm is displayed.")); layout->addWidget(mDefaultFont); layout->addWidget(new QWidget(page)); // left adjust the widget } else mDefaultFont = 0; mFontChooser = new KFontChooser(page, name, onlyFixed, fontList, false, visibleListSize); mFontChooser->installEventFilter(this); // for read-only mode const QObjectList *kids = mFontChooser->queryList(); for(QObjectList::ConstIterator it = kids->constBegin(); it != kids->constEnd(); ++it) (*it)->installEventFilter(this); topLayout->addWidget(mFontChooser); slotDefaultFontToggled(false); }
CoverManager::CoverManager() : QSplitter( 0, "TheCoverManager" ) , m_timer( new QTimer( this ) ) //search filter timer , m_fetchCounter( 0 ) , m_fetchingCovers( 0 ) , m_coversFetched( 0 ) , m_coverErrors( 0 ) { DEBUG_BLOCK s_instance = this; // Sets caption and icon correctly (needed e.g. for GNOME) kapp->setTopWidget( this ); setCaption( kapp->makeStdCaption( i18n("Cover Manager") ) ); setWFlags( WDestructiveClose ); setMargin( 4 ); //artist listview m_artistView = new KListView( this ); m_artistView->addColumn(i18n( "Albums By" )); m_artistView->setFullWidth( true ); m_artistView->setSorting( -1 ); //no sort m_artistView->setMinimumWidth( 180 ); KListViewItem *item = new KListViewItem( m_artistView, i18n( "All Albums" ) ); item->setPixmap( 0, SmallIcon("cdrom_unmount") ); //load artists from the collection db const QStringList artists = CollectionDB::instance()->artistList( false, false ); foreach( artists ) { item = new KListViewItem( m_artistView, item, *it ); item->setPixmap( 0, SmallIcon("personal") ); } QueryBuilder qb; qb.addReturnValue( QueryBuilder::tabAlbum, QueryBuilder::valName ); qb.setOptions( QueryBuilder::optOnlyCompilations | QueryBuilder::optRemoveDuplicates ); qb.setLimit( 0, 1 ); if ( qb.run().count() ) { item = new KListViewItem( m_artistView, item, i18n( "Various Artists" ) ); item->setPixmap( 0, SmallIcon("personal") ); } QVBox *vbox = new QVBox( this ); QHBox *hbox = new QHBox( vbox ); vbox->setSpacing( 4 ); hbox->setSpacing( 4 ); { //<Search LineEdit> QHBox *searchBox = new QHBox( hbox ); KToolBar* searchToolBar = new Browser::ToolBar( searchBox ); KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar ); m_searchEdit = new ClickLineEdit( i18n( "Filter here..." ), searchToolBar ); m_searchEdit->setFrame( QFrame::Sunken ); searchToolBar->setStretchableWidget( m_searchEdit ); connect( button, SIGNAL(clicked()), m_searchEdit, SLOT(clear()) ); QToolTip::add( button, i18n( "Clear filter" ) ); QToolTip::add( m_searchEdit, i18n( "Enter space-separated terms to filter albums" ) ); hbox->setStretchFactor( searchBox, 1 ); } //</Search LineEdit> // view menu m_viewMenu = new KPopupMenu( this ); m_viewMenu->insertItem( i18n("All Albums"), AllAlbums ); m_viewMenu->insertItem( i18n("Albums With Cover"), AlbumsWithCover ); m_viewMenu->insertItem( i18n("Albums Without Cover"), AlbumsWithoutCover ); m_viewMenu->setItemChecked( AllAlbums, true ); connect( m_viewMenu, SIGNAL( activated(int) ), SLOT( changeView(int) ) ); #ifdef AMAZON_SUPPORT // amazon locale menu m_amazonLocaleMenu = new KPopupMenu( this ); m_amazonLocaleMenu->insertItem( i18n("International"), International ); m_amazonLocaleMenu->insertItem( i18n("Canada"), Canada ); m_amazonLocaleMenu->insertItem( i18n("France"), France ); m_amazonLocaleMenu->insertItem( i18n("Germany"), Germany ); m_amazonLocaleMenu->insertItem( i18n("Japan"), Japan); m_amazonLocaleMenu->insertItem( i18n("United Kingdom"), UK ); connect( m_amazonLocaleMenu, SIGNAL( activated(int) ), SLOT( changeLocale(int) ) ); #endif KToolBar* toolBar = new KToolBar( hbox ); toolBar->setIconText( KToolBar::IconTextRight ); toolBar->setFrameShape( QFrame::NoFrame ); toolBar->insertButton( "view_choose", 1, m_viewMenu, true, i18n( "View" ) ); #ifdef AMAZON_SUPPORT const QString babelfish = locate( "data", QString( "amarok/images/babelfish.png" ) ); toolBar->insertButton( babelfish, 2, m_amazonLocaleMenu, true, i18n( "Amazon Locale" ) ); QString locale = AmarokConfig::amazonLocale(); if( locale == "fr" ) m_currentLocale = France; else if( locale == "de" ) m_currentLocale = Germany; else if( locale == "jp" ) m_currentLocale = Japan; else if( locale == "uk" ) m_currentLocale = UK; else if( locale == "ca" ) m_currentLocale = Canada; else { // make sure we handle old config files correctly locale = "us"; m_currentLocale = International; } m_amazonLocaleMenu->setItemChecked( m_currentLocale, true ); //fetch missing covers button m_fetchButton = new KPushButton( KGuiItem( i18n("Fetch Missing Covers"), "cdrom_unmount" ), hbox ); connect( m_fetchButton, SIGNAL(clicked()), SLOT(fetchMissingCovers()) ); #endif //cover view m_coverView = new CoverView( vbox ); //status bar KStatusBar *m_statusBar = new KStatusBar( vbox ); m_statusBar->addWidget( m_statusLabel = new KSqueezedTextLabel( m_statusBar ), 4 ); m_statusLabel->setIndent( 3 ); m_statusBar->addWidget( m_progressBox = new QHBox( m_statusBar ), 1, true ); KPushButton *stopButton = new KPushButton( KGuiItem(i18n("Abort"), "stop"), m_progressBox ); connect( stopButton, SIGNAL(clicked()), SLOT(stopFetching()) ); m_progress = new KProgress( m_progressBox ); m_progress->setCenterIndicator( true ); const int h = m_statusLabel->height() + 3; m_statusLabel->setFixedHeight( h ); m_progressBox->setFixedHeight( h ); m_progressBox->hide(); // signals and slots connections connect( m_artistView, SIGNAL(selectionChanged( QListViewItem* ) ), SLOT(slotArtistSelected( QListViewItem* )) ); connect( m_coverView, SIGNAL(rightButtonPressed( QIconViewItem*, const QPoint& )), SLOT(showCoverMenu( QIconViewItem*, const QPoint& )) ); connect( m_coverView, SIGNAL(executed( QIconViewItem* )), SLOT(coverItemExecuted( QIconViewItem* )) ); connect( m_timer, SIGNAL(timeout()), SLOT(slotSetFilter()) ); connect( m_searchEdit, SIGNAL(textChanged( const QString& )), SLOT(slotSetFilterTimeout()) ); #ifdef AMAZON_SUPPORT connect( CollectionDB::instance(), SIGNAL(coverFetched( const QString&, const QString& )), SLOT(coverFetched( const QString&, const QString& )) ); connect( CollectionDB::instance(), SIGNAL(coverRemoved( const QString&, const QString& )), SLOT(coverRemoved( const QString&, const QString& )) ); connect( CollectionDB::instance(), SIGNAL(coverFetcherError( const QString& )), SLOT(coverFetcherError()) ); #endif m_currentView = AllAlbums; QSize size = QApplication::desktop()->screenGeometry( this ).size() / 1.5; resize( amaroK::config( "Cover Manager" )->readSizeEntry( "Window Size", &size ) ); show(); QTimer::singleShot( 0, this, SLOT(init()) ); }
BookmarksSettingsPage::BookmarksSettingsPage(QWidget*parent) : SettingsPageBase(parent), m_addButton(0), m_removeButton(0), m_moveUpButton(0), m_moveDownButton(0) { QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint()); const int spacing = KDialog::spacingHint(); QHBox* hBox = new QHBox(parent); hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); hBox->setSpacing(spacing); hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); m_listView = new KListView(hBox); m_listView->addColumn(i18n("Icon")); m_listView->addColumn(i18n("Name")); m_listView->addColumn(i18n("Location")); m_listView->setResizeMode(QListView::LastColumn); m_listView->setColumnAlignment(0, Qt::AlignHCenter); m_listView->setAllColumnsShowFocus(true); m_listView->setSorting(-1); connect(m_listView, SIGNAL(selectionChanged()), this, SLOT(updateButtons())); connect(m_listView, SIGNAL(pressed(QListViewItem*)), this, SLOT(slotBookmarkPressed(QListViewItem*))); connect(m_listView, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)), this, SLOT(slotBookmarkDoubleClicked(QListViewItem*, const QPoint&, int))); QVBox* buttonBox = new QVBox(hBox); buttonBox->setSpacing(spacing); const QSizePolicy buttonSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); m_addButton = new KPushButton(i18n("Add..."), buttonBox); connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAddButtonClicked())); m_addButton->setSizePolicy(buttonSizePolicy); m_editButton = new KPushButton(i18n("Edit..."), buttonBox); connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditButtonClicked())); m_editButton->setSizePolicy(buttonSizePolicy); m_removeButton = new KPushButton(i18n("Remove"), buttonBox); connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveButtonClicked())); m_removeButton->setSizePolicy(buttonSizePolicy); m_moveUpButton = new KPushButton(i18n("Move Up"), buttonBox); connect(m_moveUpButton, SIGNAL(clicked()), this, SLOT(slotMoveUpButtonClicked())); m_moveUpButton->setSizePolicy(buttonSizePolicy); m_moveDownButton = new KPushButton(i18n("Move Down"), buttonBox); connect(m_moveDownButton, SIGNAL(clicked()), this, SLOT(slotMoveDownButtonClicked())); m_moveDownButton->setSizePolicy(buttonSizePolicy); // Add a dummy widget with no restriction regarding a vertical resizing. // This assures that the spacing between the buttons is not increased. new QWidget(buttonBox); topLayout->addWidget(hBox); // insert all editable bookmarks. KBookmarkGroup root = DolphinSettings::instance().bookmarkManager()->root(); KBookmark bookmark = root.first(); QListViewItem* prev = 0; while (!bookmark.isNull()) { QListViewItem* item = new QListViewItem(m_listView); item->setPixmap(PixmapIdx, SmallIcon(bookmark.icon())); item->setText(NameIdx, bookmark.text()); item->setText(URLIdx, bookmark.url().prettyURL()); // add hidden column to be able to retrieve the icon name again item->setText(IconIdx, bookmark.icon()); m_listView->insertItem(item); if (prev != 0) { item->moveItem(prev); } prev = item; bookmark = root.next(bookmark); } m_listView->setSelected(m_listView->firstChild(), true); updateButtons(); }
EngineError KadmosDialog::setupGui() { EngineError err = KOCRBase::setupGui(); // setupPreprocessing( addVBoxPage( i18n("Preprocessing"))); // setupSegmentation( addVBoxPage( i18n("Segmentation"))); // setupClassification( addVBoxPage( i18n("Classification"))); /* continue page setup on the first page */ QVBox *page = ocrPage(); // Horizontal line (void) new KSeparator( KSeparator::HLine, page); // FIXME: dynamic classifier reading. (void) new QLabel( i18n("Please classify the font type and language of the text on the image:"), page ); QHBox *locBox = new QHBox( page ); m_bbFont = new QButtonGroup(1, Qt::Horizontal, i18n("Font Type Selection"), locBox); m_rbMachine = new QRadioButton( i18n("Machine print"), m_bbFont ); m_rbHand = new QRadioButton( i18n("Hand writing"), m_bbFont ); m_rbNorm = new QRadioButton( i18n("Norm font"), m_bbFont ); m_gbLang = new QGroupBox(1, Qt::Horizontal, i18n("Country"), locBox); m_cbLang = new QComboBox( m_gbLang ); m_cbLang->setCurrentText( KLocale::defaultCountry() ); connect( m_bbFont, SIGNAL(clicked(int)), this, SLOT(slFontChanged(int) )); m_rbMachine->setChecked(true); /* --- */ QHBox *innerBox = new QHBox( page ); innerBox->setSpacing( KDialog::spacingHint()); QButtonGroup *cbGroup = new QButtonGroup( 1, Qt::Horizontal, i18n("OCR Modifier"), innerBox ); Q_CHECK_PTR(cbGroup); m_cbNoise = new QCheckBox( i18n( "Enable automatic noise reduction" ), cbGroup ); m_cbAutoscale = new QCheckBox( i18n( "Enable automatic scaling"), cbGroup ); getAnimation(innerBox); // (void) new QWidget ( page ); if( err != ENG_OK ) { enableFields(false); enableButton(User1, false ); } if( m_ttfClassifier.count() == 0 ) { m_rbMachine->setEnabled(false); } if( m_handClassifier.count() == 0 ) { m_rbHand->setEnabled(false); } if( !m_haveNorm ) m_rbNorm->setEnabled(false); if( (m_ttfClassifier.count() + m_handClassifier.count()) == 0 && ! m_haveNorm ) { KMessageBox::error(0, i18n("The classifier files for KADMOS could not be found.\n" "OCR with KADMOS will not be possible!\n\n" "Change the OCR engine in the preferences dialog."), i18n("Installation Error") ); err = ENG_BAD_SETUP; } else slFontChanged( 0 ); // Load machine print font language list return err; }