Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 49296
Collapse All | Expand All

(-)c6.cpp (-1 / +1 lines)
Lines 26-32 Link Here
26
  C6Config.defaultSoundPath = commonPath + DEFAULTSOUNDPATH;
26
  C6Config.defaultSoundPath = commonPath + DEFAULTSOUNDPATH;
27
  C6Config.commonPath = commonPath;
27
  C6Config.commonPath = commonPath;
28
28
29
  if(signal(SIGCHLD,(void*)&sig_chld) == SIG_ERR)
29
  if(signal(SIGCHLD,sig_chld) == SIG_ERR)
30
    qDebug("Signal Error");
30
    qDebug("Signal Error");
31
31
32
  #ifdef USE_KDE
32
  #ifdef USE_KDE
(-)c6.h (-1 / +1 lines)
Lines 181-187 Link Here
181
  void flashTrayIcon(bool state);
181
  void flashTrayIcon(bool state);
182
  /** No descriptions */
182
  /** No descriptions */
183
  QString getCurrentTimeStr();
183
  QString getCurrentTimeStr();
184
  void sig_chld(int signum);
184
  static void sig_chld(int signum);
185
  /** No descriptions */
185
  /** No descriptions */
186
  void trayIconFlashStop();
186
  void trayIconFlashStop();
187
  /** No descriptions */
187
  /** No descriptions */
(-)c6proto.cpp (-6 / +8 lines)
Lines 975-980 Link Here
975
  OutCount = 1;
975
  OutCount = 1;
976
  setSocket(socket);
976
  setSocket(socket);
977
  C6Config = config;
977
  C6Config = config;
978
  chunck_no = 1;
979
  avg_len = 0;
978
  connect(this,SIGNAL(readyRead()),SLOT(socket_ReadyRead()));
980
  connect(this,SIGNAL(readyRead()),SLOT(socket_ReadyRead()));
979
  connect(this,SIGNAL(connectionClosed()),SLOT(socket_Closed()));
981
  connect(this,SIGNAL(connectionClosed()),SLOT(socket_Closed()));
980
  connect(this,SIGNAL(error(int)),SLOT(socket_Error(int)));
982
  connect(this,SIGNAL(error(int)),SLOT(socket_Error(int)));
Lines 1267-1278 Link Here
1267
 */
1269
 */
1268
void C6XferProto::getNextChunk(BYTE *data)
1270
void C6XferProto::getNextChunk(BYTE *data)
1269
{
1271
{
1270
  int len,chunk_no;
1272
  int len;
1271
  static int avg_len = 0;
1272
1273
1273
  QFile *fs = new QFile(C6Config->fileReceivePath+file);
1274
  QFile *fs = new QFile(C6Config->fileReceivePath+file);
1274
1275
1275
  WORD_READ(data,chunk_no); data+=4;
1276
  data+=4;
1276
  WORD_READ(data,len); data+=2;
1277
  WORD_READ(data,len); data+=2;
1277
1278
1278
  if (avg_len)
1279
  if (avg_len)
Lines 1287-1293 Link Here
1287
      fs->close();
1288
      fs->close();
1288
1289
1289
      if (fsize)
1290
      if (fsize)
1290
        emit receiveProgress((int)((chunk_no-1)*avg_len*100/fsize));
1291
        emit receiveProgress((int)(chunck_no*avg_len*100/fsize));
1292
1293
      chunck_no++;
1291
    }
1294
    }
1292
1295
1293
  delete fs;
1296
  delete fs;
Lines 1321-1327 Link Here
1321
 */
1324
 */
1322
void C6XferProto::endOfReceive()
1325
void C6XferProto::endOfReceive()
1323
{
1326
{
1324
  emit receiveProgress(101);
1327
  emit receiveProgress(255);
1325
}
1328
}
1326
1329
1327
1330
Lines 1366-1372 Link Here
1366
 */
1369
 */
1367
void C6XferServer::xferAborted()
1370
void C6XferServer::xferAborted()
1368
{
1371
{
1369
1370
  emit receiveAborted();
1372
  emit receiveAborted();
1371
}
1373
}
1372
1374
(-)c6proto.h (+1 lines)
Lines 44-49 Link Here
44
  QString file,nick;
44
  QString file,nick;
45
  int OutCount;
45
  int OutCount;
46
  int chunck_no;
46
  int chunck_no;
47
  int avg_len;
47
  long int fsize;
48
  long int fsize;
48
  QCString DataIn,inComing;
49
  QCString DataIn,inComing;
49
  public:
50
  public:
(-)chat.ui (-35 / +38 lines)
Lines 1512-1536 Link Here
1512
            <string>Aggiungi utente</string>
1512
            <string>Aggiungi utente</string>
1513
        </property>
1513
        </property>
1514
    </widget>
1514
    </widget>
1515
    <widget class="QProgressBar">
1516
        <property name="name">
1517
            <cstring>transmitBar</cstring>
1518
        </property>
1519
        <property name="enabled">
1520
            <bool>true</bool>
1521
        </property>
1522
        <property name="geometry">
1523
            <rect>
1524
                <x>35</x>
1525
                <y>358</y>
1526
                <width>145</width>
1527
                <height>16</height>
1528
            </rect>
1529
        </property>
1530
        <property name="backgroundOrigin">
1531
            <enum>AncestorOrigin</enum>
1532
        </property>
1533
    </widget>
1534
    <widget class="QLabel">
1515
    <widget class="QLabel">
1535
        <property name="name">
1516
        <property name="name">
1536
            <cstring>textLabel1_2</cstring>
1517
            <cstring>textLabel1_2</cstring>
Lines 1697-1718 Link Here
1697
            <string>Interrompe la ricezione di un file</string>
1678
            <string>Interrompe la ricezione di un file</string>
1698
        </property>
1679
        </property>
1699
    </widget>
1680
    </widget>
1700
    <widget class="QProgressBar">
1701
        <property name="name">
1702
            <cstring>receiveBar</cstring>
1703
        </property>
1704
        <property name="enabled">
1705
            <bool>true</bool>
1706
        </property>
1707
        <property name="geometry">
1708
            <rect>
1709
                <x>274</x>
1710
                <y>358</y>
1711
                <width>145</width>
1712
                <height>16</height>
1713
            </rect>
1714
        </property>
1715
    </widget>
1716
    <widget class="QCheckBox">
1681
    <widget class="QCheckBox">
1717
        <property name="name">
1682
        <property name="name">
1718
            <cstring>receiveSwitch</cstring>
1683
            <cstring>receiveSwitch</cstring>
Lines 1897-1902 Link Here
1897
            <enum>Anywhere</enum>
1862
            <enum>Anywhere</enum>
1898
        </property>
1863
        </property>
1899
    </widget>
1864
    </widget>
1865
    <widget class="QProgressBar">
1866
        <property name="name">
1867
            <cstring>transmitBar</cstring>
1868
        </property>
1869
        <property name="enabled">
1870
            <bool>true</bool>
1871
        </property>
1872
        <property name="geometry">
1873
            <rect>
1874
                <x>35</x>
1875
                <y>358</y>
1876
                <width>145</width>
1877
                <height>16</height>
1878
            </rect>
1879
        </property>
1880
        <property name="backgroundOrigin">
1881
            <enum>AncestorOrigin</enum>
1882
        </property>
1883
    </widget>
1884
    <widget class="QProgressBar">
1885
        <property name="name">
1886
            <cstring>receiveBar</cstring>
1887
        </property>
1888
        <property name="enabled">
1889
            <bool>true</bool>
1890
        </property>
1891
        <property name="geometry">
1892
            <rect>
1893
                <x>274</x>
1894
                <y>358</y>
1895
                <width>145</width>
1896
                <height>16</height>
1897
            </rect>
1898
        </property>
1899
        <property name="backgroundOrigin">
1900
            <enum>AncestorOrigin</enum>
1901
        </property>
1902
    </widget>
1900
</widget>
1903
</widget>
1901
<images>
1904
<images>
1902
    <image name="image0">
1905
    <image name="image0">
(-)chatview.cpp (-17 / +26 lines)
Lines 253-259 Link Here
253
  if (s != "")
253
  if (s != "")
254
    {
254
    {
255
      transmitBar->setProgress(0);
255
      transmitBar->setProgress(0);
256
      localProgress = 0;
256
      transmitLocalProgress = 0;
257
      emit sendFile(s,otherNick);
257
      emit sendFile(s,otherNick);
258
    }
258
    }
259
}
259
}
Lines 293-299 Link Here
293
  connect(xferSocket,SIGNAL(connectionClosed()),this,SLOT(xferSocket_connectionClosed()));
293
  connect(xferSocket,SIGNAL(connectionClosed()),this,SLOT(xferSocket_connectionClosed()));
294
  connect(xferSocket,SIGNAL(xferAborted()),this,SLOT(xferAborted()));
294
  connect(xferSocket,SIGNAL(xferAborted()),this,SLOT(xferAborted()));
295
  connect(xferSocket,SIGNAL(xferProgress(int)),this,SLOT(xferProgress(int)));
295
  connect(xferSocket,SIGNAL(xferProgress(int)),this,SLOT(xferProgress(int)));
296
  localProgress = 0;
296
  transmitLocalProgress = 0;
297
  transmitFileName = filename;
297
  transmitFileName = filename;
298
  xferSocket->fire();
298
  xferSocket->fire();
299
}
299
}
Lines 309-315 Link Here
309
void ChatView::xferSocket_connectionClosed()
309
void ChatView::xferSocket_connectionClosed()
310
{
310
{
311
  QString a = getOtherNick();
311
  QString a = getOtherNick();
312
  if (localProgress < 100)
312
  if (transmitLocalProgress < 100)
313
    {
313
    {
314
      xferSocket->close();
314
      xferSocket->close();
315
      emit transferError(a,transmitFileName,XFERABORT);
315
      emit transferError(a,transmitFileName,XFERABORT);
Lines 326-339 Link Here
326
/** No descriptions */
326
/** No descriptions */
327
void ChatView::xferProgress(int progress)
327
void ChatView::xferProgress(int progress)
328
{
328
{
329
  localProgress = progress;
329
  transmitLocalProgress = progress;
330
330
331
  if (progress == 255)
331
  if (progress == 255)
332
    progress = 100;
332
    progress = 100;
333
333
334
  transmitBar->setProgress(progress);
334
  transmitBar->setProgress(progress);
335
335
336
  if (localProgress == 255)
336
  if (transmitLocalProgress == 255)
337
    UpdateText(END_OF_TRANSFER_MSG(transmitFileName),C6Config->ForeMessageColor);
337
    UpdateText(END_OF_TRANSFER_MSG(transmitFileName),C6Config->ForeMessageColor);
338
}
338
}
339
339
Lines 348-353 Link Here
348
      xferSocket->disconnect();
348
      xferSocket->disconnect();
349
      xferSocket->close();
349
      xferSocket->close();
350
      delete xferSocket;
350
      delete xferSocket;
351
      xferSocket = NULL;
351
    }
352
    }
352
}
353
}
353
354
Lines 357-363 Link Here
357
 */
358
 */
358
void ChatView::stopTransmitButton_clicked()
359
void ChatView::stopTransmitButton_clicked()
359
{
360
{
360
  if ((xferSocket != NULL) && (xferSocket->state() == QSocket::Connected))
361
  if ((xferSocket != NULL) && (xferSocket->state() == QSocket::Connected) && (transmitLocalProgress != 255))
361
    {
362
    {
362
      xferSocket->close();
363
      xferSocket->close();
363
      UpdateText(ABORT_TRANSFER_MSG(transmitFileName),C6Config->ForeMessageColor);
364
      UpdateText(ABORT_TRANSFER_MSG(transmitFileName),C6Config->ForeMessageColor);
Lines 379-388 Link Here
379
 */
380
 */
380
void ChatView::activateFileServer()
381
void ChatView::activateFileServer()
381
{
382
{
382
   xferServer = new C6XferServer(C6Config,serverPort,this);
383
  if (!xferServer)
383
   connect(xferServer,SIGNAL(receiveProgress(int)),this,SLOT(receiveProgress(int)));
384
    {
384
   connect(xferServer,SIGNAL(signalFileSpec(QString&,long int)),this,SLOT(receiveFileSpec(QString&, long int )));
385
      xferServer = new C6XferServer(C6Config,serverPort,this);
385
   connect(xferServer,SIGNAL(receiveAborted()),this,SLOT(receiveAborted()));
386
      connect(xferServer,SIGNAL(receiveProgress(int)),this,SLOT(receiveProgress(int)));
387
      connect(xferServer,SIGNAL(signalFileSpec(QString&,long int)),this,SLOT(receiveFileSpec(QString&, long int )));
388
      connect(xferServer,SIGNAL(receiveAborted()),this,SLOT(receiveAborted()));
389
    }
386
}
390
}
387
391
388
392
Lines 391-406 Link Here
391
 */
395
 */
392
void ChatView::receiveProgress(int progress)
396
void ChatView::receiveProgress(int progress)
393
{
397
{
394
  int localProgress;
398
  receiveLocalProgress = progress;
395
399
396
  localProgress = progress;
400
  if (progress == 255)
397
401
    progress = 100;
398
  if (progress == 101)
399
    progress--;
400
402
401
  receiveBar->setProgress(progress);
403
  receiveBar->setProgress(progress);
402
404
403
  if (localProgress == 101)
405
  if (receiveLocalProgress == 255)
404
    UpdateText(END_OF_RECEIVE_MSG(receiveFileName,receiveFileSize),C6Config->ForeMessageColor);
406
    UpdateText(END_OF_RECEIVE_MSG(receiveFileName,receiveFileSize),C6Config->ForeMessageColor);
405
}
407
}
406
408
Lines 452-456 Link Here
452
 */
454
 */
453
void ChatView::stopReceiveButton_clicked()
455
void ChatView::stopReceiveButton_clicked()
454
{
456
{
455
  xferServer->stopReceive();
457
  if (xferServer && receiveLocalProgress != 255 && receiveLocalProgress)
458
    {
459
      QString a = getOtherNick();
460
461
      xferServer->stopReceive();
462
      UpdateText(RECEIVE_ABORT_TRANSFER_MSG(receiveFileName,a),C6Config->ForeMessageColor);
463
      receiveLocalProgress = 0;
464
    }
456
}
465
}
(-)chatview.h (-1 / +1 lines)
Lines 98-104 Link Here
98
  QString defaultIconPath,defaultButtonPath;
98
  QString defaultIconPath,defaultButtonPath;
99
  QString otherNick,myNick,transmitFileName,receiveFileName;
99
  QString otherNick,myNick,transmitFileName,receiveFileName;
100
  C6XferProto *xferSocket;
100
  C6XferProto *xferSocket;
101
  int localProgress,serverPort;
101
  int transmitLocalProgress,serverPort,receiveLocalProgress;
102
  long int receiveFileSize;
102
  long int receiveFileSize;
103
  bool xferOnSwitch;
103
  bool xferOnSwitch;
104
  C6XferServer *xferServer;
104
  C6XferServer *xferServer;
(-)macroetc.h (+1 lines)
Lines 158-163 Link Here
158
#define SEARCHWAITSTR QString("Ricerca in corso.......")
158
#define SEARCHWAITSTR QString("Ricerca in corso.......")
159
#define END_OF_TRANSFER_MSG(filename) QString("Invio del file ")+filename+" completato con successo!"
159
#define END_OF_TRANSFER_MSG(filename) QString("Invio del file ")+filename+" completato con successo!"
160
#define ABORT_TRANSFER_MSG(filename) QString("Invio del file ")+filename+" interrotto!"
160
#define ABORT_TRANSFER_MSG(filename) QString("Invio del file ")+filename+" interrotto!"
161
#define RECEIVE_ABORT_TRANSFER_MSG(filename,nick) QString("Ricezione del file ")+filename+" da "+nick+" interrotta!"
161
#define END_OF_RECEIVE_MSG(filename,filesize) QString("Ricezione del file ")+filename+" ("+QString::number(filesize)+" bytes) "+"completato con successo!"
162
#define END_OF_RECEIVE_MSG(filename,filesize) QString("Ricezione del file ")+filename+" ("+QString::number(filesize)+" bytes) "+"completato con successo!"
162
#define NO_USER_FOUND_MSG QString("Nessun utente trovato")
163
#define NO_USER_FOUND_MSG QString("Nessun utente trovato")
163
#define ENTER_CHAT_MSG(nick) QString("Il netfriend ")+nick+QString::fromUtf8(" è appena entrato in chat")
164
#define ENTER_CHAT_MSG(nick) QString("Il netfriend ")+nick+QString::fromUtf8(" è appena entrato in chat")

Return to bug 49296