| 145 | | |
| 146 | | CFileDlg::CFileDlg(unsigned long _nUin, CICQDaemon *daemon, QWidget* parent) |
| 147 | | : QWidget(parent, "FileDialog", WDestructiveClose) |
| 148 | | { |
| 149 | | // If we are the server, then we are receiving a file |
| 150 | | m_nUin = _nUin; |
| 151 | | licqDaemon = daemon; |
| 152 | | |
| 153 | | setCaption(tr("Licq - File Transfer (%1)").arg(m_nUin)); |
| 154 | | |
| 155 | | unsigned short CR = 0; |
| 156 | | QGridLayout* lay = new QGridLayout(this, 8, 3, 8, 8); |
| 157 | | lay->setColStretch(1, 2); |
| 158 | | |
| 159 | | lblTransferFileName = new QLabel(tr("Current:"), this); |
| 160 | | lay->addWidget(lblTransferFileName, CR, 0); |
| 161 | | nfoTransferFileName = new CInfoField(this, true); |
| 162 | | nfoTransferFileName->setMinimumWidth(nfoTransferFileName->sizeHint().width()*2); |
| 163 | | lay->addWidget(nfoTransferFileName, CR, 1); |
| 164 | | nfoTotalFiles = new CInfoField(this, true); |
| 165 | | nfoTotalFiles->setMinimumWidth((nfoTotalFiles->sizeHint().width()*3)/2); |
| 166 | | lay->addWidget(nfoTotalFiles, CR, 2); |
| 167 | | |
| 168 | | lblLocalFileName = new QLabel(tr("File name:"), this); |
| 169 | | lay->addWidget(lblLocalFileName, ++CR, 0); |
| 170 | | nfoLocalFileName = new CInfoField(this, true); |
| 171 | | lay->addMultiCellWidget(nfoLocalFileName, CR, CR, 1, 2); |
| 172 | | |
| 173 | | lay->addRowSpacing(++CR, 10); |
| 174 | | |
| 175 | | // Information stuff about the current file |
| 176 | | lblTrans = new QLabel(tr("File:"), this); |
| 177 | | lay->addWidget(lblTrans, ++CR, 0); |
| 178 | | barTransfer = new QProgressBar(this); |
| 179 | | lay->addWidget(barTransfer, CR, 1); |
| 180 | | nfoFileSize = new CInfoField(this, true); |
| 181 | | lay->addWidget(nfoFileSize, CR, 2); |
| 182 | | |
| 183 | | // Information about the batch file transfer |
| 184 | | lblBatch = new QLabel(tr("Batch:"), this); |
| 185 | | lay->addWidget(lblBatch, ++CR, 0); |
| 186 | | barBatchTransfer = new QProgressBar(this); |
| 187 | | lay->addWidget(barBatchTransfer, CR, 1); |
| 188 | | nfoBatchSize = new CInfoField(this, true); |
| 189 | | lay->addWidget(nfoBatchSize, CR, 2); |
| 190 | | |
| 191 | | lblTime = new QLabel(tr("Time:"), this); |
| 192 | | lay->addWidget(lblTime, ++CR, 0); |
| 193 | | |
| 194 | | QHBox* hbox = new QHBox(this); |
| 195 | | hbox->setSpacing(8); |
| 196 | | lay->addMultiCellWidget(hbox, CR, CR, 0, 1); |
| 197 | | nfoTime = new CInfoField(hbox, true); |
| 198 | | nfoBPS = new CInfoField(hbox, true); |
| 199 | | lblETA = new QLabel(tr("ETA:"), hbox); |
| 200 | | nfoETA = new CInfoField(this, true); |
| 201 | | lay->addWidget(nfoETA, CR++, 2); |
| 202 | | lay->addRowSpacing(++CR, 10); |
| 203 | | |
| 204 | | mleStatus = new MLEditWrap(true, this); |
| 205 | | ++CR; |
| 206 | | lay->addMultiCellWidget(mleStatus, CR, CR, 0, 2); |
| 207 | | mleStatus->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); |
| 208 | | |
| 209 | | lay->setRowStretch(++CR, 3); |
| 210 | | |
| 211 | | hbox = new QHBox(this); |
| 212 | | hbox->setSpacing(8); |
| 213 | | lay->addMultiCellWidget(hbox, CR, CR, 0, 2); |
| 214 | | |
| 215 | | btnCancel = new QPushButton(tr("&Cancel Transfer"), hbox); |
| 216 | | btnCancel->setMinimumWidth(75); |
| 217 | | connect(btnCancel, SIGNAL(clicked()), this, SLOT(close())); |
| 218 | | |
| 219 | | ftman = new CFileTransferManager(licqDaemon, m_nUin); |
| 220 | | ftman->SetUpdatesEnabled(2); |
| 221 | | sn = new QSocketNotifier(ftman->Pipe(), QSocketNotifier::Read); |
| 222 | | connect(sn, SIGNAL(activated(int)), SLOT(slot_ft())); |
| 223 | | |
| 224 | | #ifdef USE_KDE |
| 225 | | btnOpen = new QPushButton(tr("&Open"), hbox); |
| 226 | | btnOpenDir = new QPushButton(tr("O&pen Dir"), hbox); |
| 227 | | btnOpen->hide(); |
| 228 | | btnOpenDir->hide(); |
| 229 | | connect(btnOpen, SIGNAL(clicked()), SLOT(slot_open())); |
| 230 | | connect(btnOpenDir, SIGNAL(clicked()), SLOT(slot_opendir())); |
| 231 | | #else |
| 232 | | btnOpen = 0; |
| 233 | | btnOpenDir = 0; |
| 234 | | #endif |
| 235 | | } |
| 236 | | |