| 428 | } |
| 429 | |
| 430 | void KDiff3App::createCaption() |
| 431 | { |
| 432 | // Try to create a meaningful but not too long caption |
| 433 | // 1. If the filenames are equal then show only one filename |
| 434 | QString caption; |
| 435 | QString f1 = m_sd1->getAliasName(); |
| 436 | QString f2 = m_sd2->getAliasName(); |
| 437 | QString f3 = m_sd3->getAliasName(); |
| 438 | qsizetype p; |
| 439 | |
| 440 | if((p = f1.lastIndexOf('/')) >= 0 || (p = f1.lastIndexOf('\\')) >= 0) |
| 441 | f1 = f1.mid(p + 1); |
| 442 | if((p = f2.lastIndexOf('/')) >= 0 || (p = f2.lastIndexOf('\\')) >= 0) |
| 443 | f2 = f2.mid(p + 1); |
| 444 | if((p = f3.lastIndexOf('/')) >= 0 || (p = f3.lastIndexOf('\\')) >= 0) |
| 445 | f3 = f3.mid(p + 1); |
| 446 | |
| 447 | if(!f1.isEmpty()) |
| 448 | { |
| 449 | if((f2.isEmpty() && f3.isEmpty()) || |
| 450 | (f2.isEmpty() && f1 == f3) || (f3.isEmpty() && f1 == f2) || (f1 == f2 && f1 == f3)) |
| 451 | caption = f1; |
| 452 | } |
| 453 | else if(!f2.isEmpty()) |
| 454 | { |
| 455 | if(f3.isEmpty() || f2 == f3) |
| 456 | caption = f2; |
| 457 | } |
| 458 | else if(!f3.isEmpty()) |
| 459 | caption = f3; |
| 460 | |
| 461 | // 2. If the files don't have the same name then show all names |
| 462 | if(caption.isEmpty() && (!f1.isEmpty() || !f2.isEmpty() || !f3.isEmpty())) |
| 463 | { |
| 464 | caption = (f1.isEmpty() ? QString("") : f1); |
| 465 | caption += QLatin1String(caption.isEmpty() || f2.isEmpty() ? "" : " <-> ") + (f2.isEmpty() ? QString("") : f2); |
| 466 | caption += QLatin1String(caption.isEmpty() || f3.isEmpty() ? "" : " <-> ") + (f3.isEmpty() ? QString("") : f3); |
| 467 | } |
| 468 | |
| 469 | m_pKDiff3Shell->setWindowTitle(caption.isEmpty() ? QString("KDiff3") : caption + QString(" - KDiff3")); |
| 470 | } |
| 471 | |
| 472 | void KDiff3App::setHScrollBarRange() |
| 473 | { |
nothing calls this directly
no test coverage detected