History

Modified code according to review for UI job

atlante45 committed 13 years ago

Commit d38c1f01 parent b0622959 files · +132 −146Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+26−25
@@ -200,7 +200,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 199 unmodified lines
200200 _packetCount(0),
201201 _packetsPerSecond(0),
202202 _bytesPerSecond(0),
203− _bytesCount(0)
203+ _bytesCount(0),
204+ _swatch(NULL)
204205 {
205206 _applicationStartupTime = startup_time;
206207 _window->setWindowTitle("Interface");
@@ -276,11 +277,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 69 unmodified lines
276277 FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
277278 FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
278279 #endif
279−
280+
280281 initMenu();
281282
282− _swatch = new Swatch(_voxelPaintColor);
283−
284283 QRect available = desktop()->availableGeometry();
285284 _window->resize(available.size());
286285 _window->setVisible(true);
@@ -727,7 +726,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 440 unmodified lines
727726 case Qt::Key_6:
728727 case Qt::Key_7:
729728 case Qt::Key_8:
730− _swatch->handleEvent(event->key(), _eyedropperMode->isChecked());
729+ _swatch.handleEvent(event->key(), _eyedropperMode->isChecked());
731730 break;
732731 default:
733732 event->ignore();
@@ -1241,7 +1240,7 @@ void Application::increaseVoxelSize() { · 507 unmodified lines
12411240 }
12421241
12431242 void Application::resetSwatchColors() {
1244− _swatch->reset();
1243+ _swatch.reset();
12451244 }
12461245
12471246 static QIcon createSwatchIcon(const QColor& color) {
@@ -1547,6 +1546,8 @@ void Application::initMenu() { · 299 unmodified lines
15471546
15481547 _voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this,
15491548 SLOT(chooseVoxelPaintColor()), Qt::META | Qt::Key_C);
1549+ _swatch.setAction(_voxelPaintColor);
1550+
15501551 QColor paintColor(128, 128, 128);
15511552 _voxelPaintColor->setData(paintColor);
15521553 _voxelPaintColor->setIcon(createSwatchIcon(paintColor));
@@ -1679,7 +1680,7 @@ void Application::init() { · 126 unmodified lines
16791680 _palette.init(_glWidget->width(), _glWidget->height());
16801681 _palette.addAction(_addVoxelMode, 0, 0);
16811682 _palette.addAction(_deleteVoxelMode, 0, 1);
1682− _palette.addTool(_swatch);
1683+ _palette.addTool(&_swatch);
16831684 _palette.addAction(_colorVoxelMode, 0, 2);
16841685 _palette.addAction(_eyedropperMode, 0, 3);
16851686 _palette.addAction(_selectVoxelMode, 0, 4);
@@ -2434,28 +2435,28 @@ void Application::displayOverlay() { · 748 unmodified lines
24342435
24352436 _palette.render(_glWidget->width(), _glWidget->height());
24362437
2437− if (_eyedropperMode->isChecked() && _voxelPaintColor->data().value<QColor>() != _swatch->getColor()) {
2438− QColor color(_voxelPaintColor->data().value<QColor>());
2438+ if (_eyedropperMode->isChecked() && _voxelPaintColor->data().value<QColor>() != _swatch.getColor()) {
2439+ QColor color = _voxelPaintColor->data().value<QColor>();
24392440 TextRenderer textRenderer(SANS_FONT_FAMILY, 11, 50);
2440− const char* line1("Assign this color to a swatch");
2441− const char* line2("by choosing a key from 1 to 8.");
2442− double step(0.05f);
2443− int left((_glWidget->width() - 300)/2);
2444− int top(_glWidget->height()/40.0f);
2445− double margin(10.0f);
2441+ const char line1[] = "Assign this color to a swatch";
2442+ const char line2[] = "by choosing a key from 1 to 8.";
2443+ double step = 0.05f;
2444+ int left = (_glWidget->width() - 300) / 2;
2445+ int top = _glWidget->height() / 40.0f;
2446+ double margin = 10.0f;
24462447
24472448 glBegin(GL_POLYGON);
24482449 glColor3f(0.0f, 0.0f, 0.0f);
2449− for (double a(M_PI); a < 1.5f*M_PI; a += step) {
2450− glVertex2f(left + margin*cos(a), top + margin*sin(a));
2450+ for (double a = M_PI; a < 1.5f * M_PI; a += step) {
2451+ glVertex2f(left + margin * cos(a), top + margin * sin(a));
24512452 }
2452− for (double a(1.5f*M_PI); a < 2.0f*M_PI; a += step) {
2453− glVertex2f(left + 280 + margin*cos(a), top + margin*sin(a));
2453+ for (double a = 1.5f * M_PI; a < 2.0f*M_PI; a += step) {
2454+ glVertex2f(left + 280 + margin * cos(a), top + margin * sin(a));
24542455 }
2455− for (double a(0.0f); a < 0.5f*M_PI; a += step) {
2456− glVertex2f(left + 280 + margin*cos(a), top + 30 + margin*sin(a));
2456+ for (double a = 0.0f; a < 0.5f * M_PI; a += step) {
2457+ glVertex2f(left + 280 + margin * cos(a), top + 30 + margin * sin(a));
24572458 }
2458− for (double a(0.5f*M_PI); a < 1.0f*M_PI; a += step) {
2459+ for (double a = 0.5f*M_PI; a < 1.0f*M_PI; a += step) {
24592460 glVertex2f(left + margin*cos(a), top + 30 + margin*sin(a));
24602461 }
24612462 glEnd();
@@ -2475,7 +2476,7 @@ void Application::displayOverlay() { · 13 unmodified lines
24752476 textRenderer.draw(left + 74, top + 28, line2);
24762477 }
24772478 else {
2478− _swatch->checkColor();
2479+ _swatch.checkColor();
24792480 }
24802481
24812482 glPopMatrix();
@@ -3027,7 +3028,7 @@ void Application::loadSettings(QSettings* settings) { · 545 unmodified lines
30273028
30283029 scanMenuBar(&Application::loadAction, settings);
30293030 getAvatar()->loadData(settings);
3030− _swatch->loadData(settings);
3031+ _swatch.loadData(settings);
30313032 }
30323033
30333034
@@ -3049,7 +3050,7 @@ void Application::saveSettings(QSettings* settings) { · 15 unmodified lines
30493050
30503051 scanMenuBar(&Application::saveAction, settings);
30513052 getAvatar()->saveData(settings);
3052− _swatch->saveData(settings);
3053+ _swatch.saveData(settings);
30533054 }
30543055
30553056 void Application::importSettings() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t