comparison main/MainWindow.cpp @ 124:8a39597edb51

* Grey out exporting entire pane as image if it will be too wide for QImage
author Chris Cannam
date Thu, 15 Mar 2007 11:34:39 +0000
parents a45733cc3939
children fcd231529628
comparison
equal deleted inserted replaced
123:a45733cc3939 124:8a39597edb51
2320 sf1 = e->getEndFrame(); 2320 sf1 = e->getEndFrame();
2321 selected = pane->getImageSize(sf0, sf1); 2321 selected = pane->getImageSize(sf0, sf1);
2322 } 2322 }
2323 2323
2324 QStringList items; 2324 QStringList items;
2325 items << tr("Export the entire pane (%1x%2 pixels") 2325 items << tr("Export the whole pane (%1x%2 pixels")
2326 .arg(total.width()).arg(total.height()); 2326 .arg(total.width()).arg(total.height());
2327 items << tr("Export the visible area only (%1x%2 pixels)") 2327 items << tr("Export the visible area only (%1x%2 pixels)")
2328 .arg(visible.width()).arg(visible.height()); 2328 .arg(visible.width()).arg(visible.height());
2329 if (haveSelection) { 2329 if (haveSelection) {
2330 items << tr("Export the selection extent (%1x%2 pixels)") 2330 items << tr("Export the selection extent (%1x%2 pixels)")
2331 .arg(selected.width()).arg(selected.height()); 2331 .arg(selected.width()).arg(selected.height());
2332 } else {
2333 items << tr("Export the selection extent");
2332 } 2334 }
2333 2335
2334 QSettings settings; 2336 QSettings settings;
2335 settings.beginGroup("MainWindow"); 2337 settings.beginGroup("MainWindow");
2336 int deflt = settings.value("lastimageexportregion", 0).toInt(); 2338 int deflt = settings.value("lastimageexportregion", 0).toInt();
2337 if (deflt == 2 && !haveSelection) deflt = 1; 2339 if (deflt == 2 && !haveSelection) deflt = 1;
2338 2340 if (deflt == 0 && total.width() > 32767) deflt = 1;
2339 bool ok = false; 2341
2340 QString item = ListInputDialog::getItem 2342 ListInputDialog *lid = new ListInputDialog
2341 (this, tr("Select region to export"), 2343 (this, tr("Select region to export"),
2342 tr("Which region of the current pane do you want to export as an image?"), 2344 tr("Which region of the current pane do you want to export as an image?"),
2343 items, deflt, &ok); 2345 items, deflt);
2346
2347 if (!haveSelection) {
2348 lid->setItemAvailability(2, false);
2349 }
2350 if (total.width() > 32767) { // appears to be the limit of a QImage
2351 lid->setItemAvailability(0, false);
2352 lid->setFootnote(tr("Note: the whole pane is too wide to be exported as a single image."));
2353 }
2354
2355 bool ok = lid->exec();
2356 QString item = lid->getCurrentString();
2357 delete lid;
2344 2358
2345 if (!ok || item.isEmpty()) return; 2359 if (!ok || item.isEmpty()) return;
2346 2360
2347 settings.setValue("lastimageexportregion", deflt); 2361 settings.setValue("lastimageexportregion", deflt);
2348 2362