comparison main/MainWindow.cpp @ 231:e8a7a935128e

* add splash screen
author Chris Cannam
date Wed, 23 Jan 2008 11:38:34 +0000
parents 1000222cd8f1
children 99e0dfd3ea75
comparison
equal deleted inserted replaced
230:1000222cd8f1 231:e8a7a935128e
919 } 919 }
920 920
921 for (unsigned int i = 0; 921 for (unsigned int i = 0;
922 i < sizeof(backgroundTypes)/sizeof(backgroundTypes[0]); ++i) { 922 i < sizeof(backgroundTypes)/sizeof(backgroundTypes[0]); ++i) {
923 923
924 for (int menuType = 0; menuType <= 1; ++menuType) { // pane, layer 924 const int paneMenuType = 0, layerMenuType = 1;
925 925
926 if (menuType == 0) menu = m_paneMenu; 926 for (int menuType = paneMenuType; menuType <= layerMenuType; ++menuType) {
927
928 if (menuType == paneMenuType) menu = m_paneMenu;
927 else menu = m_layerMenu; 929 else menu = m_layerMenu;
928 930
929 QMenu *submenu = 0; 931 QMenu *submenu = 0;
930 932
931 QIcon icon; 933 QIcon icon;
936 switch (type) { 938 switch (type) {
937 939
938 case LayerFactory::Waveform: 940 case LayerFactory::Waveform:
939 icon = il.load("waveform"); 941 icon = il.load("waveform");
940 mainText = tr("Add &Waveform"); 942 mainText = tr("Add &Waveform");
941 if (menuType == 0) { 943 if (menuType == paneMenuType) {
942 shortcutText = tr("W"); 944 shortcutText = tr("W");
943 tipText = tr("Add a new pane showing a waveform view"); 945 tipText = tr("Add a new pane showing a waveform view");
944 } else { 946 } else {
945 tipText = tr("Add a new layer showing a waveform view"); 947 tipText = tr("Add a new layer showing a waveform view");
946 } 948 }
948 break; 950 break;
949 951
950 case LayerFactory::Spectrogram: 952 case LayerFactory::Spectrogram:
951 icon = il.load("spectrogram"); 953 icon = il.load("spectrogram");
952 mainText = tr("Add Spectro&gram"); 954 mainText = tr("Add Spectro&gram");
953 if (menuType == 0) { 955 if (menuType == paneMenuType) {
954 shortcutText = tr("G"); 956 shortcutText = tr("G");
955 tipText = tr("Add a new pane showing a spectrogram"); 957 tipText = tr("Add a new pane showing a spectrogram");
956 } else { 958 } else {
957 tipText = tr("Add a new layer showing a spectrogram"); 959 tipText = tr("Add a new layer showing a spectrogram");
958 } 960 }
959 break; 961 break;
960 962
961 case LayerFactory::MelodicRangeSpectrogram: 963 case LayerFactory::MelodicRangeSpectrogram:
962 icon = il.load("spectrogram"); 964 icon = il.load("spectrogram");
963 mainText = tr("Add &Melodic Range Spectrogram"); 965 mainText = tr("Add &Melodic Range Spectrogram");
964 if (menuType == 0) { 966 if (menuType == paneMenuType) {
965 shortcutText = tr("M"); 967 shortcutText = tr("M");
966 tipText = tr("Add a new pane showing a spectrogram set up for an overview of note pitches"); 968 tipText = tr("Add a new pane showing a spectrogram set up for an overview of note pitches");
967 } else { 969 } else {
968 tipText = tr("Add a new layer showing a spectrogram set up for an overview of note pitches"); 970 tipText = tr("Add a new layer showing a spectrogram set up for an overview of note pitches");
969 } 971 }
970 break; 972 break;
971 973
972 case LayerFactory::PeakFrequencySpectrogram: 974 case LayerFactory::PeakFrequencySpectrogram:
973 icon = il.load("spectrogram"); 975 icon = il.load("spectrogram");
974 mainText = tr("Add Pea&k Frequency Spectrogram"); 976 mainText = tr("Add Pea&k Frequency Spectrogram");
975 if (menuType == 0) { 977 if (menuType == paneMenuType) {
976 shortcutText = tr("K"); 978 shortcutText = tr("K");
977 tipText = tr("Add a new pane showing a spectrogram set up for tracking frequencies"); 979 tipText = tr("Add a new pane showing a spectrogram set up for tracking frequencies");
978 } else { 980 } else {
979 tipText = tr("Add a new layer showing a spectrogram set up for tracking frequencies"); 981 tipText = tr("Add a new layer showing a spectrogram set up for tracking frequencies");
980 } 982 }
981 break; 983 break;
982 984
983 case LayerFactory::Spectrum: 985 case LayerFactory::Spectrum:
984 icon = il.load("spectrum"); 986 icon = il.load("spectrum");
985 mainText = tr("Add Spectr&um"); 987 mainText = tr("Add Spectr&um");
986 if (menuType == 0) { 988 if (menuType == paneMenuType) {
987 shortcutText = tr("U"); 989 shortcutText = tr("U");
988 tipText = tr("Add a new pane showing a frequency spectrum"); 990 tipText = tr("Add a new pane showing a frequency spectrum");
989 } else { 991 } else {
990 tipText = tr("Add a new layer showing a frequency spectrum"); 992 tipText = tr("Add a new layer showing a frequency spectrum");
991 } 993 }
993 995
994 default: break; 996 default: break;
995 } 997 }
996 998
997 std::vector<Model *> candidateModels; 999 std::vector<Model *> candidateModels;
998 if (menuType == 0) { 1000 // if (menuType == paneMenuType) {
999 candidateModels = models; 1001 candidateModels = models;
1000 } else { 1002 // } else {
1001 candidateModels.push_back(0); 1003 // candidateModels.push_back(0);
1002 } 1004 // }
1003 1005
1004 for (std::vector<Model *>::iterator mi = 1006 for (std::vector<Model *>::iterator mi =
1005 candidateModels.begin(); 1007 candidateModels.begin();
1006 mi != candidateModels.end(); ++mi) { 1008 mi != candidateModels.end(); ++mi) {
1007 1009
1022 1024
1023 if (c == 1 && channels == 1) continue; 1025 if (c == 1 && channels == 1) continue;
1024 bool isDefault = (c == 0); 1026 bool isDefault = (c == 0);
1025 bool isOnly = (isDefault && (channels == 1)); 1027 bool isOnly = (isDefault && (channels == 1));
1026 1028
1027 if (menuType == 1) { 1029 // if (menuType == layerMenuType) {
1028 if (isDefault) isOnly = true; 1030 // if (isDefault) isOnly = true;
1029 else continue; 1031 // else continue;
1030 } 1032 // }
1031 1033
1032 if (isOnly && (!plural || menuType == 1)) { 1034 if (isOnly && (!plural /*|| menuType == layerMenuType*/)) {
1033 1035
1034 if (menuType == 1 && type != LayerFactory::Waveform) { 1036 // if (menuType == layerMenuType && type != LayerFactory::Waveform) {
1035 action = new QAction(mainText, this); 1037 // action = new QAction(mainText, this);
1036 } else { 1038 // } else {
1037 action = new QAction(icon, mainText, this); 1039 action = new QAction(icon, mainText, this);
1038 } 1040 // }
1039 1041
1040 action->setShortcut(shortcutText); 1042 action->setShortcut(shortcutText);
1041 action->setStatusTip(tipText); 1043 action->setStatusTip(tipText);
1042 if (menuType == 0) { 1044 if (menuType == paneMenuType) {
1043 connect(action, SIGNAL(triggered()), 1045 connect(action, SIGNAL(triggered()),
1044 this, SLOT(addPane())); 1046 this, SLOT(addPane()));
1045 connect(this, SIGNAL(canAddPane(bool)), 1047 connect(this, SIGNAL(canAddPane(bool)),
1046 action, SLOT(setEnabled(bool))); 1048 action, SLOT(setEnabled(bool)));
1047 m_paneActions[action] = PaneConfiguration(type); 1049 m_paneActions[action] = PaneConfiguration(type);
1092 action = new QAction(actionText, this); 1094 action = new QAction(actionText, this);
1093 } 1095 }
1094 1096
1095 action->setStatusTip(tipText); 1097 action->setStatusTip(tipText);
1096 1098
1097 if (menuType == 0) { 1099 if (menuType == paneMenuType) {
1098 connect(action, SIGNAL(triggered()), 1100 connect(action, SIGNAL(triggered()),
1099 this, SLOT(addPane())); 1101 this, SLOT(addPane()));
1100 connect(this, SIGNAL(canAddPane(bool)), 1102 connect(this, SIGNAL(canAddPane(bool)),
1101 action, SLOT(setEnabled(bool))); 1103 action, SLOT(setEnabled(bool)));
1102 m_paneActions[action] = 1104 m_paneActions[action] =
3443 #endif 3445 #endif
3444 3446
3445 QString aboutText; 3447 QString aboutText;
3446 3448
3447 aboutText += tr("<h3>About Sonic Visualiser</h3>"); 3449 aboutText += tr("<h3>About Sonic Visualiser</h3>");
3448 aboutText += tr("<p>Sonic Visualiser is a program for viewing and exploring audio data for<br>semantic music analysis and annotation.</p>"); 3450 aboutText += tr("<p>Sonic Visualiser is a program for viewing and exploring audio data for semantic music analysis and annotation.</p>");
3449 aboutText += tr("<p>%1 : %2 configuration</p>") 3451 aboutText += tr("<p>%1 : %2 configuration</p>")
3450 .arg(version) 3452 .arg(version)
3451 .arg(debug ? tr("Debug") : tr("Release")); 3453 .arg(debug ? tr("Debug") : tr("Release"));
3452 3454
3453 #ifndef BUILD_STATIC 3455 #ifndef BUILD_STATIC
3525 #endif 3527 #endif
3526 aboutText += "</p>"; 3528 aboutText += "</p>";
3527 #endif 3529 #endif
3528 3530
3529 aboutText += 3531 aboutText +=
3530 "<p>Sonic Visualiser Copyright &copy; 2005 - 2007 Chris Cannam and<br>" 3532 "<p>Sonic Visualiser Copyright &copy; 2005 - 2008 Chris Cannam and "
3531 "Queen Mary, University of London.</p>" 3533 "Queen Mary, University of London.</p>"
3532 "<p>This program is free software; you can redistribute it and/or<br>" 3534 "<p>This program is free software; you can redistribute it and/or "
3533 "modify it under the terms of the GNU General Public License as<br>" 3535 "modify it under the terms of the GNU General Public License as "
3534 "published by the Free Software Foundation; either version 2 of the<br>" 3536 "published by the Free Software Foundation; either version 2 of the "
3535 "License, or (at your option) any later version.<br>See the file " 3537 "License, or (at your option) any later version.<br>See the file "
3536 "COPYING included with this distribution for more information.</p>"; 3538 "COPYING included with this distribution for more information.</p>";
3537 3539
3538 QMessageBox::about(this, tr("About Sonic Visualiser"), aboutText); 3540 QMessageBox::about(this, tr("About Sonic Visualiser"), aboutText);
3539 } 3541 }