X-Git-Url: http://git.maemo.org/git/?p=urpo;a=blobdiff_plain;f=www%2Fapidoc%2Fhtml%2Fprintwidget_8cpp_source.html;h=7f97e859faaeaecc682020c96dcded019adae1e8;hp=0ec4f6a33b857bec3b486aa0fcf0175e7305b9e0;hb=b84375f047734ac24c0bd38060d90f50255cdb98;hpb=30ce423868584b5d2d7aa066dd8408309a16e819 diff --git a/www/apidoc/html/printwidget_8cpp_source.html b/www/apidoc/html/printwidget_8cpp_source.html index 0ec4f6a..7f97e85 100644 --- a/www/apidoc/html/printwidget_8cpp_source.html +++ b/www/apidoc/html/printwidget_8cpp_source.html @@ -1,38 +1,19 @@ -
-00001 /************************************************************************** +src/printwidget.cpp
00001 /************************************************************************** 00002 00003 URPO 00004 @@ -86,161 +67,148 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); 00044 00045 printerCombo = new QComboBox(); 00046 printerCombo->setEnabled(false); -00047 -00048 rangeEdit = new QLineEdit(); -00049 // Page ranges in format 1-3,5,8-10 -00050 // Valid characters: 0123456789 , + -00051 QRegExpValidator* rangeSensor = new QRegExpValidator( QRegExp("[0-9\\-,]+"), this ); -00052 rangeEdit->setValidator( rangeSensor); -00053 -00054 // Copies: Spin 0..99 -00055 copiesSpin = new QSpinBox(); -00056 copiesSpin->setRange(1,99); -00057 copiesSpin->setValue(1); -00058 -00059 // Pages per sheet -00060 persheetCombo = new QComboBox(); -00061 persheetCombo->insertItem(0,"1",1); -00062 persheetCombo->insertItem(1,"2",2); -00063 persheetCombo->insertItem(2,"4",4); -00064 -00065 printButton = new QPushButton( tr("Print")); -00066 printButton->setEnabled(false); -00067 connect( printButton, SIGNAL(clicked()), this, SLOT(doPrint())); -00068 -00069 statusLabel = new QLabel(); -00070 progressBar = new QProgressBar(); -00071 progressBar->setRange(0,0); -00072 cancelButton = new QPushButton(tr("Cancel")); -00073 connect(cancelButton,SIGNAL(clicked()),this,SIGNAL(cancel())); -00074 -00075 reconnectButton = new QPushButton( tr("Reconnect")); -00076 connect(reconnectButton, SIGNAL(clicked()), this, SIGNAL(reconnect())); -00077 +00047 printerCombo->setEditable(true); +00048 +00049 rangeEdit = new QLineEdit(); +00050 // Page ranges in format 1-3,5,8-10 +00051 // Valid characters: 0123456789 , + +00052 QRegExpValidator* rangeSensor = new QRegExpValidator( QRegExp("[0-9\\-,]+"), this ); +00053 rangeEdit->setValidator( rangeSensor); +00054 +00055 // Copies: Spin 0..99 +00056 copiesSpin = new QSpinBox(); +00057 copiesSpin->setRange(1,99); +00058 copiesSpin->setValue(1); +00059 +00060 // Pages per sheet +00061 persheetCombo = new QComboBox(); +00062 persheetCombo->insertItem(0,"1",1); +00063 persheetCombo->insertItem(1,"2",2); +00064 persheetCombo->insertItem(2,"4",4); +00065 +00066 printButton = new QPushButton( tr("Print")); +00067 printButton->setEnabled(false); +00068 connect( printButton, SIGNAL(clicked()), this, SLOT(doPrint())); +00069 +00070 statusLabel = new QLabel(); +00071 progressBar = new QProgressBar(); +00072 progressBar->setRange(0,0); +00073 cancelButton = new QPushButton(tr("Cancel")); +00074 connect(cancelButton,SIGNAL(clicked()),this,SIGNAL(cancel())); +00075 +00076 reconnectButton = new QPushButton( tr("Reconnect")); +00077 connect(reconnectButton, SIGNAL(clicked()), this, SIGNAL(reconnect())); 00078 -00079 QVBoxLayout* mainLayout = new QVBoxLayout(); -00080 QHBoxLayout* fileLayout = new QHBoxLayout(); -00081 fileLayout->addWidget( new QLabel( tr ("File") )); -00082 fileLayout->addWidget(filenameEdit); -00083 fileLayout->addWidget(browseButton); -00084 mainLayout->addLayout(fileLayout); -00085 -00086 QHBoxLayout* printerLayout = new QHBoxLayout(); -00087 printerLayout->addWidget(new QLabel( tr("Printer"))); -00088 printerLayout->addWidget(printerCombo); -00089 printerLayout->addStretch(); -00090 mainLayout->addLayout(printerLayout); -00091 -00092 QHBoxLayout* rangeLayout = new QHBoxLayout(); -00093 rangeLayout->addWidget(new QLabel(tr("Page range"))); -00094 rangeLayout->addWidget(rangeEdit); -00095 mainLayout->addLayout(rangeLayout); -00096 -00097 QHBoxLayout* sheetLayout = new QHBoxLayout(); -00098 sheetLayout->addWidget( new QLabel(tr("Pages per sheet")) ); -00099 sheetLayout->addWidget(persheetCombo); -00100 sheetLayout->addStretch(); -00101 sheetLayout->addWidget(new QLabel(tr("Copies"))); -00102 sheetLayout->addWidget(copiesSpin); -00103 mainLayout->addLayout(sheetLayout); -00104 -00105 mainLayout->addStretch(); -00106 -00107 mainLayout->addWidget(statusLabel); -00108 QHBoxLayout* barLayout = new QHBoxLayout; -00109 barLayout->addWidget(progressBar); -00110 barLayout->addStretch(); -00111 barLayout->addWidget(cancelButton); -00112 barLayout->addWidget(reconnectButton); -00113 barLayout->addWidget(printButton); -00114 mainLayout->addLayout(barLayout); -00115 -00116 setLayout(mainLayout); -00117 -00118 progressBar->setVisible(false); -00119 -00120 } -00121 -00122 void PrintWidget::setStatus(QString message, bool busy) -00123 { -00124 statusLabel->setText(message); -00125 if(busy) -00126 { -00127 // Busy: show progress bar, enable Cancel, disable others. -00128 progressBar->setVisible(true); -00129 cancelButton->setEnabled(true); -00130 reconnectButton->setEnabled(false); -00131 } -00132 else -00133 { -00134 progressBar->setVisible(false); -00135 reconnectButton->setEnabled(true); -00136 cancelButton->setEnabled(false); -00137 } -00138 } -00139 -00140 void PrintWidget::setPrinters(QStringList printers) -00141 { -00142 printerCombo->clear(); -00143 if(printers.isEmpty()) -00144 { -00145 printerCombo->setEnabled(false); -00146 } -00147 else -00148 { -00149 printerCombo->addItems(printers); -00150 printerCombo->setEnabled(true); -00151 printerCombo->setCurrentIndex(0); -00152 } -00153 } -00154 -00155 void PrintWidget::setReady(bool ready) -00156 { -00157 if(ready) -00158 { -00159 setStatus( tr("Ready"), false); -00160 printButton->setEnabled(true); -00161 } -00162 else -00163 printButton->setEnabled(false); -00164 } -00165 +00079 +00080 QVBoxLayout* mainLayout = new QVBoxLayout(); +00081 QHBoxLayout* fileLayout = new QHBoxLayout(); +00082 fileLayout->addWidget( new QLabel( tr ("File") )); +00083 fileLayout->addWidget(filenameEdit); +00084 fileLayout->addWidget(browseButton); +00085 mainLayout->addLayout(fileLayout); +00086 +00087 QHBoxLayout* printerLayout = new QHBoxLayout(); +00088 printerLayout->addWidget(new QLabel( tr("Printer"))); +00089 printerLayout->addWidget(printerCombo); +00090 printerLayout->addStretch(); +00091 mainLayout->addLayout(printerLayout); +00092 +00093 QHBoxLayout* rangeLayout = new QHBoxLayout(); +00094 rangeLayout->addWidget(new QLabel(tr("Page range"))); +00095 rangeLayout->addWidget(rangeEdit); +00096 mainLayout->addLayout(rangeLayout); +00097 +00098 QHBoxLayout* sheetLayout = new QHBoxLayout(); +00099 sheetLayout->addWidget( new QLabel(tr("Pages per sheet")) ); +00100 sheetLayout->addWidget(persheetCombo); +00101 sheetLayout->addStretch(); +00102 sheetLayout->addWidget(new QLabel(tr("Copies"))); +00103 sheetLayout->addWidget(copiesSpin); +00104 mainLayout->addLayout(sheetLayout); +00105 +00106 mainLayout->addStretch(); +00107 +00108 mainLayout->addWidget(statusLabel); +00109 QHBoxLayout* barLayout = new QHBoxLayout; +00110 barLayout->addWidget(progressBar); +00111 barLayout->addStretch(); +00112 barLayout->addWidget(cancelButton); +00113 barLayout->addWidget(reconnectButton); +00114 barLayout->addWidget(printButton); +00115 mainLayout->addLayout(barLayout); +00116 +00117 setLayout(mainLayout); +00118 +00119 progressBar->setVisible(false); +00120 +00121 } +00122 +00123 void PrintWidget::setStatus(QString message, bool busy) +00124 { +00125 statusLabel->setText(message); +00126 if(busy) +00127 { +00128 // Busy: show progress bar, enable Cancel, disable others. +00129 progressBar->setVisible(true); +00130 cancelButton->setEnabled(true); +00131 reconnectButton->setEnabled(false); +00132 } +00133 else +00134 { +00135 progressBar->setVisible(false); +00136 reconnectButton->setEnabled(true); +00137 cancelButton->setEnabled(false); +00138 } +00139 } +00140 +00141 void PrintWidget::setPrinters(QStringList printers) +00142 { +00143 printerCombo->clear(); +00144 if(printers.isEmpty()) +00145 { +00146 printerCombo->setEnabled(false); +00147 } +00148 else +00149 { +00150 printerCombo->addItems(printers); +00151 printerCombo->setEnabled(true); +00152 printerCombo->setCurrentIndex(0); +00153 } +00154 } +00155 +00156 void PrintWidget::setReady(bool ready) +00157 { +00158 if(ready) +00159 { +00160 setStatus( tr("Ready"), false); +00161 printButton->setEnabled(true); +00162 } +00163 else +00164 printButton->setEnabled(false); +00165 } 00166 -00167 void PrintWidget::browseFile() -00168 { -00169 QString path = QFileDialog::getOpenFileName(this, tr("Print file")); -00170 if(!path.isNull()) -00171 filenameEdit->setText(path); -00172 -00173 } -00174 -00175 void PrintWidget::doPrint() -00176 { -00177 // Make cups lp options -00178 QString options = QString("-d %1 -o number-up=").arg(printerCombo->currentText()); -00179 options.append(persheetCombo->currentText()); -00180 if( !rangeEdit->text().isEmpty()) -00181 options += " -o page-ranges=" + rangeEdit->text(); -00182 if( copiesSpin->value() > 1) -00183 options += QString(" -n %1").arg(copiesSpin->value()); -00184 emit print(filenameEdit->text(), options); -00185 } +00167 +00168 void PrintWidget::browseFile() +00169 { +00170 QString path = QFileDialog::getOpenFileName(this, tr("Print file")); +00171 if(!path.isNull()) +00172 filenameEdit->setText(path); +00173 +00174 } +00175 +00176 void PrintWidget::doPrint() +00177 { +00178 // Make cups lp options +00179 QString options = QString("-d %1 -o number-up=").arg(printerCombo->currentText()); +00180 options.append(persheetCombo->currentText()); +00181 if( !rangeEdit->text().isEmpty()) +00182 options += " -o page-ranges=" + rangeEdit->text(); +00183 if( copiesSpin->value() > 1) +00184 options += QString(" -n %1").arg(copiesSpin->value()); +00185 emit print(filenameEdit->text(), options); +00186 }